As far as I know, this is the most extensive video on ESP32 ULP programming. Thanks!
@piconano2 жыл бұрын
Epic video. Can't wait for the ADC and I2C video.
@atomic142 жыл бұрын
Hopefully in the next couple of weeks :)
@piconano2 жыл бұрын
@@atomic14 👍
@remy-2 жыл бұрын
@@atomic14 my god. The hw i2c function is the most unsupported ever from Espressif haha. Very curious if you can let it run. Nice video this one!!
@Alice800012 күн бұрын
listening to your voice put all my boards into deep sleep
@Alice800012 күн бұрын
and i couldn't wake them 😔
@Magic-Smoke2 жыл бұрын
So glad you've done this. Roll on the I2C work :)
@atomic142 жыл бұрын
Should be soon - might do the ADC first, I'll see how they progress.
@chuckcrizer2 жыл бұрын
Much appreciated. This was a very well done technical video. Watched it a number of times.
@igorfernandes8932Ай бұрын
the I2C video never came to life, right? Sad, but great video my friend
@theworldopenthenext2 жыл бұрын
Man, haven’t you just explained Assembly basics in three minutes or so? Amazing
@NotMarkKnopfler2 жыл бұрын
I'm going to be trying this out tonight. I am in a hotel (by myself) for the next few days and I brought an ESP32 with me. Time to play....
@atomic142 жыл бұрын
I've got into the habit of packing an ESP32 on my all my trips - keeps me out of trouble...
@ei23de2 жыл бұрын
Super useful for low power IOT devices! Thank you!
@atomic142 жыл бұрын
The ESP32 keeps on surprising me with what it can do.
@ei23de2 жыл бұрын
@@atomic14 Yep, there is a lot to discover! The TOF feature of the ESP32-S2 also got me interested.
@zolar7a2 жыл бұрын
I haven't used assembly since 1991, I'm going to have to dust off the cobwebs. Thanks for the video.
@atomic142 жыл бұрын
I used to do a bunch on my old ZX Spectrum - that's a long time ago now :)
@iiilllii1402 жыл бұрын
This was a very well explained, in depth video. I was lacking some prerequisites, but now after some study (assembly,bit operators,...), and rewatching your video this makes totally sense. I will take a look into the rtc register, thanks for the provided link 👍
@yurievi42 жыл бұрын
as always informative and marvelous!
@atomic142 жыл бұрын
Thanks!
@andrew2004sydney2 жыл бұрын
Excellent video! Thanks for making it
@CagnPolat2 жыл бұрын
An other great video. Thank you...
@theruisu21 Жыл бұрын
this video is great!
@NotMarkKnopfler2 жыл бұрын
This is gold thank you!
@atomic142 жыл бұрын
Thanks!
@amazingtechnology19616 ай бұрын
Thank you!
@remy-2 жыл бұрын
I’m full into studying the esp32-s3 now, because it has a c-programmable ulp..
@YTbxg2 жыл бұрын
A really useful video and very interesting. (plus I may now boast that I have done some assembly language code - better be careful or someone my think I'm a real programmer :-)
@atomic142 жыл бұрын
Proper old school development :)
@sharpbends2 жыл бұрын
Good explanation thank you :-)
@atomic142 жыл бұрын
Thanks :)
@thexht79279 ай бұрын
1:08 at this point, I usually just add nmos to flip the logic to active high 😂
@Bianchi772 жыл бұрын
Creative video, thanks :)
@lemingtai37472 жыл бұрын
I clicked the video just because of the thumbnail
@atomic142 жыл бұрын
I hope you weren't disappointed :)
@lemingtai37472 жыл бұрын
@@atomic14 I wasn't, thanks for the video
@zyghom2 жыл бұрын
I was so hopeful seeing the subject of this video and then ... I got lost after 3rd minute or so... time to go back to school ;-(
@WistrelChianti2 жыл бұрын
There were some mistakes at the start that may have thrown you. The narration doesn't match what is being highlighted near the start. e.g. he talks of a command taking a register and a register as input while highlighting the form that takes a register and a value, or vice versa. I'm not sure if the add command was whack or not too. There is a mistake too with ST command where he stores at the memory location of R0 instead of R2 (as illustrated in the memory diagram).
@zyghom2 жыл бұрын
@@WistrelChianti no no, it is my who knows nothing - not about bad video ;-)
@atomic142 жыл бұрын
You're right - the MOV from immediate is highlighted when the move from register should be. And the ST example has a bug in it.
@peter.stimpel2 жыл бұрын
nice topic. fiddling with power consumption caused a few more grey hair, here
@atomic142 жыл бұрын
Indeed, there's a lot of variables to play with and a lot depends on the board you are using and how well it's been designed.
@TobiasWerner12 жыл бұрын
Thanks for this great video! When explaining the LD/ST commands, shouldn't the last example call be "ST R1, R2, 0"?
@BerthaProt Жыл бұрын
I agree, should be ST, R1, R2, 0
@WistrelChianti2 жыл бұрын
thanks that's super useful. I want to go back over my previous ULP code now with a hopeful renewed understanding of what it's doing. Might see if I can pass a var back and forth too... (was only controlling pins before).
@WistrelChianti2 жыл бұрын
what I'm a little unsure of still is what config state the pins are in during main code/cores execution after the ULP has been playing with them. A nice example would be to cover how to (elegantly - fairly certain I badly hacked it) pass control of a pin back and forth between the ULP and the main processors. Interested to know a little more about running them both (main cores and ULP) at the same time too. What was the 5 second thing doing incidentally? waiting 5 seconds before deep sleeping and starting the ULP?
@WistrelChianti2 жыл бұрын
ah, having watched your deep sleep video I think I get it now. So in essence all pin states are dropped whenever you enter deep sleep. The only way to maintain them, is to set the hold bit on each pin you want to maintain the state of. If you want to change the pin state though via the ULP when the main cores are sleeping, you need to unset the hold bit, make your change, and then ensure you set it again before halting... presumably, if you didn't, and the pin was high, it would just switch off as soon as the ULP hits halt? When you get back to main core code, presumably everything about a pin with the hold bit set is maintained (direction, pullups, state)? Does this sound right or am I still getting confused? Presumably, if both the ULP and main cores are running at the same time, the hold bit is irrelevant?
@atomic142 жыл бұрын
That's correct, if you don't set the hold bit as soon as the ULP program halts the pin would switch off. That is a good question about when you come out of sleep - and I'm actually not sure on the answer. Needs investigation.
similar code was written years ago. ULP can even do I2S and I2C
@atomic142 жыл бұрын
Definitely I2C - there are even people bit-banging I2C to support 16 bits communication. I haven't seen anyone doing I2S though I'm sure it's possible,
@edgull_tlt2 жыл бұрын
Спасибо
@theunderdog22052 жыл бұрын
Another very well put together video, thanks for your efforts. I have one question where did the video go showing how u setup your linux audio server? I have the esp32 setup just need instructions on the server side. Thanks in advance
@atomic142 жыл бұрын
I'm not sure I did a video on it - there's instructions here: github.com/atomic14/esp32_audio#server - let me know if you have any problems.
@victoralberti1982 жыл бұрын
I have one question about that hold bit at 14:34 , because I notice that register exists in source code, however it's not present into the technical reference manual. How did you know that you needed to set/clear this hold bit into this register? Thanks for another great video, it's certainly the most valuable video I ever found about ULP.
@victoralberti1982 жыл бұрын
JFY, in the page 85 of the reference: www.espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf, it says the bit 25-31 are reserved and it doesn't mention a lot of information about holding the output.
@majid5052 жыл бұрын
I smashed the like for the thumbnail only. Video didn’t watch 😂
@iambyrdman2 жыл бұрын
If you help me with some ESP programing, I'll cut you into the payout I'll have for a patent I have that I need help programing a chip for simple stuff. Listening for sounds to slow, then cutting power when it slows. Can you help? New sub here. Love your stuff. I owned a Commodore vic 20 when it was a new product, how long I've been a geek...
@juandeMTO2 жыл бұрын
Good Video!! What should be the changes to use the Platformio IDE with the Arduino framework instead of the esp-idf?
@atomic142 жыл бұрын
With platformio you only have support for the ULP if you are using ESP-IDF framework. But you can add the Arduino library as a component. It's not for the faint hearted, but the instructions are here: docs.espressif.com/projects/arduino-esp32/en/latest/esp-idf_component.html I will do a video on this at some point and run through the instructions to make sure they work!
@ishdemon_2 жыл бұрын
@@atomic14 looking forward to that
@davidkleng17112 жыл бұрын
High, great video. Do you have any about begining with ESP32 programming? I only program it with arduino.
@atomic142 жыл бұрын
The ESP-IDF GitHub repo has some good examples, most things translate across quite easily. A lot of the difficulty is that a lot of libraries assume that you are building on top of Arduino. You can run Arduino as an ESP-IDF component. And there's also nothing stopping you using ESP-IDF functions when using the Arduino framework.
@lowkuleeuwner28152 жыл бұрын
Wow this is awesome. I am really into this. I have one question. I want to count pulses using the ULP. I want to sleep in the ULP for x amount of time and every time a gpio int is triggered then increment counter and go back to sleep (not necessarily wake the main mcu). But the only way I have found to do this so far is to wake the main mcu for a very short time after the interrupt, check if it was woken by the timer or the interrupt and go back to sleep. Do you think this is possible with only the ULP.
@atomic142 жыл бұрын
The only way I know how to do this is have the ULP wake up quite often and poll the GPIO to detect if it has changed and count a pulse. At the same time maintain a count of how often the ULP has woken - this will give you a rough measure of how much time has passed and you can wake the main mcu when you want to.
@lowkuleeuwner28152 жыл бұрын
@@atomic14 Thank you so much for the reply. I actually have an external timer that manages my Sleep time. So in theory I want to have absolute minimum power usage while counting the pulse pin, and then when the other pin is triggered turn main mcu on. I guess my question is, can the ULP go into a sort of sleep mode and get woken up by pin interrupts, and decide whether to go back to sleep (after incrementing counter) or wake main MCU.
@atomic142 жыл бұрын
@@lowkuleeuwner2815 Unfortunately not, there's no interrupt wakeup for the ULP. I did find this forum post where someone was trying to do pretty much what you are talking about www.esp32.com/viewtopic.php?t=16493
@WistrelChianti2 жыл бұрын
@@atomic14 I'm guessing the ULP is low enough in power it's almost considered to an interrupt in it's own right... but a slightly more intelligent one. That being the case... maybe just have it run code that checks the input pin for state changes constantly and maintaining a count, then have it wake the main cores when it's over threshold. When programming counters on the ULP, keep in mind the small size of the registers though. You'll possibly blow your way up to 65536 pretty fast.
@WistrelChianti2 жыл бұрын
@@lowkuleeuwner2815 just been having a read around on this and indeed as atomic said, can't be done. You can only wake the ULP from a timer, not an interrupt. Not what you are after but for bonus fun, apparently you can have more than one ULP program. You can also have the ULP program control how long it sleeps for in between executions (5 configurable options see sleep command). So for example you could have a long delay before it initially starts, then shorter delays between subsequent runs. You could have logic in your program that changes which delay is being used, so possibly this functionality may be used to allow longer or shorter sleep periods depending on the state of things that you care about.
@TheEmbeddedHobbyist2 жыл бұрын
Nice, currently having problems with ESP8266RTOS and Eclipse IDE which is driving me mad. with some projects the IDE can't resolve the include files. so shows errors that arn't there, but of course the complier can so they build fine. 😞
@atomic142 жыл бұрын
I hate it when that happens - the tools are conspiring against us!
@TheEmbeddedHobbyist2 жыл бұрын
@@atomic14 The worst of it is it's a well known fault with windoze. all fixes i can find don't fix it. the bugger is some projects don't have the issue with the same includes ?
@atomic142 жыл бұрын
@@TheEmbeddedHobbyist VSCode sometimes has the same problem with C++ Occasionally it just forgets how to autocomplete or find headers. Or it starts using gigabytes of RAM! I think C++ is just a hard problem :)
@luscaidau33259 күн бұрын
I cant seem to create an .s file tab enven though i folow it closely
@RGPinger2 жыл бұрын
is it possible to use ULP coprocessor with ultrasonic distance sensor (HC-SR04 or JSN-SR04T) that have Trigger and Echo pin? I want to use ULP coprocessor to measure distance between sensor and water level each 5 minutes and then wake up Xtensa and send data via HTTPS POST request to webserver. I was thinking how to program it. This video gave me really good answers to questions how to start, but I am unable to do it :-) I was never programming in Assembly.
@ulis.15442 жыл бұрын
Isn't there an issue on the esp32 ulp when using i2c that prevents you from reading low bytes. Have a look on the esp32 forum
@atomic142 жыл бұрын
Interesting - I'll take a look - could save me a lot of headscratching!
@MPElectronique2 жыл бұрын
Hello. Does it work with esp32 core 1.0.5 of Arduino IDE? Thanks. Marc.
@WistrelChianti2 жыл бұрын
How much memory is available to the ULP? You mentioned there is 8k (or was it 16k?) RTC/recovery memory available to store data in during deep sleep in your deep sleep video (usable via a prefix to a variable declaration). Can the ULP also reach this memory? or is it the same memory even?
@atomic142 жыл бұрын
Yes, the ULP can read the same memory, from ESP32-DevKitC v4 onwards it's 16Kb, before that it's 8Kb. So probably safest to stick to just 8Kb unless you know what your code will run on.
@WistrelChianti2 жыл бұрын
@@atomic14 if you mean the dev board, I'm using a DOIT v1 IIRC however I suspect you mean something else... e.g. the actual chip? any way to determine what I have?
@poepflater2 жыл бұрын
I would like a way to run a PWM pin while in deep sleep mode
@atomic142 жыл бұрын
I think the only way to do that would be by bit-banging with the ULP. What frequency do you need to run at?
@nikkismith87502 жыл бұрын
Thanks for such a great video! Have you had any success in getting the ULP I2C_RD instruction working? or do we have to bit-bang in software?
@atomic142 жыл бұрын
I haven't done it myself yet - from reading around the biggest limitation is that it will only do 8 bits. So if you want 16 bits you have to bit-bang.
@nikkismith87502 жыл бұрын
@@atomic14 thanks so much for the quick reply :) I'm just writing a ULP program that needs ADC and I2C, so I wish I could jump into the future and watch your next video in this series. lol
@johntilghman2 жыл бұрын
Which ESP32 board are you using, could I get a link to it?
@EmilFihlman2 жыл бұрын
I doubt that comment about .S vs .s
@atomic142 жыл бұрын
github.com/duff2013/ulptool “Typically in Arduino you can compile assembly files using the '.S' extension. Using the ESP32 Arduino core framework these files would correspond to the Xtensa processors whose toolchain is incompatible with the ULP coprocessor. Luckily, Arduino provides a fairly easy series of recipes for building the ULP assembly files by using the '.s' extension which Arduino will let you create.”
@EmilFihlman2 жыл бұрын
@@atomic14 yeah so like I said, you can use either, it's not a hard coded limitation, by changing the configs to select the correct files. I bet you can use .s in platformio just fine by changing the makefiles etc to use .s instead of .S etc.
@atomic142 жыл бұрын
@@EmilFihlman In platform.io you can yes - but not in Arduino. Even though you can use whatever you want in platform.io it's probably best to stick with what the ESP-IDF documentation suggests?