Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 06:23 27 Nov 2024 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 : How Stable/Reliable is MMBasic

     Page 1 of 2    
Author Message
memberx
Newbie

Joined: 20/04/2012
Location: Australia
Posts: 24
Posted: 01:08pm 09 Feb 2013
Copy link to clipboard 
Print this post

I am looking at using MMBasic in a controlling and remote embedded designs that will need to operate reliably in a continuous operation.

One concern with MMBasic is Error handling and lack of watchdog reset timer implementation which are absolutely essential for most embedded control applications. I don't know if Pic32 internal watchdog timer can be manipulated using Poke and Peek in a startup MMBasic program? Alternatively, external watchdog timer could be implemented using cheap and simple Pic10 controller but that means additional hardware.

I would appreciate comments from existing users of similar applications, particularly regarding long term stability/reliability.

Cheers
John

 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9307
Posted: 03:43pm 09 Feb 2013
Copy link to clipboard 
Print this post

  memberx said  One concern with MMBasic is Error handling and lack of watchdog reset timer implementation which are absolutely essential for most embedded control applications.


I woulden't say that. Correct code that has been properly debugged and tested before installation, SHOULD give minimal problems.

This is certainly not true if the system was rushed into service, or not given suitable bench-testing to see if any errors crop up.

New Zealanders here will know all about that with the desasterous Novopay system that our Government pushed into service, even knowing that there were fundamental problems with the system - now it is a technical nightmare for all involved, and there are some very red faces - but I don't think the GOvernment gives a damn, as most Governments just spend, spend, spend, and let someone else fix the problems.

...but I digress...

I have used lots of PICAXE chips in industrial situations, and they have no such watchdog features, and I have not had any issues with them. Nothing due to code, anyway. Once stable and debugged and bench-tested, I have chips out there running 24/7 for more then 3 years now, and not one single glitch.

Personally, I think that watchdogs are a bit over-rated, IMHO...

EDIT: If you wanted to test MMBASIC, why not grab one of those CMM demos that you can get from Geoff's website, crank it up, and leave it running for several days non-stop. Check in on it from time to time, and see if it has stopped running.

As far as I know, MMBASIC is about as stable as any other BASIC at this point - Geoff puts in a HUGE amount of his time, perfecting the code and fixing any bugs that are found.Edited by Grogster 2013-02-11
Smoke makes things work. When the smoke gets out, it stops!
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1101
Posted: 05:03pm 09 Feb 2013
Copy link to clipboard 
Print this post

Hi John,

I am fully in agreement with Grogster here - I have had my Caravan Battery Monitor program running continuously for almost a month now inside the front boot of my van. No heat issues whatsoever and no programming issues.

MMB already has file i/o ON ERROR capability where you might want to trap read or write fails etc. but as for error trapping an internal programming error I can,t see where you would want to catch this and continue operation?

Certainly you might want to know about out of range or unexpected events but surely these should be catered for in good programming techniques?

The only place I can see that general error trapping might be usefull is in program development and testing but good coding can minimise the problem.

Just my thoughts as others have raised the idea for discussion before and it is good to discuss different folks take on the issue,

Cheers, Doug.

... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9307
Posted: 06:55pm 09 Feb 2013
Copy link to clipboard 
Print this post

I thought that the whole watchdog thing, was designed to catch and auto-reboot the system, if it crashes. Provided the code is debugged and the system is stable anyway, you should not NEED a watchdog thing, IMO.

Kinda like a PIC32 version of Microsuck's "Automatically restart" on BSOD in Windoze.

I don't know how you would make it work anyway.
If the PIC32 HAD crashed for some reason, then the system has crashed, and the watchdog feature would also fall over - unless it runs in the background and is part of the PIC32 die? Perhaps it is...


Smoke makes things work. When the smoke gets out, it stops!
 
memberx
Newbie

Joined: 20/04/2012
Location: Australia
Posts: 24
Posted: 07:11pm 09 Feb 2013
Copy link to clipboard 
Print this post

Thanks Guys,

To clarify some points.

I am not looking for Error trapping and WDT (Watch Dog Timer)as part of development and de-bugging process.


My application is for multiple embedded controllers that will operate continuously. In case of lock up or freeze an automatic Reset should be performed and AUTORUN program re initialized. There are no issues with loss of RAM contents during Reset process in this application.

Reality is that embedded micro controllers may lock up at some point in time for various reasons apart from buggy software, and it may not be practical to reset them manually. That is the reason why micro controllers intended for more critical applications have built in WDT .

This is why it would be valuable to have some feedback from existing users that have been using PIc32 and MMBasic continuously in similar application for a long period of time. Has anyone experienced any issues with MMBasic itself during long continuous operation?





Edited by memberx 2013-02-11
 
greybeard
Senior Member

Joined: 04/01/2010
Location: Australia
Posts: 161
Posted: 07:34pm 09 Feb 2013
Copy link to clipboard 
Print this post

If it's mission critical then use a wdt. If the system doesn't have one easily usable, add an external cct to provide the functionality. There's plenty of ccts out there for a simple wdt.
If you've got multiple embedded controllers, interconnect them so they can monitor and reset ( if required ) each other.
 
memberx
Newbie

Joined: 20/04/2012
Location: Australia
Posts: 24
Posted: 07:45pm 09 Feb 2013
Copy link to clipboard 
Print this post

  greybeard said   If it's mission critical then use a wdt. If the system doesn't have one easily usable, add an external cct to provide the functionality. There's plenty of ccts out there for a simple wdt.
If you've got multiple embedded controllers, interconnect them so they can monitor and reset ( if required ) each other.


Since PIC32 already has built in WDT. I would like to know if it is possible to use MMBasic PEEK/POKE to set up and periodically reset existing WDT, without building additional hardware?

 
BobD

Guru

Joined: 07/12/2011
Location: Australia
Posts: 935
Posted: 08:00pm 09 Feb 2013
Copy link to clipboard 
Print this post

The PIC32 internal WDT is described in the PIC32 Family Reference Section 9. Watchdog Timer and Power-up Timer. I just had a quick read and it is all about loading registers. If the registers are memory mapped then peeking and poking may be possible unless the addresses are protected. Why don't you get the reference I described and read it yourself. I can't upload it here as it is copyright material. It's only about 200K and 30 pages.
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 09:11pm 09 Feb 2013
Copy link to clipboard 
Print this post

A watchdog is not meant for resetting buggy code although it will do that.
It will be good to use a watchdog if the environment is dirty and with that i mean interference. An enclosure, shielding and a good power supply should keep that out but in practice it is impossible to filter everything.
Use some pic's in a car and you will see things lock up without a trackable reason.
Brownouts can be detected and reliable resets can be done by supervisory chips. They are small and cheap.
Maybe the internal watchdog is already used by MMBasic itself, if not it would be a great addition.

Microblocks. Build with logic.
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9307
Posted: 09:14pm 09 Feb 2013
Copy link to clipboard 
Print this post

@ TZA - Interesting point.
Smoke makes things work. When the smoke gets out, it stops!
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1101
Posted: 10:45pm 09 Feb 2013
Copy link to clipboard 
Print this post

Hi guys,

Without labouring the point, my experience is that the MM hardware is solid as a rock. Also, Geof's MMBasic is operationally solid. Yes, occaisional bugs may surface which Geof is absolutely great at addressing quickly. However, keep in mind that these are invariably interpretation issues and in no way indicative of any "instability" in MMBasic.

Again, my experience of over 45 years of hardware and software is that instability in actual chips (be they old 74xx, early op amps,micros etc) is rare - it is invariably poor grounding, noisy or cruddy power or with micros, less then ideal coding. It is always a challenge (for me) to make the hardware and software of my projects as stable as the actual chips. From everthing I read, the PICs are solid- from experience, Geof's interpreter is solid(and if there is a bug, it's easily identified and worked around, until Geof comes up with a fix).

So, without getting boring(which I may be, sorry), I think an MMwith solid clean code and a decent clean supply should be solid as a rock! It certainly is for me.

Cheers, Doug.

... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9307
Posted: 10:54pm 09 Feb 2013
Copy link to clipboard 
Print this post

Well said, sir!

And you make very valid points.

So, you would remember the old 741 op-amp then?
Smoke makes things work. When the smoke gets out, it stops!
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 11:29pm 09 Feb 2013
Copy link to clipboard 
Print this post

They don't include watchdogs in mcu's for nothing.
Even the small pic's have one on board.
With automated stuff that is often embedded and out of easy reach a watchdog is your last defense.
Maybe it resets once a year, but that would solve an immediate problem at that moment.
Maybe a bug in the software only happens under very rare circumstances, not one piece of software ever written is bug free!
Maybe it happens at 0:00 on a Saturday night.
It is good that in those cases you are 'covered' by an automated reset.
I have stuff that is used in vehicles. Often they are hidden under the dashboard or some other place.
Completely out of reach. Watchdog kicks in on some vehicles every day a few times, on another vehicle never. The alternator in the car is the worst enemy and you can have a power supply that filters good and when looked on a scope, not a ripple to be seen. Until it is in the field with moisture, temperature and pressure changes, vibrations, corrosion, etc.
The watchdogs keeps these things (in my case GPS/GPRS trackers) running for years and years. I think the oldest is about 8 years now.

In Maximites case is it a necessity?
Not when it sits on your desk, once you put it in an enclosure, sell it or use it as a solution for some automation, you really need the backup of a watchdog. Edited by TZAdvantage 2013-02-11
Microblocks. Build with logic.
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1101
Posted: 11:42pm 09 Feb 2013
Copy link to clipboard 
Print this post

Hey grogster, yea, 741 was great - a bit fussy on power noise, lots of variation in offset from manufacturer to manufacturer and could get unstable at higher frequencies but for all that, let hackers like me do analogue stuff quickly and easily that would have been nigh impossible with discreet components( or certainly beyond my capabilities )

Sorry to get a bit off topic.
Cheers, Doug.
... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9307
Posted: 12:07am 10 Feb 2013
Copy link to clipboard 
Print this post

  TZAdvantage said   They don't include watchdogs in mcu's for nothing.
Even the small pic's have one on board.


With PICAXE, I have NEVER heard them mention that the chips have watchdog ability.
Just how global is this across PIC's?

  TZAdvantage said  ...not one piece of software ever written is bug free!


I agree - but we all do the best we can at the time, and for the most part, I have managed to survive just fine in the PIC world WITHOUT any form of watchdog.

Just my 2c...

  TZAdvantage said  The alternator in the car is the worst enemy and you can have a power supply that filters good and when looked on a scope, not a ripple to be seen. Until it is in the field with moisture, temperature and pressure changes, vibrations, corrosion, etc. The watchdogs keeps these things (in my case GPS/GPRS trackers) running for years and years. I think the oldest is about 8 years now.


Well, that much IS true - PIC's really don't like car's alternator supply - they tend to be very noisy indeed, but you can then put LC power input filters in line with the +v to filter most of the crud off. For every situation, there is a solution.

Smoke makes things work. When the smoke gets out, it stops!
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 12:44am 10 Feb 2013
Copy link to clipboard 
Print this post

http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=e n019863

It has 6 pins cost about 50 cent
0.375Kb flash
16 bytes! of ram
one 8 bit timer
and
.
.
.
.
a watchdog timer.

And believe me, if PIC chips did not have a watchdog timer they would not sell a single chip to manufacturers of products. The circuit is so simple it is included on all of them. (I am not 100% sure there is always an exception but every single one i ever used and looked at has it.)
Edited by TZAdvantage 2013-02-11
Microblocks. Build with logic.
 
djuqa

Guru

Joined: 23/11/2011
Location: Australia
Posts: 447
Posted: 12:47am 10 Feb 2013
Copy link to clipboard 
Print this post

PIC10F200 Clickable link
VK4MU MicroController Units

 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9307
Posted: 11:14am 10 Feb 2013
Copy link to clipboard 
Print this post

OK - interesting....
Smoke makes things work. When the smoke gets out, it stops!
 
isochronic
Guru

Joined: 21/01/2012
Location: Australia
Posts: 689
Posted: 02:50pm 10 Feb 2013
Copy link to clipboard 
Print this post

Most commercial jobs are likely to specify a
default to safe operation if there is a problem.
And it is simple to periodically reset the watchdog
timer if the software is running properly. Using one
also makes the job spec address the issues of
safe operation in unforeseen situations.

<edit> In fact unless there is some definition of what is
correct operation, and the software is testing
for that as it runs, you don't know it is running
correctly. A slow memory leak can take a long time
to appear.
Edited by chronic 2013-02-12
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3802
Posted: 10:26pm 10 Feb 2013
Copy link to clipboard 
Print this post

I've used WDTs for years - whenever it seemed it MIGHT matter. Started with a uC that did not have one so external circuitry was added (not by me).

Can't be too tough to add it in to MMBasic, just ask Geoff for the source if it can't be done in the BAS.

Hardly ever being reset by a WDT = yes but when it saves you it's great!!

John
 
     Page 1 of 2    
Print this page
© JAQ Software 2024