14m2 Restart Issue

Anobium

Senior Member
I am looking for advice and some help.

I have a circuit and program that is restarting a 14M2 randomly. I asked for advice last week - I added the capacitor on the power connectors as recommended.

I have simplified the circuit to remove all but the essential components, see attachment. The 14m2 is mounted in an AXE091 with the additional capacitor across the power rails.


View attachment 9429

I have simplified the program but this program is in operation and the Picaxe exhibits the issue.

Code:
' bits  7654321076543210 
pullup %0000111100111110
' conn  ---X------------
symbol ledport = b.1
symbol soundport = b.2
symbol commsport = c.0


' wait for LCD and flash LED
symbol currentcount = w0
for b0 = 0 to 10
	toggle ledport
	pause 50
next
	
' output a message to show restart
serout commsport,N4800, ("v0.7",13,10)

' set up i2cslave for LCD	
i2cslave $C6,i2cslow,i2cbyte

main:
	if pinc.3 = 1 then
		high ledport
	else
		low ledport
	end if
	
	
	writei2c 0,(254,128,255) ' move to start of first line
	pause 30 ' wait for LCD to process data	
	
	BINTOASCII currentcount, b10,b11,b12, b13, b14
	writei2c 0,("CU FT :5", b10,b11,b12, ".", b13 ,b14 , 255)
	pause 30

goto main
If I close the switch (attached to pinc.3) at high speed the Picaxe will restart - it is not far from consistent and I therefore I cannot find the root cause of the restart issue. I have a simple switch - a direct connection between the 5v and the pin.

Serial in and out are connector via the AXE091 (10k and 22k), the LCD works correctly (it is outputing the ASCII values) and the power supply is a bench 5v power supply.

Any thoughts?
 

Attachments

Last edited:

Technical

Technical Support
Staff member
Your schematic shows C.4 but program C.3 and no power to the LCD ... we are guessing here.
And what is the point of the internal pullups - if using C.3 as in the program you have an internal pullup on that?
 
Last edited:

Mike_cj0

Member
Probably a daft question but what is the purpose of the 10k (r8) resistor connecting the switched 5v to the ground leg on the picaxe?
 

Goeytex

Senior Member
The provided diagram is incomplete. However, since the Picaxe is in an AXE 091 then I suppose
we can assume that serrin is not floating.
 

Anobium

Senior Member
@technical.

I have corrected the diagram. I am on the best using the software (yet, but I am learning all the time). The switch is connected to pinc.3.
Power is connected (5v and 0v), this is implied as per the AXE033 requirements.

I used the internal pullsup to try and get stability - should I remove? I have corrected the PULLUP on pinc.3 - the device just reset 4 times as I am wrting the email. I simple flash the switch and the device reset.

Revised code - with corrected pullups

Code:
' bits  7654321076543210 
pullup %0001011100111110
' conn  ----X-----------
symbol ledport = b.1
symbol soundport = b.2
symbol commsport = c.0


' wait for LCD and flash LED
symbol currentcount = w0
for b0 = 0 to 10
                toggle ledport
                pause 50
next
                
' output a message to show restart
serout commsport,N4800, ("v0.7",13,10)

' set up i2cslave for LCD 
i2cslave $C6,i2cslow,i2cbyte

main:
                if pinc.3 = 1 then
                                high ledport
                else
                                low ledport
                end if
                
                
                writei2c 0,(254,128,255) ' move to start of first line
                pause 30 ' wait for LCD to process data   
                
                BINTOASCII currentcount, b10,b11,b12, b13, b14
                writei2c 0,("CU FT :5", b10,b11,b12, ".", b13 ,b14 , 255)
                pause 30

goto main
 

hippy

Technical Support
Staff member
The PULLUP command can be removed. I would suggest removing it, commenting out the I2CSLAVE and the WRITEI2C commands and disconnecting the LCD, then checking if that causes any reset.
 

Anobium

Senior Member
results... quick results. I could leave on test longer but a restart did occur.

Remove pullups and the three I2c commands - ok
Re-instated - I2CSLAVE - ok
Re-1st WRITEI2C - ok
Re-2nd WRITEI2C - restarts occuring.
Removed 2nd WRITEI2C - ok.

Is this a timing issue? What is the recommended pause value?
 

hippy

Technical Support
Staff member
It would also be recommended to remove the physical pull ups - "Note that the 4k7 resistors pull up resistors are pre-soldered onto the AXE033 LCD module. Therefore additional external resistors are not required".

As to the PAUSE values, off-hand I don't know, but you could simply extend them to a value which is definitely likely to work ( PAUSE 500 ) and see how that behaves. If that doesn't work then it's not likely a timing issue so that can be crossed off the list.
 

Anobium

Senior Member
I will remove the pull ups. I could not remember if they were fitted. I could see either, even though I tried ! :)

I will extend the pauses and test.

Get back soon...
 

Anobium

Senior Member
I increased the pause(s) to 1023 but still restarts. I used the POT and ADC to set the pause... Values from 30 to 1023 tested no difference. Restarts.

Then, I changed the input pin to c.4 - problem has gone. No restarts. (I wonder why I never thought of this before!).

I need all the pins of this device in my solution, so simply moving the assigned pin from c.3 to c.4 resolves this issue but is not workable in the design.

Why does c.3 case the reset? Who is the expert on the ports? :)
Can I add an external component to improve the input handling?
 

Technical

Technical Support
Staff member
Internally this pin is very different to the others - hence the reason it is 'input only'.
The main internal difference is there is no diode from the pin to V+, which shouldn't make any difference at all to a simple switch setup. But you can try it, pointy end to V+
You could also try a small cap (10-100nf) between pin and ground.
 

Anobium

Senior Member
I was trying the diode, I tested and it has resolved the issue.
At the moment I have a very simple switch connected, so this puzzled me also but I do not know to much about the internals of the chip.

I had already tried the cap before and this did not resolve the issue.

So, the diode seems is a route I can test further. I used a 1N4001 - is this a good choice?
 

eclectic

Moderator
From post #16 I used a 1N4001 - is this a good choice?

Manual 2, p.206 recommends a IN4148,
but I'm sure that yours will be OK.
(I'm sure an expert will correct me if I'm wrong :)

e
 

Technical

Technical Support
Staff member
Any diode will do, schottky e.g BAT85 first choice, 1N4148 second, 1N4001 third.
But what it does imply in your cicrcit is that the 5V signal (coming into that pin via the switch) is not that smooth, and spiking above the 5V supply. Are you using the on-board voltage regulator or applying 5V direct?

You could also try inverting the hardware/logic in program (e.g. a 10k pull up with the switch going to ground instead).
 

Anobium

Senior Member
Stable on the current test of 24 hours. I have a diode BAT85 and a 100u cap.

@ Technical. re posting #18
The current 5v supply is the regulated supply from the AXE091. I have now have no other power source. I have the wall wart power via an online UPS - I have checked with my scope and the 5v is very smooth.
Re Inverting. I tried inverting the logic prior to posting this did not resolve the issue.

So, the diode and cap may fix the issue but what is the root cause?
Stay away from using c.3 as an input? Surely not.
 

Anobium

Senior Member
Be aware that your scope might not see or display the fast moving spikes on the power rails that can case a micro to 'crash'.
Good point.

I am trying to source any potential spike but I am currently using the AXE091 power supply. And, this issue only happens on pinC3.

I am so puzzled.
 

mrburnette

Senior Member
On the 14M2, both C.3 and C.4 are TTL pins (http://www.picaxe.com/BASIC-Commands/Digital-InputOutput/inputtype/). As you can "fix" the issue with a Shockley diode, the next most logical step would generally be to try another 14M2 which you may not have. In my lab, I have the entire workbench covered with a professional antistatic mat. When working recently with a 20X2 @64MHz, I had reboot issues which my PC scope did not "see" but when I bought out the old Tek 422, I saw ringing on one of the input pins whenever I manipulated the switch and a significant amount of ripple, not from the 5V 78L05 regulator (fed by 9V alkaline) but just AC introduced from my body absorbing all of the spurious electromagnetic radiation in the lab... likely the worst offender are old fluorescent lightning.

There may be a possibility that the internal diode on the TTL pin within the 14M2 is damaged and a chip-swap would prove this. The external diode clamp proves (in my mind) that some induced voltage is the problem, but such designs should utilize an external diode anyway. One could worry themselves insane if an answer is sought for every weird hardware occurrence... my voice of experience.

- Ray
 

Anobium

Senior Member
@Ray... Spooky - I know today is Halloween but,

I work in the basement of an Victorian house, the room is decked out nicely. However, all the lighting is fluorescent lightning. All the fluorescent units came from a skip in 1978 when Tesco rebuilt a petrol station near Cambridge (actually, Bar Hill village and I did not steal them... I asked!), the same tubes from 1978 AND... I first noticed the reset issue when I turned the lights off / on as I left/entered the basement! Spooky that you were able to figure that out! Halloween!!!!!

On a more serious note. I did try my old scope last week but as the restarts were initially very hard to reproduce I looked elsewhere for the root cause.

Actions. Try another 14m2 then move on to complete the project.

Thank you.
 
Top