Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Totally Crashing MM2
Author | Message | ||||
Phil23 Guru Joined: 27/03/2016 Location: AustraliaPosts: 1664 |
Totally Crashed my project last night. 3 times in the space of about 30 minutes. Could only recover by reflashing the chip. (Didn't try resetting MMbasic). Very simple config at present, 20x4 LCD display, 2 temp inputs, driving 2 relays on a module. Connected by Wifi, which has been stable since adding caps to the 3.3V rail. It all began when I decided to add a few lines to record some Maximum & Minimum Temps. Figured I could save them so they weren't lost if I restarted the MM for whatever reason. [Code] Do Watchdog 20000 'Reset after 20 second if the program stops Pin(StatLed)=Not Pin(StatLed) 'Invert Status LED with each loop to show main loop is still running ' Get the Temperatures at timer interval DS18B20's on separate inputs if timer>5000 then Pin(StatLed)=1 'Hold Status LED on whilst reading temps TempRoof=Tempr(TsRoof) TempLng1=Tempr(TsLng1) Farenheit=DegCF(TempLng1) Timer=0 Endif 'Update Mamimum & Minimum Temps If TempRoof>TempRoofMax Then TempRoofMax=TempRoof If TempRoof<TempRoofMin Then TempRoofMin=TempRoof If TempLng1>TempLng1Max Then TempLng1Max=TempLng1 If TempLng1<TempLng1Min Then TempLng1Min=TempRoof Var Save TempRoofMax, TempRoofMin, TempLng1Max, TempLng1Min [/code] Is using Var Save in the main loop likely to cause this sort of crash? Thanks Phil |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3167 |
The easy test would be to comment out the VarSave line. It appears as if you are updating the saved variables every 5 sec. Are you sure that you want to do that? You will quickly wear out the flash. Geoff Geoff Graham - http://geoffg.net |
||||
Phil23 Guru Joined: 27/03/2016 Location: AustraliaPosts: 1664 |
Wasn't planning on implementing that bit long term, but it was a 5 to midnight decision to check the overnight temperatures. Ended in disaster. Most is available from my Weather Station |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9082 |
If it makes you feel any better, MOST decisions at 5 to midnight tend to end in disaster, if my track-record proves anything! Ignoring for the moment, the point about wearing out the flash as Geoff mentioned, I would not have thought that saving every 5 seconds would be a problem, but you would not want to do this in your code generally if you wanted the chip to last to Christmas or beyond. Smoke makes things work. When the smoke gets out, it stops! |
||||
WhiteWizzard Guru Joined: 05/04/2013 Location: United KingdomPosts: 2794 |
Out of interest, what is displayed when you type MEMORY at the command prompt? For everything Micromite visit micromite.org Direct Email: whitewizzard@micromite.o |
||||
Phil23 Guru Joined: 27/03/2016 Location: AustraliaPosts: 1664 |
Think it might have been caused by the ESP8266 dying. Despite numerous attempts to re-flash it this morning, all which showed it flashed successfully, all it does on power up is flash the blue LED. When I connect it to a CP2102 & connect with Teraterm I see mostly garbage coming from it, despite the baud rate chosen, although at times I did see the occasional readable string that looked like config commands. It was probably this trash data on the micros Rx pin that was crashing it. Suspect I was slowly killing it by power cycling it while the micro was still running and not having the 33k resistor in the Rx line the Geoff has mentioned in his article. There does not seem to be a lot of information or comment having a resistor in the Rx line if the module is being powered down, but Geoff's comment was that it would destroy it if powered down with the micro still sending data to its Rx pin. Cheers |
||||
Phil23 Guru Joined: 27/03/2016 Location: AustraliaPosts: 1664 |
Interesting observservation this morning. Been pinging the new ESP overnight. [Code] Reply from 192.168.59.181: bytes=32 time=1ms TTL=255 Ping statistics for 192.168.59.181: Packets: Sent = 35226, Received = 34861, Lost = 365 (1% loss), Approximate round trip times in milli-seconds: Minimum = 1ms, Maximum = 271ms, Average = 3ms Control-C[/code] Had done the same with the original which failed & kept a set of results. [Code] Reply from 192.168.59.181: bytes=32 time=1ms TTL=255 Ping statistics for 192.168.59.181: Packets: Sent = 57356, Received = 53341, Lost = 4015 (7% loss), Approximate round trip times in milli-seconds: Minimum = 3ms, Maximum = 899ms, Average = 12ms Control-C[/code] Didn't originally take a lot of notice of the Average round trip time, 12ms, just figured the device was probably a bit sluggish in processing power, but in hind sight it may have been a bit ordinary in terms of it's QC. Cheers. |
||||
Print this page |