Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 15:41 11 May 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 : MicroMite resetting

     Page 1 of 2    
Author Message
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 982
Posted: 12:15am 27 Jun 2014
Copy link to clipboard 
Print this post

I have been chasing my tail trying to work out why the MicroMite resets when launching from an interrupt. One pin monitors a line and when it goes low the software is set to read an analog input on another pin. When the interrupt calls the subroutine the program stops and displays the bootup text. Has anyone got any clues where else I could look? I have changed Vcap, put a small cap across the monitored pin and the analog input pin, tried pulling up and down on both pins, tried a larger cap across the 3v3 rail. Today I built a clean new PCB just in case I had hardware issues but the new board shows the same results.

Running out of ideas............
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9488
Posted: 12:22am 27 Jun 2014
Copy link to clipboard 
Print this post

Very interesting.

So, you have one pin as an interrupt - when it goes low, this fires the interrupt, which as part of that interrupt, calls a sub to read the analog voltage on another pin - correct?

You have IRETURN at the end of your interrupt code?

Can you not call the sub from the interrupt pin?(set the interrupt to call the sub, rather then loop to it, if that is what your interrupt code is doing)

Could you please post your code?

EDIT: If you ARE calling a sub as part of the interrupt, then you need an END SUB at the end of the interrupt, rather then an IRETURN - that could be your issue....

If we could have a quick gawk at your code....Edited by Grogster 2014-06-28
Smoke makes things work. When the smoke gets out, it stops!
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2927
Posted: 01:03am 27 Jun 2014
Copy link to clipboard 
Print this post

Will await you to post code but for now are you sure you have set the relevant pins correctly to inputs? If a pin is still an output and you are 'inputting' a voltage then you have a potential 'short'. This would then reset your MicroMite (3v3 line blip) and hence display the start-up message.

I'm sure you have set things correctly but is worth a check!!

WW
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9488
Posted: 01:51am 27 Jun 2014
Copy link to clipboard 
Print this post

Excellent point, WW.
Smoke makes things work. When the smoke gets out, it stops!
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 982
Posted: 02:31am 27 Jun 2014
Copy link to clipboard 
Print this post

Thanks Grogster & WW I am not in the shed at the moment so I will post some code shortly.
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 982
Posted: 09:05pm 27 Jun 2014
Copy link to clipboard 
Print this post

I have looked at posting some of the code but I have had to remove the comments as the program is over 600 lines long and I was running out of memory. Posting code without remarks would not be easy to follow. BTW I tried calling the particular sub within a loop and not by interrupt but the result is still the same. Would it be possible to discuss or list reasons for the micromite to reset.
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 982
Posted: 09:14pm 27 Jun 2014
Copy link to clipboard 
Print this post

  WhiteWizzard said   Will await you to post code but for now are you sure you have set the relevant pins correctly to inputs? If a pin is still an output and you are 'inputting' a voltage then you have a potential 'short'. This would then reset your MicroMite (3v3 line blip) and hence display the start-up message.

I'm sure you have set things correctly but is worth a check!!

WW


Thanks WW I have a 1K resistor linking the micromite to the incoming 0v signal and the pin(15) is set as DIN
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6220
Posted: 09:16pm 27 Jun 2014
Copy link to clipboard 
Print this post

Can you at least post the sub.

The usual culprit is a POKE but I doubt that this is the problem here.
There could be a maths error that is not getting caught.

Jim
VK7JH
MMedit
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6220
Posted: 09:46pm 27 Jun 2014
Copy link to clipboard 
Print this post

Are you using WATCHDOG anywhere in your program?

How many Subs and Functions are there?
Too many Subs and Functions has been known to cause a reboot.

Jim
VK7JH
MMedit
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 982
Posted: 10:05pm 27 Jun 2014
Copy link to clipboard 
Print this post

Interestingly the reboot always happens within this sub:
(I have inserted some comments to make it a little bit easier to follow)

Sub VFARRAY ' SAMPLE THE INCOMING VF ANF FILL ARRAY WITH SAMPLES
Do While Pin(15)=0 'CD IS LOW

Print PIX

VFSMPL=Pin(25) 'READ VOLTAGE SAMPLE ON PIC PIN 25

KCTWORD(PIX)=VFSMPL 'LOAD SAMPLE INTO ARRAY

PIX=PIX+1 'ARRAY COUNT INCREMENTS


If PIX >999 Then
MSG$="ERROR SAMPLES OVER 1000"
EVENTLOG
Exit Do
EndIf
'Pixel(PIX/2,350-VSMPL*100)=1 'DRAW ON SCREEN OF MAXIMITE
Loop


Thinking that the issue may be memory limitations I got this screen at a reboot but it is not constant as the amount of samples can vary between 0 and 600 before the crash.

got here 3
Flash:
15K (73% of 20K) Program (594 lines)
18b ( 1% of 1536b) 1 Saved Variables

RAM:
6K (28%) 19 Variables
1K ( 3%) General
15K (69%) Free
got here 4
Micromite MMBasic Ver 4.5
Copyright 2011-2014 Geoff Graham

>
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2927
Posted: 12:53am 28 Jun 2014
Copy link to clipboard 
Print this post

Out of interest, if you add a PAUSE 100 in your loop then do you still have the issue?

You may not want a delay, but this is a process of elimination to see if it is a 'timing' issue on the analogue sample.

You confirm above that pin(15) is set by DIN, but please confirm how you are setting pin 25 too!

WW

 
ajkw
Senior Member

Joined: 29/06/2011
Location: Australia
Posts: 290
Posted: 12:54am 28 Jun 2014
Copy link to clipboard 
Print this post

Graeme,

I am not sure if it will but does this arrangement make any difference?

Rgds.
Anthony.

'''''''''''''''''''''''''''''''
Sub VFARRAY ' SAMPLE THE INCOMING VF ANF FILL ARRAY WITH SAMPLES

Do While Pin(15)=0 and Pix < 999 'CD IS LOW

Print PIX
VFSMPL=Pin(25) 'READ VOLTAGE SAMPLE ON PIC PIN 25
KCTWORD(PIX)=VFSMPL 'LOAD SAMPLE INTO ARRAY
PIX=PIX+1 'ARRAY COUNT INCREMENTS
'Pixel(PIX/2,350-VSMPL*100)=1 'DRAW ON SCREEN OF MAXIMITE

Loop

If PIX = 1000 Then
MSG$="ERROR SAMPLES OVER 1000"
EVENTLOG
EndIf

EndSub

 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2927
Posted: 01:01am 28 Jun 2014
Copy link to clipboard 
Print this post

. . . and in your Sub VFARRAY, do you have an End Sub? (It maybe in your code, but it is not in your post and may be causing the issue!)

 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6220
Posted: 01:39am 28 Jun 2014
Copy link to clipboard 
Print this post

There is function EVENTLOG.
I assume that it is writing data somewhere.
Try remming it out to eliminate it as the cause.

Jim
VK7JH
MMedit
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 982
Posted: 01:46am 28 Jun 2014
Copy link to clipboard 
Print this post

  WhiteWizzard said   . . . and in your Sub VFARRAY, do you have an End Sub? (It maybe in your code, but it is not in your post and may be causing the issue!)



Definitely an End sub



Print "NUMBER OF SAMPLES (PIX)";PIX;" 1ST & 10TH SAMPLE";KCTWORD(1);KCTWORD(10)
'PACKETSAMPLES=PACKETSAMPLES+PIX
PIX=0
End Sub
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 982
Posted: 01:48am 28 Jun 2014
Copy link to clipboard 
Print this post

  TassyJim said   There is function EVENTLOG.
I assume that it is writing data somewhere.
Try remming it out to eliminate it as the cause.

Jim


Have tried wit this error trapping remmed out
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2927
Posted: 01:58am 28 Jun 2014
Copy link to clipboard 
Print this post

Can you confirm Pin(25) setup.

Also have you tried a delay in your loop (something short like PAUSE 100?
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3269
Posted: 05:44am 28 Jun 2014
Copy link to clipboard 
Print this post

This problem could easily be caused by the interpreter stumbling over some sort of error in the BASIC program for which it was not expecting and thereby causing the CPU to throw an exception (which would cause a reboot).

The trick here is to reduce the offending program to a few lines which will reliably demonstrate the issue - that is the hard part.

Geoff
Geoff Graham - http://geoffg.net
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6220
Posted: 11:59am 28 Jun 2014
Copy link to clipboard 
Print this post

Still thinking....
How frequently do you call the sub and can you be certain that it has finished before the next call?

So far, I haven't been able to recreate the error.


Jim
VK7JH
MMedit
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 982
Posted: 01:06pm 28 Jun 2014
Copy link to clipboard 
Print this post

  Geoffg said   This problem could easily be caused by the interpreter stumbling over some sort of error in the BASIC program for which it was not expecting and thereby causing the CPU to throw an exception (which would cause a reboot).

The trick here is to reduce the offending program to a few lines which will reliably demonstrate the issue - that is the hard part.

Geoff


Geoff, I originally had the sampling done by pin (18) FIN but although the code seemed faultless I found that I could not get a reasonable resolution by frequency sampling. I decided to move to pin (25) AIN and do an amplitude sample and this is when I started to get problems with the code.

Would it be possible that the Basic will reset because I am now using a 3V3 tolerant input and there may be a spike that is exceeding the 3V3 level?
 
     Page 1 of 2    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025