Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 22:39 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 : Soft RESET for the MM?

Author Message
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9308
Posted: 02:44pm 19 Jun 2013
Copy link to clipboard 
Print this post

Hi all.


I was looking at possibly resetting the MM in the code.
I can't see any command for that in the manual.

Perhaps it can be done by poking a memory location?

Other then that, I can use an I/O pin, pulled high with an external 10k or so, connected back to ~MCLR and pulse it low in the code to force a reset, but is there any way to do that in code with a simple command?

Does not matter if not - I will just use the I/O pin method.

I plan to have a "RESET" push button on the system, but I am not willing to put this directly on ~MCLR, as if the SD card is writing especially, resetting during a card write is not a good thing.

So, I was going to have the "RESET" button connected to a normal I/O line and setup an interrupt for that line, so that if it is ever pressed, it will loop to a short bit of code which just closes any open files, then performs a soft-reset to restart the system.

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

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 04:37pm 19 Jun 2013
Copy link to clipboard 
Print this post

Often a user reset button is connected to a non maskable interrupt to do the reset under software control.
A tiny button hidden behind a small hole is the one that is connected to the reset line. Having both is good otherwise people just recycle power.
You would need a small battery or a (super)cap to provide enough power and an input line to detect the power loss to safe important info when that happens.





Microblocks. Build with logic.
 
Juri74

Senior Member

Joined: 06/02/2012
Location: Italy
Posts: 162
Posted: 11:42pm 19 Jun 2013
Copy link to clipboard 
Print this post

Hello grogster,
for a fast software reset try POKE 1,1,1
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9308
Posted: 11:54pm 19 Jun 2013
Copy link to clipboard 
Print this post

Poke 1,1,1 crashes the system, it does not reboot it...
Smoke makes things work. When the smoke gets out, it stops!
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 12:37am 20 Jun 2013
Copy link to clipboard 
Print this post

If you setup an interrupt on an i/o port then you could use this:
[code]
handleInterrupt:
'close files here if necessary
CLS
Print 'Restarting.....'
RUN "YOURPROGRAM.BAS"
IRETURN
[/code]
This will reboot the BASIC program.
Edited by TZAdvantage 2013-06-21
Microblocks. Build with logic.
 
Juri74

Senior Member

Joined: 06/02/2012
Location: Italy
Posts: 162
Posted: 05:34am 21 Jun 2013
Copy link to clipboard 
Print this post

i think i found a bug... surely pokeing here and there in memory will end in a crash, ofcourse!
poke 1,1,1 is a proof of it.. but shouldn't be safe peeking memory? even theese critical memory locations?

try

PRINT PEEK(1,1)

Juri
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3194
Posted: 12:27pm 21 Jun 2013
Copy link to clipboard 
Print this post

No, that is referring to an illegal address and the hardware in the PIC32 catches it and forces an exception (this is out of the control of MMBasic).

Theoretically it is possible for MMBasic to validate the address before it attempts to use it but there are so many valid/invalid addresses in the PIC32's memory map that it would be too complex and error prone.

Geoff
Geoff Graham - http://geoffg.net
 
Dylan
Regular Member

Joined: 17/06/2013
Location: Netherlands
Posts: 81
Posted: 01:25pm 21 Jun 2013
Copy link to clipboard 
Print this post

I think I tried PEEK(1, 1) too - unless I was trying to peek 1fc/bfc the other month. Slow learner.
 
Print this page


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

© JAQ Software 2024