Closed patrickslarson8 closed 4 months ago
Hello @patrickslarson8, thanks for reporting this issue. We will take a look a tit a come back to you as soon as possible.
Hello @patrickslarson8,
Thanks for approaching us with this query. I see that the variable ulp_shared_deadman_threshold
is initialized by the HP core in the function load_bmi_defaults()
before the LP core is initialized. Once the LP core starts, it re-initializes the same variable shared_deadman_threshold
to 0 since it is a volatile
variable declared in global scope. Hence, you see this variable reported as 0 once the LP core starts to print. You should be able to see the value being set by the HP core if you set it after the LP core is up and running.
I see, so it is expected behavior then. Thanks for the help. I am closing the issue.
Answers checklist.
IDF version.
5.2.1
Espressif SoC revision.
ESP32C6
Operating System used.
Linux
How did you build your project?
VS Code IDE
If you are using Windows, please specify command line type.
None
Development Kit.
ESP32-C6-WROOM-1
Power Supply used.
USB
What is the expected behavior?
Variables declared in LP Core and linked into HP core are then set by HP core and are available by LP core.
What is the actual behavior?
Variables when read by LP core are all 0.
Steps to reproduce.
Steps
Overview
The variables are declared and linked following the instructions here: https://docs.espressif.com/projects/esp-idf/en/stable/esp32c6/api-reference/system/ulp-lp-core.html#accessing-the-ulp-lp-core-program-variables The HP sets the values at the variable addresses that are defined by some defines in a header file. After these are all set, the LP core is started and the HP core does not access these variables again (to prevent race conditions).
Code snippet in LP core:
Variables declared
bmi_160_register struct for reference
Variable usage in LP core
Code snippet in HP core
Debug Logs.
Output
HP Core
dogaddress:1342183744, shareddogvalue:5128
LP Core
The address translates to 0x50001940, which is in the LP SRAM according to the technical manual (to be expected).
More Information.
I have other variables and they are all reported as 0. The variable chosen to demonstrate is specifically a uint32_t to rule out any casting behavior.
Full Code
app_main.cpp
app_priv.h
bmi160_defs.h
main.c (low power core)