|
Forum Index : Microcontroller and PC projects : Autorun trouble with PicoMite 6.02 on PicoZero Board with DFPlayer
| Author | Message | ||||
| jwettroth Regular Member Joined: 02/08/2011 Location: United StatesPosts: 90 |
I'm building a very simple MP3 music player using a DF player connected via UART to a PICO Zero board running V6.02. All the PICO is really doing is providing a very simple user interface and a bit of power management for the DF Player. The PICO generates serial commands to control the DF Player, the busy line from the DF player is monitored and the PICO skips to a random track and continues- this all works well. The user interface is just two buttons to allow use by a toddler and to provide power management. The power management piece is just an external regulator with shutdown that is enabled when a green button is pressed, the regulator provides power to the PICO Zero and the DFPLAYER. When the Pico powers up, the first thing the basic code is to write a pin high that enables the external regulator and proceeds to talk to the DF player, etc. When a Red button is pressed, the music is paused, if the green button is pressed again it resumes otherwise it powers down in one minute. That's it. The problem I'm having is with autorun. I was hoping that the code would simply power up, latch the power on with a GPIO output to the regulator and then be able to turn things off by writing the GPIO low. However when Autorun is enabled, there is a long delay, about 5s, before the MMBASIC code starts. This requires to green button to held down for 5 seconds. Even after 5 seconds, the PICO doesn't reliably start running consistently. The GPIO pin is set as an output and written high as the very first line in my basic code. My basic question is how does Autorun work. Is there some hidden feature? Where does the long delay come from? Is there some pitfall that I'm running into? I read Peter's notes about enhancing performance and he doesn't seem to cover details of Autorun. I also don't understand the noreset option- the description is vague in the DOCs. My code is pretty short and works fine until I try to get it play standalone with Autorun. Help please. I want to give this to a certain toddler soon... John Wettroth |
||||
| phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 3470 |
Working backwards, the "NORESET" option is to prevent AUTORUN being reset to OFF in the event of an error halting the program. Cancelling autorun prevents an endless re-boot loop if an error occurs. NORESET makes it reboot regardless. The delay on startup has crept in over time as the firmware has grown bigger and more complicated. It takes time to initialize everything. If your program doesn't need all the latest bells and whistles use an early version of the firmware that boots faster. I think Geoff's site has an archive of older firmware. If not I may still have some old ones here that I could upload. Geoff's archive V5.05.04 may be worth a try. Edited 2026-11-28 18:12 by phil99 |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 12306 |
The delay is almost certainly because you are running without a connected usb console. It tries to connect this on a timeout. Try a later version where I think I shortened the timeout. Or use the PICOUSB2350 firmware which doesn't try and start the usb cdc connection. You will need a usb/uart connected to gp8/gp9 for programming |
||||
| phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 3470 |
As with John's use other embedded controller projects could benefit from a minimal boot delay. Would an Option to set the delay be practical? |
||||
| jwettroth Regular Member Joined: 02/08/2011 Location: United StatesPosts: 90 |
Thank you Phil and Peter! This explains everything. I'll try 5.05, I used this on MX170's back in the day with good luck in similar schemes. Thanks for your prompt reply. As far as an option goes, killing any long deliberate delays waiting for the console could be automatically shortened when autorun is enabled or perhaps another comma could be added to autorun for a console timeout. Most of the things that I build are portable handheld stuff. I generally wrap a layer of power management stuff around my Mites that have some keyboard I/F and perhaps an RTC for waking the system. The main PICO or MMite is just powered down. In some cases, I will stuff some variables in RTC RAM for state continuation on resume, etc. Many thanks to the Mite team. I've been playing with all this stuff since its inception and can't believe where we are now. I'm going to play with the amazing compiler features over the holidays. Footnote added 2026-11-29 05:28 by jwettroth Footnote added- I tried 5.05 but my code includes WS2812 code that wasn't a device until 5.08. Tried 5.08 to get 2812 support but it has very long delays as well. Am going to try the PICO235USB but don't have 2350 Zero boards that I can find. Putting together a work around but have to make changes. Still goofing around- the WS2812 is such a nice feature for a kid toy, I need it. If you think of anything further, I'm all ears. Don't want to rebuild everything for a full sized PICO but may end up there. Would make powering easier. Tradeoffs. Being an elf is a damn hard job... Thanks again. John Wettroth |
||||
Grogster![]() Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 10161 |
You can disable the USB connection totally, and then the 2040 runs instantly like the MM2 chips for example. Only consequence of that, is that you then need to use console pins on the Zero and connect an external USB VCP to those pins to be able to talk to the thing, but that is no REAL hardship - that is exactly how you have to talk to the MM2 chips anyway. OPTION SERIAL CONSOLE uartapin, uartbpin Page 123 of the PM manual. Smoke makes things work. When the smoke gets out, it stops! |
||||
| mozzie Guru Joined: 15/06/2020 Location: AustraliaPosts: 525 |
G'day Jwettroth, Whilst Peter suggested the PicoMiteRP2350USB firmware, for your RP2040 Zero boards the PicoMiteRP2040USB firmware should result in a faster start due to no USB at startup. As mentioned you will need a serial connection to the console. Regards, Lyle. EDIT: A couple of quick tests on RP2040-Zero boards, no timer just mk1 human eyeball on LED (CPUSPEED = 48000, No other options set): PicoMite RP2040 V6.02 = approx 4 seconds PicoMite RP2040 V7.00 = approx 2 seconds PicoMite RP2040USB V7.00 = approx 1 second ' prog to test autorun timing Option default integer SetPin gp16,dout WS2812 o,gp16,1,&hff Pause 1000 WS2812 o,gp16,1,&hf00 Pause 1000 WS2812 o,gp16,1,&hf0000 Pause 1000 WS2812 o,gp16,1,0 End Edited 2026-11-29 17:55 by mozzie |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |