stuff to reset a rogue Arduino
SillyOldDuffer | 22/04/2016 16:05:52 |
10668 forum posts 2415 photos | Posted by John Fielding on 22/04/2016 12:52:20:
Hi Silly Old Duffer,
The 1N4148 is typically 4pF and the 1N4000 series is about 50pF, but these are much too small to cause a problem. It can only be one of two things. Either the asserted reset pulse is not going low enough, as Neill pointed out, or more likely to be the reset low duration is not long enough. Most uPs need a minimum duration of the reset pulse to provide a reliable rest pulse to be recognised. If they could be triggered by nano-second long pulses then they would be forever resetting, which would keep the uP out of running. I didn't notice a POR capacitor on the original schematic? Normally one is needed to hold the uP off until the supply rail has stabilised after initial switch on. It can either use an external or internal pull-up resistor and a smallish capacitor, preferably a tantalum for low leakage. On the Motorola GP32 processors the recommended reset circuit is via a 1N4148 to the open collector device which forces the reset pin low. Not sure what Atmel recommends for the AVR types. For these kind of add ons I prefer a simple monostable with a voltage comparator which gives a defined pulse duration. Something like a LM339 family works well and very low cost. I detest the 555 timer and all its problems! But YMMV?
Hi John. Agreed. The diode mangles the waveform slightly on the rising edge and it's very unlikely that's causing Steve's symptoms. There's no substantial difference between a 1N4148 and a 1N4001. Here's the 4001 pictures: Before Diode: After diode: POR. The Arduino family of boards all wrap the processor up with the components needed to manage Power on Reset and the other stuff needed to make the CPU user friendly. That's why Steve's circuit is so simple. Arduino boards include a loader in firmware. As a result an Arduino reset isn't quite a simple CPU hardware reset. The process also checks the serial line to see if the IDE has a new image to download and installs it if necessary. Only after doing that does the CPU re-start the users program. I know exactly what you mean about the 555: lots of us have a love-hate relationship with it! Steve will have to look at his code to confirm that the reset pulse coming out of his Arduino lasts long enough to reset the 555. As Neil points out the pulse has to be at least 12mS long. On the output side the 555 also generates a 12mS pulse and that would explain why the relay doesn't work - not enough electrons can pass in 12mS to work the coil. I can now confirm that the circuit reliably resets a Arduino Mega. As this afternoon's domestic task turned out to be much easier than expected so I might bunk off and write the code needed to generate a software heartbeat with it. I paid about £270 for my Siglent and prices have dropped since then. The advantage of the CML models is that they have more memory to capture extra waveform detail, but they all pretty good. If money is no object Siglent have just released a new "go-faster" range that''s even more impressive. Bit pricey though. Cheers, Dave
|
Neil Wyatt | 22/04/2016 18:01:04 |
![]() 19226 forum posts 749 photos 86 articles | Posted by John Fielding on 22/04/2016 12:52:20:
I didn't notice a POR capacitor on the original schematic? Normally one is needed to hold the uP off until the supply rail has stabilised after initial switch on. It can either use an external or internal pull-up resistor and a smallish capacitor, preferably a tantalum for low leakage. On the Motorola GP32 processors the recommended reset circuit is via a 1N4148 to the open collector device which forces the reset pin low. Not sure what Atmel recommends for the AVR types. I think it must be a long time since you looked at AVRs , John. The AVRs have programmable startup delays that you can choose to suit the oscillator type (from a bewildering array of types and speeds) and power supply rise times (up to 65ms). They also start up with all outputs hi-z which avoids the worries of things randomly switching themselves on at switch on. You can tell I like them Neil
|
Steve Addy | 22/04/2016 22:13:18 |
![]() 158 forum posts 107 photos 1 articles | Dave and everyone else who contributed I really have hit the jackpot with the responses I have only had chance to have a quick squint through all the posts tonight and am absolutely delighted with what you have all written. I have a Siglent SDS 1102CML to play with. Last time played with a 'scope was nearly 50 years ago. It is fair to say they have changed a little. Before I only had a multimeter and couldn't see what the circuit was doing at all until I bought the thing. That was how the 1M resistor got changed; I intended to buy an old analogue device, but decided that decent ones were too expensive to risk spending the money on if it was going to get killed in the post or pop next week I checked the 22uF capacitor with a Peak Atlas ESR70 - comes up 23.83uF and ESR of 1.60 Ohms. According to the table provided, that is a low ESR for a 25V capacitor. That leads me to think it is ok. Tomorrow I may get the chance to print the responses and sort them out. I'm not suspending respiration though. Today I have been helping a younger member of the Sheffield Club sort his Sweet Pea valve gear out. Last week I made him some new surface ground face valves. Today we have sharp valve events and it notches up in reverse. It is great to help people, I enjoy it a great deal personally - I really hate to be the duck egg that I am with this lark. Thanks again to all Steve
|
John Fielding | 23/04/2016 10:48:17 |
235 forum posts 15 photos | Hi Neill,
It is indeed a long time since we had anything to do with the Atmel range, after the scare with the glitches we detected. Changed to the Motorola GP32 and never looked back. The GP32 also goes high-z with the ports on boot, which can be used for some useful tasks! On the fuel injection system I used this to momentarily turn on the fuel pump for priming before the processor had run through its start up routine. Just made the POR duration about 1-second by selecting a larger capacitor and pull-up resistor combination and it worked out fine. |
SillyOldDuffer | 23/04/2016 11:39:03 |
10668 forum posts 2415 photos | Hi Steve, Now I'm jealous! You have the scope I wanted. And a ESR70. I wonder what other goodies? It took me a long time to realise that having a decent set of tools saves a lot of frustration and false leads. Making do with a multimeter and a slightly faulty set ot second hand test equipment held me back I'm sure. It's why I'm the sort of person who diagnoses electronic faults best when the broken bit is actually smoking. Last night I was able to write a simple sketch to prove that an Arduino really can reset the 555. The code was harder than I expected, but it does work. I had to use a 30mS LOW pulse to reliably discharge the capacitor. One thing I hadn't thought of is that the Arduino and 555 aren't synchronised. If the 555 has only just started to recharge the capacitor, a very short pulse from the Arduino will discharge it. On the other hand the same LOW pulse arriving when the capacitor is nearly fully charged won't fully discharge it, and the Arduino gets an unwanted reset shortly after. This screen-shot shows a successful heartbeat followed by a reset. I pulled the heartbeat lead on the Arduino immediately after the successful heartbeat tick and then watched the 555 reset the Arduino when it didn't get another heartbeat. The blue line is the reset line and the yellow line is the capacitor. I'm pretty sure that you were right early on when you suggested that something simple is wrong with the circuit, or perhaps with the code. It's odd that 47k works when 1M doesn't. On the code side I had to do a bit of a hack to stop the heartbeat back charging the capacitor. You can't let the heartbeat pin go HIGH after you've forced it LOW, which is what normally happens with digitalWrite(). Here's how I did it, there may be a better way! void heartbeat() I like helping people too. At the moment I've had much more help from the forum than I've returned. It's not only that my direct questions get good answers, it's the wealth of knowledge I've harvested from all the other threads. I'm pleased you found my comments useful and you sound exactly to be the kind of guy who helps solve my multitudinous mechanical issues. By the way I found this example of fun with an SDS1102CML on the web. I wish I knew how he did it! Cheers, Dave Edited By SillyOldDuffer on 23/04/2016 11:39:34 |
Please login to post a reply.
Want the latest issue of Model Engineer or Model Engineers' Workshop? Use our magazine locator links to find your nearest stockist!
Sign up to our newsletter and get a free digital issue.
You can unsubscribe at anytime. View our privacy policy at www.mortons.co.uk/privacy
You can contact us by phone, mail or email about the magazines including becoming a contributor, submitting reader's letters or making queries about articles. You can also get in touch about this website, advertising or other general issues.
Click THIS LINK for full contact details.
For subscription issues please see THIS LINK.