ULP Testing (pycom firmware with ULP support)

  • Re: Ultra Low Power (ULP) processor - Part 1


    I'm trying to test ULP coprocessor in pycom firmware, so if anyone is interested I've created a fork of pycom-micropython-sigfox on my github.

    There are two branches
    IDF 3.3.1 Based on stable firmware v1.20.2.r4
    IDF 4.1 Based on latest beta release v1.20.3.b3

    In order to compile, must follow exact steps as on readme but replacing the branch (and the repo address of course). BTW I'm thinking uploading bin files to another repo...

    Please, excuse me because I'm not an expert with makefiles and c programming, I've just figured it out which files and lines to modify from original micropython repo and adapt to pycom. Also seeking experts help here ;) because the code/makefile can be improved.

    The firmware compiles correctly without errors and you will end up with the same ULP as micropython repo
    ULP Help from micropython
    BUT instead of esp32.ULP() the function here on pycom is machine.ULP()

    I've testing it at the moment with good results compiling the assembly files on my computer with micropython for windows (compiling on lopy fails)

    Now I will figure out how ULP works and if we can do things while asleep, my goal is "listen" to inputs with ULP coproc.


  • @Géza-Husi Yes! I've tested with some code from different repositories and it works, I'll prepare some sample code and post here.

    I'm neither makefile nor esp-idf expert, so my current procedure is to use ThomasWaldmann py-esp32-ulp on my local computer with micropython v1.12 in order to compile .S file to .ulp and then upload to pycom module via FTP, this allowed me to quick test if ULP works but has some downsides (some of them because my lack of knowledge):

    • You have to load and run the ulp file at every boot
    • py-esp32-ulp converter doesn't take into account Espressif ULP macros/helpers issue#19 (READ_RTC_REG, WRITE_RTC_REG, and so on...)
    • I'm still figuring out how to do I/O manipulation from ULP (read digital input accomplished, but figuring out how digital output works)
    • I don't know how to signal main processor to wake up from ULP.

    I think the best way to implement ULP is to flash or generate binary file with esp-idf (in order to make use of macros) Maybe someone at pycom (Géza ;-) ) or people with more esp-idf knowledge than me can shed us some light.

    My use case with ULP is more or less the same as @Calvin-Foo but for water metering, counting pulses while asleep and waking up the module every 'N' pulses in order to take actions or save values.

    Regards and thanks for chiming in!

  • @DualMatic
    May I ask that did you manage to make the ULP work? Is the binary you upload and load/run via the MP APIs executed ?
    Thanks !

  • nice! will try this.

    trying to implement ULP pulse counting for gas metering....

  • Hello all,

    I've just compiled and released binaries for lopy4, gpy and fipy n my repo.

    Please note,

    • This firmware is for testing ulp coprocessor
    • Based on last beta release
    • Doesn't have pybytes enabled
    • I've compiled with Differential Update enabled

    I'll maintain this post updated with my findings, and I encourage other users to test if interested on ULP.

    Best regards

Log in to reply

Pycom on Twitter