Uh Oh....

A "new fashioned" televisor, using an Arduino to drive the motor and display.

Moderators: Dave Moll, Andrew Davie, Steve Anderson

Uh Oh....

Postby Andrew Davie » Mon Jun 05, 2017 11:29 pm

So I started to do a bit of fixing on some of the file-selection menu code tonight - after not having "booted" the televisor for a couple of days. All was going OK, and then the computer stopped being able to see the Arduino. I pulled the Arduino from the circuit and tried the standard "blink" test program. Wouldn't upload. OK, grab a new Arduino, test blink - all OK. Put that in circuit of televisor and away I go... do a half hour or so of programming/testing on the menu, and then I get the same problem. Same symptoms - dead Arduino. Again I test and it fails. Try a third Arduino - another half-hour and it's dead. Uh oh....
Got yet another new Arduino (yes, I'm running out - down to 2 now) and tried blink - it work. I've ripped out the sound/speaker stuff because that was the last thing I did. But I can't put it in circuit - I need to solder the pins onto it, and will do that tomorrow at work with the nice soldering/microscope setup.
But still, I'm a bit worried now - I've killed three Arduinos in the space of an hour... what can it be :(
User avatar
Andrew Davie
"Gomez!", "Oh Morticia."
 
Posts: 1590
Joined: Wed Jan 24, 2007 4:42 pm
Location: Queensland, Australia

Re: Uh Oh....

Postby Andrew Davie » Mon Jun 05, 2017 11:33 pm

I wonder if I should have some sort of diode on the speaker PWM pin in case of some sort of weird current spike from the speaker. Wondering if that might be a possible cause of my recent bereavements....?
User avatar
Andrew Davie
"Gomez!", "Oh Morticia."
 
Posts: 1590
Joined: Wed Jan 24, 2007 4:42 pm
Location: Queensland, Australia

Re: Uh Oh....

Postby Andrew Davie » Tue Jun 06, 2017 12:48 am

... or could it be power usage? The PAM8302 amp is rated at 2.5W @ 4 ohms speaker, which at 5V would be 500mA and that's definitely pushing the Arduino 5V pin. Perhaps pulling too much power (the SD card and the LCD display are also powered via the 5V). However, the LCD was still working, so it's not that the Arduino is totally dead - it's just not talking to the USB port anymore. Hmmm. Maybe I fried something, though.
User avatar
Andrew Davie
"Gomez!", "Oh Morticia."
 
Posts: 1590
Joined: Wed Jan 24, 2007 4:42 pm
Location: Queensland, Australia

Re: Uh Oh....

Postby Steve Anderson » Tue Jun 06, 2017 4:27 pm

The current the audio amp draws should be much less than 500mA on music and speech at reasonable levels, not flat-out/really load. At idle, no sound, probably less than 50mA. I can't see how anything coming from the speaker could work it's way backwards through the amp, also it's a passive component and has no inbuilt source of energy. If you're still using the 'little filter' that should also protect the micro due to the series resistance.

Have you re-tried the suspect micros? Are they dead from first switch-on or does it still take 30 minutes or so to hang?

I would have a good look for intermittent shorts, stray cores of wires in stranded wire, just a close-up mechanical inspection. Check the USB port on PC is still OK and works continuously for over 30 minutes.

Other than that...I'm at a loss...

Steve A.
User avatar
Steve Anderson
"Fester! Don't do that to 'Thing'"
 
Posts: 5361
Joined: Fri Mar 30, 2007 10:54 pm
Location: Bangkok, Thailand

Re: Uh Oh....

Postby Andrew Davie » Tue Jun 06, 2017 4:32 pm

Steve Anderson wrote:The current the audio amp draws should be much less than 500mA on music and speech at reasonable levels, not flat-out/really load. At idle, no sound, probably less than 50mA. I can't see how anything coming from the speaker could work it's way backwards through the amp, also it's a passive component and has no inbuilt source of energy. If you're still using the 'little filter' that should also protect the micro due to the series resistance.

Have you re-tried the suspect micros? Are they dead from first switch-on or does it still take 30 minutes or so to hang?

I would have a good look for intermittent shorts, stray cores of wires in stranded wire, just a close-up mechanical inspection. Check the USB port on PC is still OK and works continuously for over 30 minutes.

Other than that...I'm at a loss...

Steve A.


All are dead from the switch-on - no comms with them at all. The laptop USB port is still OK, as it will communicate immediately with a new microcontroller. Not sure about the time component on the USB - I could leave things on for 30 mins or so without touching but that wouldn't tell me much - not that I can see. Loose wires a likelyhood given the loose fit of the proto board and various wiring. Thanks for advice on the sound/amp; that's comforting. As it happens I bought some nice new jumper wires and I might rewire the whole thing with the better quality wires. I also ordered another half a dozen microcontrollers last night - they will take a month or so to arrive, though. I have three working ones in-hand.
User avatar
Andrew Davie
"Gomez!", "Oh Morticia."
 
Posts: 1590
Joined: Wed Jan 24, 2007 4:42 pm
Location: Queensland, Australia

Re: Uh Oh....

Postby Steve Anderson » Tue Jun 06, 2017 6:13 pm

Check the power supply/supplies are producing the correct voltages and are not running hot, warm is OK. If they use 78xx type regulators they should shut down anyway if they get too hot. Make sure you haven't mixed up the 12V with the 5V (or whatever).

If these things have been working in the past for well over 30 minutes continuously then this has to be something silly.

Are the modules all from the same supplier or from more than one? Could simply be a duff batch if a single supplier. They only get tested for a matter of seconds in the factory, if at all,

Steve A.
User avatar
Steve Anderson
"Fester! Don't do that to 'Thing'"
 
Posts: 5361
Joined: Fri Mar 30, 2007 10:54 pm
Location: Bangkok, Thailand

Re: Uh Oh....

Postby Andrew Davie » Tue Jun 06, 2017 6:20 pm

Steve Anderson wrote:Check the power supply/supplies are producing the correct voltages and are not running hot, warm is OK. If they use 78xx type regulators they should shut down anyway if they get too hot. Make sure you haven't mixed up the 12V with the 5V (or whatever).

If these things have been working in the past for well over 30 minutes continuously then this has to be something silly.

Are the modules all from the same supplier or from more than one? Could simply be a duff batch if a single supplier. They only get tested for a matter of seconds in the factory, if at all,

Steve A.


Different suppliers. Cheapest I could find, but the last two were from same supplier.
I've soldered pins onto the remaining 3 I have - all "el cheapo" brand, and will redo all the rats-nest of wires to ensure better connections, and then report on the results.
User avatar
Andrew Davie
"Gomez!", "Oh Morticia."
 
Posts: 1590
Joined: Wed Jan 24, 2007 4:42 pm
Location: Queensland, Australia

Re: Uh Oh....

Postby Andrew Davie » Tue Jun 06, 2017 9:52 pm

Update: curiouser and curiouser!

So I soldered the legs onto my three remaining Arduinos today - I had about 5 dead ones.
Got home, first thing I did was rip out the wires one at a time from the breadboard, replacing with the new sturdier jumper wires I had. One by one. And I put tape where I could and generally made it all very neat. Then I tried uploading "blink" - the minimal Arduino app which just flashes an onboard LED to one of the new Arduinos. That went fine, which led me to believe the computer USB and cable were OK. I plugged it into the breadboard and tried uploading my televisor program - didn't work; USB comms failure. Mmh. Pulled the Arduino off the breadboard and tried blink upload. That worked fine. So I tried the televisor upload with the Arduino NOT plugged into the breadboard. That went fine. OK, plugged it into the breadboard and tried an upload. Failed. Unplugged from breadboard tried the upload again. Failed. Tried blink. Failed. Uh oh. ANOTHER dead Arduino? I grabbed a different USB cable and tried. Nothing. Put the Arduino in the junk pile and dig out my second-last good one. Test blink. OK. Test the televisor. OK. Test the televisor upload again. Fail. What????? This one had no association at all with any of the circuitry - just a software upload via USB. OK, I had vague memories about reading that the Arduino can lockup, as it uses a software serial port. There's an on-board reset button you hold down, and then start an upload, and THEN release the reset button. That gives the Arduino bootloader a couple of seconds to check the USB before running the on-board software. So I do that, and - hey - I can upload blink.... so board is OK. Upload televisor... OK. Upload televisor again. Fail. Hold reset and upload televisor. OK. Right, so according to that, there's something in MY software that kills the software USB onboard, and to get the board to talk you have to hold reset while starting an upload. Inconvenient, but better than a dead Arduino.
So hey, let's test my pile (literally!) of dead Arduinos. Of the 5 or so dead ones, all but one of them "came back to life" - so now I have about 6 "good" chips, although I am pretty sure I fried one of the pins on my first one so it will not work for that (comparator) pin. Well that's the good news. No longer "frying" Arduinos - in fact it was some weird software issue.
The bad news is that upload when plugged into the breadboard fails. I've screwed up something with the wiring. That's OK, I might as well rip it all off and start afresh, doing bit by bit. I have sufficient pictures and circuit diagrams, I think, to make this a relatively painless process.
User avatar
Andrew Davie
"Gomez!", "Oh Morticia."
 
Posts: 1590
Joined: Wed Jan 24, 2007 4:42 pm
Location: Queensland, Australia

Re: Uh Oh....

Postby Klaas Robers » Tue Jun 06, 2017 10:52 pm

I don't know the Arduino, but I know the 80C51 micro rather well. Might work in the same way.

You can upload code just after reset. Then for a few seconds (3?) the serial input port is checked for data. After that the flashed program is executed. If your upload program waits too long, more than those 3 seconds, No uploaded code will be received. And yes, indeed, those simple things are not always communicated too good.

With the serial port a reset can be, and is given from the uploading computer. I doubt if that is too possible for a USB port, unless some extra hardware does this for you.......
User avatar
Klaas Robers
"Gomez!", "Oh Morticia."
 
Posts: 1656
Joined: Wed Jan 24, 2007 8:42 pm
Location: Valkenswaard, the Netherlands

Re: Uh Oh....

Postby Steve Anderson » Tue Jun 06, 2017 10:54 pm

I did say it would probably be a 'silly'. We all get caught by them!

Steve A.
User avatar
Steve Anderson
"Fester! Don't do that to 'Thing'"
 
Posts: 5361
Joined: Fri Mar 30, 2007 10:54 pm
Location: Bangkok, Thailand

Re: Uh Oh....

Postby Andrew Davie » Tue Jun 06, 2017 11:54 pm

Klaas Robers wrote:I don't know the Arduino, but I know the 80C51 micro rather well. Might work in the same way.

You can upload code just after reset. Then for a few seconds (3?) the serial input port is checked for data. After that the flashed program is executed. If your upload program waits too long, more than those 3 seconds, No uploaded code will be received. And yes, indeed, those simple things are not always communicated too good.

With the serial port a reset can be, and is given from the uploading computer. I doubt if that is too possible for a USB port, unless some extra hardware does this for you.......


The normal process for Arduino is just to click the upload button on the IDE. And it uploads and runs. You never need to touch the chip. Something in my software has broken this process, so now I need to manually press and hold the reset button on the chip, then click upload, then release the button. The Arduino is designed to allow uploads without the reset button being pressed, and it's been working OK for me for months now. But as I said, something's gone wrong and now that I think about it I was playing with serial comms (to the Nextion LCD) in my software.
User avatar
Andrew Davie
"Gomez!", "Oh Morticia."
 
Posts: 1590
Joined: Wed Jan 24, 2007 4:42 pm
Location: Queensland, Australia

Re: Uh Oh....

Postby Andrew Davie » Wed Jun 07, 2017 12:37 am

Here's a possible explanation... Uploading Code to the Leonardo, Leonardo ETH and Micro - it says "the auto-reset is initiated when the computer opens the serial port at 1200 baud and then closes it; this won't work if something interferes with the board's USB communication - e.g. disabling interrupts." I do have one or two places where I disable interrupts for a very short time, so there might be an issue there.
User avatar
Andrew Davie
"Gomez!", "Oh Morticia."
 
Posts: 1590
Joined: Wed Jan 24, 2007 4:42 pm
Location: Queensland, Australia

Re: Uh Oh....

Postby Klaas Robers » Wed Jun 07, 2017 12:40 am

And is the LCD using a different serial port than the USB for uploading your code? May be you need to insert a waiting time of a few seconds in your program at the beginning, before the communication with the LCD is initialised. But may bee I don't understand the Arduino.....
Last edited by Klaas Robers on Wed Jun 07, 2017 12:45 am, edited 1 time in total.
User avatar
Klaas Robers
"Gomez!", "Oh Morticia."
 
Posts: 1656
Joined: Wed Jan 24, 2007 8:42 pm
Location: Valkenswaard, the Netherlands

Re: Uh Oh....

Postby Andrew Davie » Wed Jun 07, 2017 12:43 am

Klaas Robers wrote:And is the LCD using a different serial port than the USB for uploading your code? May be you need to insert a waiting time of e few seconds in your program at the beginning, before the communication with the LCD is initialised.


Yes it is, but you're remarkably close to correct, because I recall REMOVING such a wait thinking it was not necessary.
Good sleuthing! I will put the delay back in and see how we go :)

Edit - I *think* it is different, but actually thinking about it, I really don't know.
User avatar
Andrew Davie
"Gomez!", "Oh Morticia."
 
Posts: 1590
Joined: Wed Jan 24, 2007 4:42 pm
Location: Queensland, Australia

Re: Uh Oh....

Postby Andrew Davie » Wed Jun 07, 2017 1:07 am

OK. some testing done.
I am testing with only the Arduino and USB comms to it - no televisor circuitry. No LCD (Nextion) connected. Just the microprocessor all by itself.
When I upload my televisor code for the first time, all OK, however I do see "garbage" on the serial that the Nextion is looking at. That means that something's sending data (and it has to be the USB comms). I tested an upload - failed, same behaviour as before. A reset-button-held-upload worked fine.
So I removed all the Nextion (LCD) code. Now it's not doing anything with the serial port - just leaving it alone. Now a upload works again. So there's an interaction happening with the code - and it was the nextion code that I was playing with last night (trying to find the source of bogus data on the serial port which I assumed was a bug in the Nextion library/code). I think, maybe, that bogus data was actually the final part of the upload/reset from the Arduino, kicking in a few seconds after the upload, and after my program had started running.
THere are a couple of conclusions - firstly, this won't matter in the final code, because there won't BE any USB communications; the Arduino/televisor will be totally stand-alone. I shouldn't have to worry about bogus data and catering for it.
Secondly, it's possible to shift the Nextion to non-hardware serial communications using other Arduino pins. Maybe I should consider trying that out.
Thirdly, well I leave things as they are I just have to press reset every download. A bit of a pain, but it's not REALLY broken right now; it's just an "incompatibility" because I have two different things trying to use the same serial pins at the same time.
Interesting problem, though .. I'm glad you found it, Klaas!
User avatar
Andrew Davie
"Gomez!", "Oh Morticia."
 
Posts: 1590
Joined: Wed Jan 24, 2007 4:42 pm
Location: Queensland, Australia

Next

Return to Andrew Davie's Arduino Televisor

Who is online

Users browsing this forum: No registered users and 1 guest