Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 11:17 01 Aug 2025 Privacy Policy
Jump to

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 : A Micromite feature request

Author Message
Seco
Newbie

Joined: 20/03/2019
Location: Australia
Posts: 5
Posted: 07:48am 20 Mar 2019
Copy link to clipboard 
Print this post

Hi All.

I would like to put forward a feature request for consideration.
When an embedded program crashes, and the watchdog timer restarts the program, it would be great if not only the mm.watchdog variable is set, but additional variable(s) that contain the line number, error number and error message associated with the crash are populated (if there is no crash and we just have a watchdog timer expiry then the variables could report this - as well as the line number executing at the time).
This would make it very easy to write errors to the SDCARD (or similar) to be reviewed at a later time and hopefully fixes implemented.

Regards
GerardEdited by Seco 2019-03-21
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3378
Posted: 02:18pm 20 Mar 2019
Copy link to clipboard 
Print this post

I haven't tried it, but I wonder if you could do some of what you want with flags and the "TRACE LIST nn" command (the problem being that I don't know how you can capture the output of TRACE LIST so that you could send it to the SDCARD rather than just to the console--or whether a watchdog reset also resets the TRACE LIST ring buffer). Some experimenting might be in order.

Access to the TRACE LIST ring buffer would be helpful in the situation you describe, perhaps in the form of an mm.traceArray() array variable.Edited by lizby 2019-03-22
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
Seco
Newbie

Joined: 20/03/2019
Location: Australia
Posts: 5
Posted: 06:56pm 20 Mar 2019
Copy link to clipboard 
Print this post

Hi.

Unfortunately a quick test program shows that the TRACE LIST "ring buffer" is reset when the watchdog reset occurs... And as you mentioned, how could you capture the output so it can be logged to a SDCard?

Regards

Gerard
 
Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 871
Posted: 10:40pm 20 Mar 2019
Copy link to clipboard 
Print this post

Hi Seco,
I'm interested in a solution here too as I've been chasing a problem with my remote weather station for months.

Without some sort of remote recording I can't see how a watchdoged MM can report the details of its own demise, eg to an SD, except by being connected to a console and reporting lots of data until it stops? - please correct me if I'm wrong.

Andrew

(My remote goes for weeks/days then (randomly?) just watchdogs continuously (Autorun is ON).
It is on my HC-12 network so in an effort to track the problem I have my base station recording (to an SD card and PC) all sorts of data but so far no clue as to what is causing it. When I bring it indoors to my console it behaves flawlessly . . .
AND no; it is no longer, ants, moisture, temperature, low voltage . . . ) A
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 11:04pm 20 Mar 2019
Copy link to clipboard 
Print this post

A perfect use for EERAM like the 47C16.
I love them.
https://www.thebackshed.com/forum/forum_posts.asp?TID=11033&KW=47c16
Using one in my weather station.

2k of unlimited writes with automatic backup.

Jim
VK7JH
MMedit
 
Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 871
Posted: 11:25pm 20 Mar 2019
Copy link to clipboard 
Print this post

Hi Jim,
Thanks for that - I'll read fully and I'm sure Ill need to ask for more help . . .

Cheers, Andrew

(I'm in the process of carting the remote inside for one more try)
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3292
Posted: 12:09am 21 Mar 2019
Copy link to clipboard 
Print this post

There is never one line that will cause the watchdog timer to time out. However, retaining the trace memory is a possibility and that would provide a clue as to what caused the timeout.

I will look into it.
Geoff Graham - http://geoffg.net
 
Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 871
Posted: 12:43am 21 Mar 2019
Copy link to clipboard 
Print this post

Thanks Geoff - you're a marvel. A
 
Seco
Newbie

Joined: 20/03/2019
Location: Australia
Posts: 5
Posted: 08:37am 21 Mar 2019
Copy link to clipboard 
Print this post

Hi All.

As there are effectively 2 reasons the watchdog reset can occur:
1) looping, waiting or paused code and the timer expires
2) the code crashes (syntax or run time error), the watchdog timer expires

For the first case, the trace memory would potentially be very useful.

For the second case, the ability to see the line number of the code that crashed (possibly from the trace memory), as well as the errno/errmsg of the crash (perhaps the mm.errno and mm.errmsg values could be copied to a pair of read only variables that are set by the watchdog reset routine) would be very useful.

I have some very large embedded programs (nearly consuming all available flash memory on the MM+) with multiple interrupt driven com ports and interrupt timers etc, and diagnosing an infrequent failure can be rather difficult as I cannot have a PC connected all the time...

Regards

GerardEdited by Seco 2019-03-23
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025