![]() |
Forum Index : Microcontroller and PC projects : Recover from 'option console off' ?
Page 1 of 2 ![]() ![]() |
|||||
Author | Message | ||||
MustardMan![]() Senior Member ![]() Joined: 30/08/2019 Location: AustraliaPosts: 175 |
Hi, I just managed to fatfinger my Explore 100 and render it unresponsive to the USB port with OPTION CONSOLE OFF when what I really wanted to tell it was OPTION LCDPANEL NOCONSOLE My intention was to get PRINT commands coming through the USB port to my PC, and TEXT commands going to the LCD screen... both were appearing on the LCD which was undesired. I'm using PRINT for diagnostics & error codes, and the user interface text is going to the LCD with TEXT. However, I typed the wrong thing and now the USB port won't talk to the micromite any more. I can no longer upload programs, type input, or even halt the currently running program (reset/poweron restarts my program as I have AUTORUN turned on). Is my only option for recovery to reflash the firmware? Cheers, MustardMan. |
||||
mikeb![]() Senior Member ![]() Joined: 10/04/2016 Location: AustraliaPosts: 174 |
Have you tried releasing the micro from 'Reset' whilst simultaneously firing 'exclamation' marks at it via the USB port ? I think it needs about 30 of them from memory. Definitely seen it in the manual somewhere. There are 10 kinds of people in the world. Those that understand binary and those that don't. |
||||
KeepIS![]() Guru ![]() Joined: 13/10/2014 Location: AustraliaPosts: 1882 |
Don't know if this will work with M100 or Console disabled, but worth a try before reflashing. Resetting MMBasic MMBasic can be reset to its original configuration using either one of two methods: The chip can be reprogrammed with the Micromite firmware using a PIC32 programmer. Sending a stream of exclamation marks (!) to the console Rx pin at 38400 baud during its startup. In the first 100 ms after powering up the Micromite will set the console to 38400 baud and check to see if an exclamation mark is received. If so, it will then wait for two seconds to see if it is going to get more than 30 of them in that time. If this is the case the Micromite will reset itself to its initial defaults and send the message "MMBasic reset completed" to the console. This reset can be accomplished by simply setting the terminal emulator to 38400 baud and holding down the exclamation key and rely on the automatic keyboard repeat while powering up the Micromite (on most keyboards this requires holding down shift and the number one key). This will even work if the console has been set to a non standard baud rate. Either method will result in the program memory and saved variables being completely erased and all options (security PIN, console baud rate, etc) will be reset to their initial defaults. NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
KeepIS![]() Guru ![]() Joined: 13/10/2014 Location: AustraliaPosts: 1882 |
Posted above before I noticed your reply ![]() NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
MustardMan![]() Senior Member ![]() Joined: 30/08/2019 Location: AustraliaPosts: 175 |
Thankyou for the quick reply, but unfortunately no luck. I tried both reset & power-on, but perhaps (?) because I have autorun turned on there is no delay at startup and it begins executing my code immediately. I could try a separate connection to TX/RX (if I can find an adapter!), but I think what I will have to go with is a reflash. Oh well, I should be more careful with my OPTIONs! Thanks for the tip about "!", it was certainly one that I was not aware of. Cheers, |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
You could attach a PS2 keyboard VK7JH MMedit |
||||
KeepIS![]() Guru ![]() Joined: 13/10/2014 Location: AustraliaPosts: 1882 |
Yes Jim is right, thought of that having tea, if the program is running and not constantly crashing and restarting then pressing CTR_C should get you out of it, then simply enter the option to restore the Console port. NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
MustardMan![]() Senior Member ![]() Joined: 30/08/2019 Location: AustraliaPosts: 175 |
No, there no luck there either. I know the keyboard is OK since I was using it on the Explore only a month back (before I got 'doze to play USB *like it should* (I hate computers, or more accurately, m$oft)). Perhaps it is the autorun getting there first... I know I saw a flowchart of what happens at turn-on / reset, but for the life of me I can't find it. The documentation is quite good, but it is horribly scattered and you need to peruse several manuals and collate all the tidbits from each. Since the Explore 100 has no ICSP header by default, looks like it is out with the soldering iron and brushing up on MPLAB for me! I was sort of hoping there was a "reset" jumper that would do the same as the "!" trick. So what is "Pin 51" for...and that mysterious not-mentioned-on-the-schematic 'pin 17'...?? |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
Even with AUTORUN set on (A risky thing to do unless 100% debugged), holding the ! key down so it auto-repeats when you reset the micromite should catch it and do the reset for you. VK7JH MMedit |
||||
MustardMan![]() Senior Member ![]() Joined: 30/08/2019 Location: AustraliaPosts: 175 |
I was preparing for a demo - so my code was in a state able to operate by itself and I wanted to demonstrate how the device would start cold, so I turned autorun on. I was still printing diagnostics at this stage and I thought to make the demo look even better I would remove them from the LCD (but have them come out on the PC), and that is when the fatfinger problem happened. An interesting side note: using the 'comms window' in MMedit I noticed things like ^C and 'enter' make the Explore 100 onboard red LED flash, but other characters don't (including !). So I fired up teraterm on the slim chance standard characters were not making it through. The red LED flashed with every character... But, neither will break in. ![]() |
||||
KeepIS![]() Guru ![]() Joined: 13/10/2014 Location: AustraliaPosts: 1882 |
You've accidently disabled the inbuilt console port, thereby freeing up that port for general IO. The running program graphics should still displays on the LCD screen, pressing CTRL-C from a PS2 keyboard does nothing at all? If you don't want to stuff around with MPLAB, grab a Microbridge if you have the time to wait for one to arrive, much easier that installing MPLAB. NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
Turbo46![]() Guru ![]() Joined: 24/12/2017 Location: AustraliaPosts: 1642 |
The flowchart is on page 47 of the latest Micromite User Manual. Bill Keep safe. Live long and prosper. |
||||
MustardMan![]() Senior Member ![]() Joined: 30/08/2019 Location: AustraliaPosts: 175 |
Finally found that flowchart... ![]() Looks like the AUTORUN test is pretty early on. @KeepIS That is it: the LCD does everything it should, but no comms to the outside. I can see this would (and is going to be) excellent for the final application, but at this juncture it is not so helpful! I've downloaded the latest ZIP version (5.05.02), just finished soldering in the ICSP header, already have the IPE installed for doing other things, so it is off to my not-connected PC I go... just thought I would share that flowchart in case anyone is interested. Cheers! |
||||
KeepIS![]() Guru ![]() Joined: 13/10/2014 Location: AustraliaPosts: 1882 |
Understand, I don't have an M100 here at the moment so I can't remember if it immediately restarted the Program on CTRL-C with just Autorun on, you should see the program restart when CTRL-C is entered via the PS2 keyboard in any case, unless the Break char has been changed, as in when writing your own CTRL-C Handler. The ArmH7 implementation of MMBasic will always break on a Keyboard CTRL-C and will not restart with Autorun enabled until power on/off - UNLESS - the program has a bug AND the watchdog is also enabled, in this case it will be almost impossible to break out of and usually require a quick re-flash. NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
MustardMan![]() Senior Member ![]() Joined: 30/08/2019 Location: AustraliaPosts: 175 |
I am reasonably sure I tried ^C on both the USB port & the PS2 port, but I can't be absolutely sure, and now the reflash is done. I could 'unrespond' it again just to try I suppose, but I strongly suspect (as you say above) that the CONSOLE OFF command releases the pin altogether (so it can be used for other things), and after that happens, no character would ever get in. The reflash procedure is pretty quick, taking perhaps 10 minutes including downloading the latest HEX file and doing the soldering. Unfortunately yesterday I was at the clients place getting ready for the demo and had no access to any soldering gear, my pickit, a PC that I could fool with... Anyway, the demo went well and I have been given the go-ahead for the next phase. |
||||
KeepIS![]() Guru ![]() Joined: 13/10/2014 Location: AustraliaPosts: 1882 |
Great, always nice when the hard work pays off. The PS2 keyboard will always work unless its been disabled with Option Keyboard, has not been enabled or not reenabled after a re-flash. NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
robert.rozee Guru ![]() Joined: 31/12/2012 Location: New ZealandPosts: 2442 |
i would have hoped that the MMbasic firmware would still configure what would have normally been the serial console RxD pin as input and checked it for a string of '!' at 38400 baud for 100ms at startup, irrespective of how anything else had been configured. as long as the TxD pin remained unconfigured, this would be harmless from the hardware's perspective. if you have the time and patience, it would be good to investigate and report the behaviour back to geoff. cheers, rob :-) |
||||
MustardMan![]() Senior Member ![]() Joined: 30/08/2019 Location: AustraliaPosts: 175 |
@robert.rozee Upon your suggestion I went back to repeat my misadventure. Summary: for the Explore 100. "OPTION KEYBOARD US" must be set for a PS2 keyboard to work... my problem was that it was *not* set... I never saw the use for having a PS2 keyboard hanging off my system, so plugging in a keyboard did not and could not save me. Assuming PS2 is enabled, after "OPTION CONSOLE OFF" a PS2 keyboard will still operate just fine. All characters get through, and a ^C will break. All USB comms are disabled, and output (from PRINT) will still go to the LCD - so as an aside, it would not have prevented my debug messages from appearing like I wanted. I don't have a Tx/Rx serial connection to try, sorry. The "!" trick does not work with a PS2 keyboard. The USB comms are fully restored by an "OPTION CONSOLE ON". The "!" trick works (over the USB port), and resets BASIC to fresh. After that of course, the PS2 keyboard no longer works until OPTION KEYBOARD US is executed. An "!" sequence from the PS2 keyboard still does nothing. It did surprise me that OPTION LCDPANEL CONSOLE and OPTION CONSOLE OFF were able to be set at the same time and even more that console output would still appear on the LCD when I had asked for "console off". However, now I know better how it all works. So thankyou everyone. Cheers, |
||||
KeepIS![]() Guru ![]() Joined: 13/10/2014 Location: AustraliaPosts: 1882 |
Yes that's correct for the "!" char not working over PS2, it's only works for console serial coms. It did surprise me that OPTION LCDPANEL CONSOLE and OPTION CONSOLE OFF were able to be set at the same time and even more that console output would still appear on the LCD when I had asked for "console off". One disables the Console port "OPTION CONSOLE OFF", the other disables or enables MMBasic console text output to the LCD display "OPTION LCDPANEL CONSOLE / NOCONSOLE", both are valid in any state together. BTW Thanks for testing and confirming the "!" sequence to the console port. Edited 2020-05-10 09:30 by KeepIS NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
Phil23 Guru ![]() Joined: 27/03/2016 Location: AustraliaPosts: 1667 |
My late 2c worth. One secnario didn't seem to get a mention. Connecting a USB to TTL; CP2102 etc to the console port. Then !!!!!!!!!!!!!!!!!!!! Could be a variable situation though depending on whether the E100 is one with a Microbridge on it or not. As you mention adding the ICSP pins I assume it's the non Microbridge version. |
||||
Page 1 of 2 ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |