ULP counter
Posted: Mon May 18, 2020 9:46 am
Hello everyone,
We are a team developing a software for the ESP32 and we are using the ULP coprocessor. We have encountered a problem when inplementing a counter. The ULP code used is the following:
To print the variable in the main ESP32 program:
The numbers that appear on screen are the double of what they are supposed to be. Do you know what may be the problem?
We think that it may be because it is a 16 bit variable in a 32 bit word, and when reading we read the correct 16 bit number followed by a 16 bit number 0.
If it is of any interest, we are currently using Arduino IDE with duff2013's ulptool.
Thanks in advance,
Marc
We are a team developing a software for the ESP32 and we are using the ULP coprocessor. We have encountered a problem when inplementing a counter. The ULP code used is the following:
Code: Select all
move r0, counter
ld r1, r0, 0
add r1, r1, 1
st r1, r0, 0
Code: Select all
printf("Counter value = %d\n", (ulp_counter &= UINT16_MAX));
We think that it may be because it is a 16 bit variable in a 32 bit word, and when reading we read the correct 16 bit number followed by a 16 bit number 0.
If it is of any interest, we are currently using Arduino IDE with duff2013's ulptool.
Thanks in advance,
Marc