On an M4 Grand Central using Arduino IDE to generate C apps, what should I do in the app so that when the board is powered up, it will immediately boot into the app?
Currently, reset/reboot/POR goes thru the bootloader and it take 10-15 secs before my app begins executing. For creating a standalone product solution, waiting so long for a reboot would be unacceptable.
Also, the same issue exists after an app has been loaded from the IDE - one has to wait 10-15 secs before the app actually starts. Is there some command that can be sent to the flash loader to immediately jump to and start executing the just-loaded app?
I have the latest bootloader v3.13.0 installed, and I'm using the latest Arduino IDE 1.8.13.
All libraries and code are at latest.
Grand Central M4 - how to boot directly to app
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- MikeGrobler
- Posts: 9
- Joined: Fri May 07, 2021 6:03 pm
- blnkjns
- Posts: 963
- Joined: Fri Oct 02, 2020 3:33 am
Re: Grand Central M4 - how to boot directly to app
It's weird. The program should run straight away. If you use the serial monitor, and include a while (!Serial) it might take some time to boot, but in a final product I suspect you won't keep serial monitor commands in your software.
- MikeGrobler
- Posts: 9
- Joined: Fri May 07, 2021 6:03 pm
Re: Grand Central M4 - how to boot directly to app
Currently for debugging, I’m using Serial1 which is the serial port to I/O pins, so not related to the virtual USB serial port.
When my app starts up the very first thing it does (even before starting the Serial1 port) is to flash the pin 13 LED - and from the time the Arduino IDE has completed the app upload to flash to when the LED flashes takes approx 10-15 secs.
Indeed weird and unexpected. It seems to me without using JLink to really debug the issue, that the bootloader is the culprit - I suspect it is waiting and watching for reset button presses to decide whether to boot to the app, or boot to Python or boot to the flash downloaded state.
When my app starts up the very first thing it does (even before starting the Serial1 port) is to flash the pin 13 LED - and from the time the Arduino IDE has completed the app upload to flash to when the LED flashes takes approx 10-15 secs.
Indeed weird and unexpected. It seems to me without using JLink to really debug the issue, that the bootloader is the culprit - I suspect it is waiting and watching for reset button presses to decide whether to boot to the app, or boot to Python or boot to the flash downloaded state.
- westfw
- Posts: 2006
- Joined: Fri Apr 27, 2007 1:01 pm
Re: Grand Central M4 - how to boot directly to app
That is strange.MikeGrobler wrote:it take 10-15 secs before my app begins executing.
I checked my GCM4 and it starts MUCH faster than that (less than 1s from either Power-on or reset switch.) (using the example "Blink" sketch.)
- adafruit_support_mike
- Posts: 67391
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Grand Central M4 - how to boot directly to app
We haven't seen any other Grand Central behave that way.
Post the simplest version of a program that demonstrates the behavior you're seeing (between CODE tags please) and we'll see if we can replicate it on our own hardware.
Post the simplest version of a program that demonstrates the behavior you're seeing (between CODE tags please) and we'll see if we can replicate it on our own hardware.
- MikeGrobler
- Posts: 9
- Joined: Fri May 07, 2021 6:03 pm
Re: Grand Central M4 - how to boot directly to app
I cannot replicate this with any program, because it's not what/which program I run, but rather how long it takes from reset to when the program starts running (or at least to when the program exhibits something observable). A 1-2 sec delay would be okay - less than 1-sec is preferable - but 10-15 secs is rather unacceptable.
- adafruit_support_mike
- Posts: 67391
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Grand Central M4 - how to boot directly to app
Yeah, that's far longer than it should take, but we've never seen a board behave that way.
Hardware is deterministic though, so things that happen repeatably have some kind of cause. If it happens with a trivial sketch like Blink, we can probably rule out software isses.
Does the delay happen when the board has no USB connection to a computer?
Hardware is deterministic though, so things that happen repeatably have some kind of cause. If it happens with a trivial sketch like Blink, we can probably rule out software isses.
Does the delay happen when the board has no USB connection to a computer?
- MikeGrobler
- Posts: 9
- Joined: Fri May 07, 2021 6:03 pm
Re: Grand Central M4 - how to boot directly to app
Sorry for delayed response - just now getting back to this project.
If I remove the USB connector and simply power the board from 12V, it takes even longer for the loaded app to start, approx 1 min.
The simple blink program also takes 15-20 secs to start from the time the firmware upload completes.
I also notice with great frustration that the double tap reset only works maybe 10% of the tries to get the board to be a USB device on my Ubuntu Linux, and once I get the reset tap dance just right so that all the little leds are lit, it takes another 20-30 secs before the USB device shows up in my Ubuntu Linux.
Most vexing!!??
I am using the latest Arduino IDE and libraries - 1.8.15, and I have the bootloader-grandcentral_m4-v3.13.0.bin, loaded with jlink to ensure that I do not have a corrupted bootloader.
If I remove the USB connector and simply power the board from 12V, it takes even longer for the loaded app to start, approx 1 min.
The simple blink program also takes 15-20 secs to start from the time the firmware upload completes.
I also notice with great frustration that the double tap reset only works maybe 10% of the tries to get the board to be a USB device on my Ubuntu Linux, and once I get the reset tap dance just right so that all the little leds are lit, it takes another 20-30 secs before the USB device shows up in my Ubuntu Linux.
Most vexing!!??
I am using the latest Arduino IDE and libraries - 1.8.15, and I have the bootloader-grandcentral_m4-v3.13.0.bin, loaded with jlink to ensure that I do not have a corrupted bootloader.
- MikeGrobler
- Posts: 9
- Joined: Fri May 07, 2021 6:03 pm
Re: Grand Central M4 - how to boot directly to app
Ok, good news, I found the culprit - I have an Adafruit RGB Matrix Shield plugged in, after I unplugged it, the Grand Central behaves correctly, boots immediately and the double reset tap-dance works correctly.
Now to debug why the RGB Shield is dragging the processor board down!!??
Thanks very much for your attention to this!
Now to debug why the RGB Shield is dragging the processor board down!!??
Thanks very much for your attention to this!
- adafruit_support_mike
- Posts: 67391
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Grand Central M4 - how to boot directly to app
That's also weird. The Matrix Shield is just a wiring convenience. It doesn't have any components.
Check the pin voltages when the Shield is and isn't connected to see if there are any differences. Off the top of my head, the only thing I can think of that would delay startup would be something holding the reset pin low.
Check the pin voltages when the Shield is and isn't connected to see if there are any differences. Off the top of my head, the only thing I can think of that would delay startup would be something holding the reset pin low.
- MikeGrobler
- Posts: 9
- Joined: Fri May 07, 2021 6:03 pm
Re: Grand Central M4 - how to boot directly to app
Only when the 64x32 RGB panel is plugged into the shield and powered on from its 5V PSU, does the reset go sluggish and not work properly.
But the RGB shield does not have a connection to the reset line, only to various digital I/O lines. The RGB panel is powered with 5V while the Grand Central requires 3.3V digital I/O - I wonder whether the RGB panel is properly deploying 3.3V logic levels???
But the RGB shield does not have a connection to the reset line, only to various digital I/O lines. The RGB panel is powered with 5V while the Grand Central requires 3.3V digital I/O - I wonder whether the RGB panel is properly deploying 3.3V logic levels???
- adafruit_support_mike
- Posts: 67391
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Grand Central M4 - how to boot directly to app
That shouldn't make any difference.
The signals coming from the Arduino are connected to input pins, which don't have any voltage of their own.. or more technically, have at least 10M of impedance to any part of the 5V circuit. The only normal issue with connecting 3.3V signals to 5V inputs is making sure the 5V circuit recognizes 3.3V as a HIGH input.
The signals coming from the Arduino are connected to input pins, which don't have any voltage of their own.. or more technically, have at least 10M of impedance to any part of the 5V circuit. The only normal issue with connecting 3.3V signals to 5V inputs is making sure the 5V circuit recognizes 3.3V as a HIGH input.
- MikeGrobler
- Posts: 9
- Joined: Fri May 07, 2021 6:03 pm
Re: Grand Central M4 - how to boot directly to app
Not quite true. Since the board is powered with 5V, any pullups will have 5V on them, to wit, the RGB pins: Latch, OE and Clk all are pulled up to 5V.
I think, too many hard 5V pullups are causing the issue. If I leave the RGB panel connected but disconnected from 5V the Grand Central board operates correctly.
Interestingly, if I start up the Grand Central while the RGB display is not powered, the Grand Central boots up correctly, and then when I apply power to the RGB display everything works fine and my program executes as expected.
Until of course the next reset and/or boot up...
Looks like I may need to place 3.3v / 5V level converters between - maybe just between the pulled-up pins??
I think, too many hard 5V pullups are causing the issue. If I leave the RGB panel connected but disconnected from 5V the Grand Central board operates correctly.
Interestingly, if I start up the Grand Central while the RGB display is not powered, the Grand Central boots up correctly, and then when I apply power to the RGB display everything works fine and my program executes as expected.
Until of course the next reset and/or boot up...
Looks like I may need to place 3.3v / 5V level converters between - maybe just between the pulled-up pins??
- adafruit_support_mike
- Posts: 67391
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Grand Central M4 - how to boot directly to app
Trouble is, the LED matrices shouldn’t have any pull-ups. The input circuits are similar to 74x595 shift registers with 16 bits instead of 8. Everything connected to the HUB75 connector should be a high-impedance digital input.
‘Should’ is different from ‘is’ thouugh, so you might want to check the resistance of all the inputs to see if there’s a blown gate somewhere.
‘Should’ is different from ‘is’ thouugh, so you might want to check the resistance of all the inputs to see if there’s a blown gate somewhere.
- MikeGrobler
- Posts: 9
- Joined: Fri May 07, 2021 6:03 pm
Re: Grand Central M4 - how to boot directly to app
Do you perchance have a schematic of the RGB Display - I have the 64 x 32 RGB Matrix device?
With 5V power connected to the RGB board, but not connected to the Matrix Shield, I measured the voltage on all the connector lines - that's how I discovered that Clk, OE and Latch are pulled up to 5V. All the other lines seem to be floating. Kind of makes sense that these lines are pulled up, especially Latch and OE - not sure about Clk.
With 5V power connected to the RGB board, but not connected to the Matrix Shield, I measured the voltage on all the connector lines - that's how I discovered that Clk, OE and Latch are pulled up to 5V. All the other lines seem to be floating. Kind of makes sense that these lines are pulled up, especially Latch and OE - not sure about Clk.
Please be positive and constructive with your questions and comments.