Page 1 of 1

ESP32S2 running ULP-FSM example sought

Posted: Thu Jun 25, 2020 4:42 pm
by BB5000
Dear ESP32 S2 experts.
Currently I am having trouble to get the ULP to run in the ESP32S2 (Saloa-Board).
Apparently since the ULP has two modes (FSM as well as RISC-V) which can be utilized alternatively, further settings have to be done to get it off the ground. However despite following the steps as outlined in the "esp32-s2_technical_reference_manual" in chapter "27.4 ULP Coprocessor Workflow" it is not starting.
Before I waste even more time seeking for the other things that might have to be set, I would be more than happy if anyone had or knew of any simple operational example of ULP code running in an ESP32S2.
Thanks a lot in advance.
Bernd

Re: ESP32S2 running ULP-FSM example sought

Posted: Fri Jun 26, 2020 3:55 am
by ESP_Angus
Hi Bernd,

I'm afraid that, as you've noticed, we haven't updated the ESP-IDF ULP-FSM examples to work on ESP32-S2 yet. However the two ULPs are very similar, it should be possible to start with an ESP32 ULP-FSM program and make a few tweaks until it works.

Sorry I don't have anything more specific I can offer for now.

Regarding RISC-V ULP, support for this should be merged to master in the next couple of weeks.

Re: ESP32S2 running ULP-FSM example sought

Posted: Fri Jun 26, 2020 6:40 am
by BB5000
HI ESP_Angus.

Thanks for the swift reply.

My feeling is there might be other obstacles even within the IDF that are currently in my way, and thus it could be tedious to seek by trial and error what could be the root cause. May be there is even a wrong library linked at some stage or something else.

Talking about libraries I guess I found another issue that you perhaps are interested to forward to the right people:
There appears to be an inconsistency between with documentation and a library in connection with the RTC I2C implementation.
In the "esp32-s2_technical_reference_manual_en" in "27.7.2 Configuring RTC I2C" the registers for SDA High and Timeout are labled RTC_I2C_SCL_HIGH_PERIOD_REG and RTC_I2C_TIME_OUT_REG (or even RTC_I2C_TO_REG in 27.10). The labels offered by ESP-IDF are however RTC_I2C_SCL_HIGH_REG and RTC_I2C_TIMEOUT_REG respecitvely. How should anyone know?
From my point of view that should be fixed by a complete review of the "rtc_i2c_reg.h" library since e.g. SDA Low, the sibling of SDA High, has the naming scheme as outlined in the documentation RTC_I2C_SCL_LOW_PERIOD_REG while SDA HIgh differs.

I'll put my ULP attempts to rest for the time being then and give the the tooling some more time to mature until I resume my trial with the ULP.
If you however have a ULP-FSM example cookbook other than "27.4 ULP Coprocessor Workflow" or any additional hint please do not hesitate to lay it on me.

Best regards.
Bernd

Re: ESP32S2 running ULP-FSM example sought

Posted: Fri Jun 26, 2020 6:40 pm
by boarchuz
I've uploaded an example here:
https://github.com/boarchuz/s2-ulp-fsm-demo (fiddles with some variables, shows some new instructions, toggles LED)

You'll need the changes to IDF here:
https://github.com/boarchuz/esp-idf/tree/s2-ulp-fsm

Re: ESP32S2 running ULP-FSM example sought

Posted: Sat Jun 27, 2020 9:29 am
by BB5000
@boarchuz
Thanks a lot for the example.
It works like charme!
Compiling your example without updating the IDF to the version uploaded by you lead to the compiler throwing complaints at me regarding the amended FSM instruction set.
After over-installing your IDF it worked right away.
And guess what: My example with assembler code in .S files in the ulp subfolder now work as well!!!
Again thanks a lot, you are my personal hero of today :D
Bernd

Re: ESP32S2 running ULP-FSM example sought

Posted: Thu Oct 15, 2020 12:46 pm
by alex77
Hello!

Any changes with ULP FSM support for ESP32-S2?

I tried boarchuz's branch of the ESP-IDF but has issue with standard IDF examples.
ULP program is starting as i figured out but it stuck/fail on some istructions, e.g: ADC

Please let me know ULP-FSM status.

Re: ESP32S2 running ULP-FSM example sought

Posted: Thu Oct 15, 2020 11:31 pm
by boarchuz
viewtopic.php?t=14532

Consider using the RISC-V ULP processor. It's supported already, and is the obvious choice if you're writing a ULP program from scratch at this point. FSM's main use case would be for porting an existing program from ESP32, or requiring compatibility with multiple variants. And you'll need to wait for its implementation.

Re: ESP32S2 running ULP-FSM example sought

Posted: Fri Oct 16, 2020 7:05 am
by alex77
Thank you for reply.

I tried to run riscv example as well.
It is not running at all.
Main cpu is going to deepsleep but never wakeup.
I chnaged ULP's main to wakeup as first thing but nothing changed.
So, i think ULP code not running at all.

How can i debug it?

Thank you,
Alex

Re: ESP32S2 running ULP-FSM example sought

Posted: Mon Oct 19, 2020 3:15 am
by jasonyoon
I tried running riscv example also, and by modifying riscv code to change GPIO output levels, verified that ulp_riscv is running, but the main CPU never wakes up. How can I fix this?

Also, would like riscv adc read example.

Thank you!