|
Forum Index : Microcontroller and PC projects : OPTION AUTORUN ON disappears after powering the board off and back on
| Author | Message | ||||
| kermess Regular Member Joined: 04/04/2013 Location: SpainPosts: 49 |
Good afternoon. I am trying to understand a behaviour of OPTION AUTORUN ON that I find rather puzzling. I used this feature some time ago and do not remember having this problem. To check it as simply as possible, I decided to carry out the test using a new Pico 2W running WebMite MMBasic RP2350A V6.03.00, with no program, no Library and no WiFi or other peripherals configured. The test is performed from the Tera Term console. The attached screenshot shows the complete sequence up to the point where the board is powered off. The console first executes OPTION LIST, then OPTION AUTORUN ON, followed by another OPTION LIST, confirming that AUTORUN ON is correctly shown. ![]() At this point I completely power off the Pico 2W, wait a few seconds, and then power it on again. The screenshot continues after the restart. The first thing that appears is the normal WebMite identification: WebMite MMBasic RP2350A Edition V6.03.00 followed by the copyright information and the Tera Term prompt. Without performing any other operation, I then execute OPTION LIST. In this second OPTION LIST, OPTION AUTORUN ON is no longer shown. The board has started normally and no error message is displayed. Should OPTION AUTORUN ON remain set after powering the board off and then back on? Is this the intended behaviour? Or am I missing some condition or step in the procedure? Thank you for any clarification. David |
||||
| homa Guru Joined: 05/11/2021 Location: GermanyPosts: 675 |
I mean, that’s exactly the problem – ‘no programme’! However, the manual doesn’t say anything about this either, or?*: Instructs MMBasic to automatically run a program on power up or restart. ON will cause the current program in program memory to be run. Specifying ‘n’ will cause that location in flash memory to be run. ‘n’ must be in the range 1 to 3. Specifying the optional parameter “NORESET” will maintain AUTORUN even if the program causes a system error (by default this will cause the firmware to cancel any OPTION AUTORUN setting). OFF will disable the autorun option and is the default for a new program. *<-- ? Entering the break key (default CTRL-C) at the console will interrupt the running program and return to the command prompt. |
||||
| PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 2069 |
Isn't Autorun different in that it needs to be in the code? |
||||
| phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 3366 |
An alternative to Autorun that can't be cancelled is MM.STARTUP at the start of the program. Sub MM.STARTUP Pause 99 'Ensures Ctrl-C can be used if stuck in a reboot loop. RUN End Sub |
||||
Grogster![]() Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 10026 |
I've always just issued it at the command prompt, and it has always worked - and been saved with all the other options. SOME options DO need to be in the code, such as OPTION EXPLICIT or OPTION DEFAULT, but as for autorun, I've never included it in any code, and always just set it as once of my last steps. Mind you, I have ALWAYS had a code there to run. This example might be causing the interpreter to stumble, as there is no code to run. Perhaps the interpreter even KNOWS there is no code to run, so disables the autorun automatically or something - might POSSIBLY be by design. Peter or Geoff would know, and they might chime in here. Smoke makes things work. When the smoke gets out, it stops! |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 6062 |
Option Autorun is smart. When you turn autorun on, it executes the code in flash. When an error occurs, it sees the program in flash as corrupt, and will not start it again. The option is reset. It will not show anymore when you do an OPTION LIST. Since some errors (i.e. in a Webmite, when you do not get an IP address) could lead to reboots this avoids endless reboots. If you have a program that could error, but you insist in starting it up after a reboot (you don't mind endless reboots) then use OPTION AUTORUN ON, NORESET This is used in Game*Mite, where the menu must always show, even if a game crashes. Regards, Volhout Edited 2026-08-27 16:35 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
Grogster![]() Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 10026 |
Well, there you go then! You need a code of some sort. Or OPTION AUTORUN ON, NORESET Even just a "Hello World" would do for testing, to allow AUTORUN to actually run. Edited 2026-08-28 09:29 by Grogster Smoke makes things work. When the smoke gets out, it stops! |
||||
| Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3366 |
There is a bit of confusion here and I'm not sure quite what is going on, but the following might help. If the Picomite is powered up normally, or rebooted by the watchdog timer, or by the CPU RESTART command, the AUTORUN ON option will cause the program in flash to be automatically run... we all know that. BUT if the reboot was caused by a CPU exception the Picomite firmware will ignore the AUTORUN setting, it will NOT run the program and it will clear the AUTORUN setting. A CPU exception is normally something within the firmware, like trying to access non existent memory or hardware. This is different from the Micromite which always honoured the AUTORUN option, regardless of what caused the reboot. The problem with the Picomite behavior is that in an embedded controller it could fall over and the only way to fix it would be to pull it out of service, connect to the console and reinstate the AUTORUN ON option. Cycling the power will not help. I discovered this on the early WebMite versions which had trouble in its TCP/IP stack and was always generating CPU exceptions. Peter's solution was to add the ,NORESET option to act like the Micromite. I don't see any mention of unexpected reboots in this thread so this explanation might not be relevant. But it does explain why the ,NORESET option is there and what it is intended to fix. Also, you can put the AUTORUN ON option in the program. It does no harm and it is one less option that you have to remember to set. Geoff Edited 2026-08-28 14:52 by Geoffg Geoff Graham - http://geoffg.net |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |