Microcontroller Design Debugging (strange code behaviour)
Hi folks-
This isn't quite Parallax related, but since it's not a direct question about the micro I'm using I thought it's fair game.
I designed a microcontroller board with an ATMega, CAN chips, Vregs and an FTDI chip, about the size of a Stamp. When I assembled it, it worked for about 10 seconds ("USB device found" etc) then it disconnected and released magic smoke. Turns out I'd connected powerline caps backward which blew up and seem to have taken the FTDI with it for some reason.
AVRStudio was still able to correctly detect the ATMega and load code via the ICSP header. So seems like the micro is still alive, but it doesn't work right: We can set the state of any pin correctly, but that's about it. As soon as we put in loops or conditionals, it does weird stuff. For example:
If we have a loop with multiple pin toggles and a delay in it, the connected LED always immediately shows the last state in the loop ( if the last state was on) or is partially on ( if the last state was off).
If we have a conditional (we tried a parity check that lit either a red or greed LED) it would always immediately turn both on.
The reason I'm asking this question is, if we are able to correctly detect and program it, could the chip still be fried? Should I try rebuilding it or look for a design flaw?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
UC Berkeley '12 EECS
CalSol: UC Berkeley Solar Car
http://calsol.berkeley.edu
KJ6AWU
This isn't quite Parallax related, but since it's not a direct question about the micro I'm using I thought it's fair game.
I designed a microcontroller board with an ATMega, CAN chips, Vregs and an FTDI chip, about the size of a Stamp. When I assembled it, it worked for about 10 seconds ("USB device found" etc) then it disconnected and released magic smoke. Turns out I'd connected powerline caps backward which blew up and seem to have taken the FTDI with it for some reason.
AVRStudio was still able to correctly detect the ATMega and load code via the ICSP header. So seems like the micro is still alive, but it doesn't work right: We can set the state of any pin correctly, but that's about it. As soon as we put in loops or conditionals, it does weird stuff. For example:
If we have a loop with multiple pin toggles and a delay in it, the connected LED always immediately shows the last state in the loop ( if the last state was on) or is partially on ( if the last state was off).
If we have a conditional (we tried a parity check that lit either a red or greed LED) it would always immediately turn both on.
The reason I'm asking this question is, if we are able to correctly detect and program it, could the chip still be fried? Should I try rebuilding it or look for a design flaw?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
UC Berkeley '12 EECS
CalSol: UC Berkeley Solar Car
http://calsol.berkeley.edu
KJ6AWU
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
a) A partially fried chip
b) Another design flaw
c) A software problem
d) There is not enough information to tell
?
We can't quite figure it out either way...
Franklin-
Supposedly the thing is running at 20Mhz. All I have here is a Parallax USB scope, what would be the best way to verify the clock with that?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
UC Berkeley '12 EECS
CalSol: UC Berkeley Solar Car
http://calsol.berkeley.edu
KJ6AWU
Post Edited (FlyingFishFinger) : 4/5/2010 5:39:44 PM GMT
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
·
I checked the frequency; the Parallax scope tells me that if I use 128Khz internal oscillator it works fine, but it's too slow to verify my external crystal...
And apparently 128Khz is too slow to program it besides setting the fuses...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
UC Berkeley '12 EECS
CalSol: UC Berkeley Solar Car
http://calsol.berkeley.edu
KJ6AWU
My approach to boards that may have been damaged by spikes, surges, or failed regulators has always been to replace all the active components, or at least as many as practical. Better to replace $100.00 in chips than spend $1,000.00 for travel to come back later.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*