This code is based off the existing adc threshold example for the ESP32S2 (
https://github.com/espressif/esp-idf/tr ... sm/ulp_adc).
I need to store ADC values into an array in the ULP FSM mode so that the chip can undergo multiple deep-sleep cycles whilst still retaining the data to be printed in active mode, I declared an array in assembly as such:
.global adc_reading
adc_reading:
.long 0
.long 0
.long 0
.long 0
.long 0
In the entry part of the code (which runs everytime the ULP timer wakes the ULP co-processor), I incremented the sample counter and used it as the offset for adding to the array as such:
adc r1, 1, adc_channel + 3 //saradc1
add r0, r0, r1
rsh r0, r0, adc_oversampling_factor_log
move r3, adc_reading
st r0, r3, sample_counter
However, the array returns 0s, unless the st instruction's 3rd argument (sample_counter) is a constant like 0 or 4. Does anyone know how to effectively store the value of data collected in deep-sleep in an array over multiple deep sleep cycles?