Recovering from bricked?

Help with any software/desktop related issues. e.g. companion9x, eePe, etc
User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Recovering from bricked?

Post by ShowMaster »

It's been covered many times but in searching for it or reading the er9x wiki I can't find it?
I'm reading up on it to help a friend if it requires it.
Links and step by step info will be a big help.
Sorry if it's easy to locate.

User avatar
cre8tiveleo
Posts: 1434
Joined: Tue Dec 27, 2011 6:13 pm
Country: -
Location: Ontario,(GTA North)
Contact:

Re: Recovering from bricked?

Post by cre8tiveleo »

From a bricked ersky board, it's easy.
or are you talking stock board?


ersky board...


To re-program the chip, you will need to short out the ERASE jumper . and power up the board
by plugging in the USB connection...you now can remove the jumper. The board is returned to its factory default values.
Because you have erased all of the chip , you need to tell the chip what to do at power up. There is a selection BOX labeled "Scripts" , select the "Boot from Flash (GPMVN1)" and click "Execute" . The chip will now run the program loaded in flash memory at power up.

After you are done programming , terminate the SAM - BA program. Then you can disconnect the Board.
The SAM-BA program only works the ONE time , You must EXIT it , and re-insert the USB , THEN run the SAM -BA program.
User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: Recovering from bricked?

Post by ShowMaster »

Good info to know.
The board is a stock 9x board. The er9x wiki had a link but for me there was nothing there I could find.
In reading about this over the lady year but never having this issue, I remember something about injecting a certain CPU pin with an oscillator at some frequency.
If it turns out to be a bricked CPU I want to be ready.
I've recovered a few boards from being dead but never bricked so I want to be prepaired if it comes to trying it.
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Recovering from bricked?

Post by rperkins »

ShowMaster wrote:something about injecting a certain CPU pin with an oscillator at some frequency.
the datasheet for the atmega64L has a lot of information about serial and parallel programming of the microcontroller.
http://www.atmel.com/Images/doc2490.pdf


on page 292 it says
2. The default setting of CKSEL3..0 results in internal RC Oscillator @ 1 MHz. See Table 6 on
page 38 for details.
However that doesnt jive with what is in this document, which may be the one you are looking for.
http://er9x.googlecode.com/svn/trunk/do ... 0Brick.pdf
calla969 was referring to the above doc in this thread - i think -
viewtopic.php?f=44&t=1291&start=30#p18376

So they both say 1mhz, but the atmel doc says it is an internal osc while the fuse_brick doc says you need to supply an external one. I dont know.

Then again the atmel doc mentions parallel programming for when you really mess it up :)

I havent experienced any of this. Just mentioning what I read.
User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: Recovering from bricked?

Post by ShowMaster »

Thanks for the link it's a good start.


ShowMaster
Sent from my iPod touch using Tapatalk

User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: Recovering from bricked?

Post by ShowMaster »

Now I need a simple 1 mhz osc circuit.
User avatar
MikeB
9x Developer
Posts: 18010
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Recovering from bricked?

Post by MikeB »

It doesn't need to be that fast, as long as your programmer can go slow enough (quarter of the oscillator frequency or slower). A simple 555 timer at 50 to 100 kHz would do.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: Recovering from bricked?

Post by ShowMaster »

MikeB wrote:It doesn't need to be that fast, as long as your programmer can go slow enough (quarter of the oscillator frequency or slower). A simple 555 timer at 50 to 100 kHz would do.

Mike.
good to know Mike thanks.
A 555 was my first thought but the 1 MHz made me doubt using it. It can do 100kc from what I read so I'll try. If I can push it higher than 100 KC what's the next value to shoot for or does it matter?
I'll run the 555 on 5-12v unless it oscillates OK at 5v. What level will the CPU take to not damage it and do I AC or DC couple it?
Just gathering info to be on the safe side.
I thought RCG had a circuit posted over a year ago but do far I can't find it.


ShowMaster
Sent from my iPod touch using Tapatalk
User avatar
MikeB
9x Developer
Posts: 18010
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Recovering from bricked?

Post by MikeB »

DC 5 volt will do fine. You really don't need to go for high speed as long as your programmer will go slow enough. You should only need the oscillator while you program the fuses. Once you have changed them to use an external crystal, you will be back to 16 Mhz and programming as normal.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: Recovering from bricked?

Post by ShowMaster »

Ok on lower speed.
I'll read up on how to reset the fuses. Eepe or C9x?
This is something I've been wanting to try but didn't want to brick my 9x to try it.
Helping someone out may require it.
Now I have a good reason to try it and hopefully if it's needed learn and fix at the same time.
Thanks for the tips Mike.



ShowMaster
Sent from my iPod touch using Tapatalk
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Recovering from bricked?

Post by rperkins »

Was still confused on the need for the external oscillator. Then I read that it is necessary if the device was accidentally programmed to use an external oscillator incompatible with what was already in use. Ahh.

So if I got this right:
If the fuses are accidentally reset to default, an external oscillator is not needed. However, if they are accidentally misprogrammed to the wrong external oscillator , then one is needed ?

BTW, I found this post which talks about using another atmel controller to generate the clock. So you could use a working 9x to reprogram the bad one :)
http://www.avrfreaks.net/index.php?name ... c&t=106325

Another thing is if the fuses were reset to default, then the programmer needs to have its speed set to 250khz or less, in order to keep under the 1/4 clock ratio.
User avatar
gohsthb
Posts: 1412
Joined: Wed Dec 28, 2011 2:32 pm
Country: -
Location: Naperville, IL

Re: Recovering from bricked?

Post by gohsthb »

Default oscillator is the internal 1MHz. So, correct, the programmer would need to be 250kHz or less. If it had been programmed to use an external oscillator that is incompatible with the external crystal, then what happens is the oscillator doesn't start and so code cannot execute. By injecting a clock signal (any frequency, and not higher than Vcc(5V) of the radio, will work) you get the processor to start executing instructions again. Like was said above you simply need to fix the fuse bits and you will be on your way again. Eepe, and I'm sure C9x both have options to change the fuses. Neither will care what the fuses had been set to, they will simply overwrite what is there with the correct values.
-Gohst
User avatar
Kilrah
Posts: 11109
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Recovering from bricked?

Post by Kilrah »

And if your fuse screwup cleared the SPIEN fuse - well, no other choice than parallel programming, and as you likely couldn't do it in situ on the radio PCB and would have to unsolder the AVR, you might jsut as well replace it, easier.
User avatar
gohsthb
Posts: 1412
Joined: Wed Dec 28, 2011 2:32 pm
Country: -
Location: Naperville, IL

Re: Recovering from bricked?

Post by gohsthb »

From the data sheet (pg297):
The SPIEN Fuse is not accessible in SPI Serial Programming mode.
You cannot reset that fuse, no need to worry about it.
-Gohst
calla969
Posts: 94
Joined: Wed Jun 06, 2012 11:56 pm
Country: -
Location: East Central Florida

Re: Recovering from bricked?

Post by calla969 »

Wow. I'm glad you guys understand all of this stuff.
User avatar
Kilrah
Posts: 11109
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Recovering from bricked?

Post by Kilrah »

gohsthb wrote:From the data sheet (pg297):
The SPIEN Fuse is not accessible in SPI Serial Programming mode.
You cannot reset that fuse, no need to worry about it.
-Gohst
Oh cool, they've done a good job adding that protection then, and it shows how outdated I am...
Last time I did low level AVR stuff was about 8 years ago - and SPIEN / RSTDISBL bricks were a very common topic on the devices I was using back then.
User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: Recovering from bricked?

Post by ShowMaster »

Because I wanted to cheat and use 555 calculator to calculate the values for a 100KC oscillator I found this one
http://totusterra.com/555timercalc.html
I'm assuming that if I plug in 100KC and go with the values I should be good to go.
Any value suggestions I should plug in?

A few questions to be up to speed.
Do I worry about duty cycle? I'm assuming not.
Again to be positive, I'll be using a 5v supply so that's not too high to drive the ATMel64?
I'll look at the data sheets but want to very cautious so I'm asking.



ShowMaster
Sent from my iPod touch using Tapatalk
User avatar
MikeB
9x Developer
Posts: 18010
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Recovering from bricked?

Post by MikeB »

5 volt drive is fine, check whether the 555 is push/pull or open collector output, you may need a pull up resistor on the output.
If possible, I would go for as close to 50-50 duty cycle.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: Recovering from bricked?

Post by ShowMaster »

Ok Mike, 50/50 it is and I'll add some pullup value just in case.
I'm heading to the lab.
User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: Recovering from bricked?

Post by ShowMaster »

Now I could some more help hopefully recovering from a fuse issue for a friend. I’m using a known good USBasp HK programmer. All the connections are verified. Eepe 0r C9x can’t talk to the ATMega64. Per info supplied the 9x was working, another brand programmer was tried. It did talk to the CPU but gave bad error messages. After a few attempts the programmer stopped talking totally and the 9X was DOA. I’ve tried his programmer on a test 9X I use and it will not power the test 9X or program it. My working programmer will power and program the test 9x.
So there are two issues, one his programmer may be defective or failed and cause his (x to hopefully set wrong fusesI’ve connected a DigiKey ECS-2100 series 1 MHZ oscillator to +5, ground and clock out to pin 24 of the CPU and verified it’s there.
Eepe, C9X,AVRdude still can’t talk to or reset any fuses on the ATM 64.
I’m sort of out of ideas other than the ATM64 may be bad?
I’m ready for new things to look for or try. The 9x board is in great shape and I don’t think it’s been abused in any way.
I cant post a screen capture but will.
Eepe and C9X gives me an error message
Target doesn't answer Arerdude.exe:instalation failed, RC=1
I'm only powering the board with the hk usb but it should be the same as the radio being turned off. I do measure 5 vots at the board connection point and the 1 MHZ osc is working and feeding pin 24.
Ideas please.
SM
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Recovering from bricked?

Post by rperkins »

Not sure if a short on one of these would cause an issur but Maybe unplug all switches, joysticks, even the lcd and see if it comes up. Maybe look for solder shorts from when the programmer was initially installed.
User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: Recovering from bricked?

Post by ShowMaster »

rperkins wrote:Not sure if a short on one of these would cause an issur but Maybe unplug all switches, joysticks, even the lcd and see if it comes up. Maybe look for solder shorts from when the programmer was initially installed.
Very good advice, thank you for trying.
The board is not installed and only has the programmer and the 1 MHZ osc connected to it right now. Not much to stop the CPU from working programmer wise now.
It may be the CPU is bad? If so anyone in the USA have an extra one at a low price I can get from them? I'm doing the labor for free so he'll have to absorb that cost. Ordering a new one gets expensive because of shipping and tax for just one.
I still can't believe the cpu has failed from the history of what happened so I'm still keeping the faith and need some more ideas.
Thank you all for any.
Maybe I'm not using Averdude, eepe right to set the fuses?
User avatar
MikeB
9x Developer
Posts: 18010
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Recovering from bricked?

Post by MikeB »

Just a check, have you lowered the SCK clock speed used for programming? I think it is the -B option to AveDude. The programming clock MUST be less than a quarter of the target processor clock, and I would try for a tenth to be safe. I must look into AvrDude, I don't use it much as I have a STK500 dev kit and use AVRstudio for programming.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
Romolo
9x Developer
Posts: 1109
Joined: Sat Dec 31, 2011 12:11 am
Country: -
Location: Massa (MS), Tuscany, Italy

Re: Recovering from bricked?

Post by Romolo »

Here is my experience:
I just replaced a broken atmega64 on a stock board; trying to program fuses with basic avrdude settings does not obviously work,
so I have set -B 1000 (1 MHz clock period), wrote the fuses, and programmed again after having removed the -B1000 advanced setting.
With a fresh from factory ATMEGA64 that comes with a 1MHz internal oscillator it worked.
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Recovering from bricked?

Post by rperkins »

But in the OP case, since he is using a 1 mhz clock, he would want the -B parameter set at 250 or less. right ?

The -B 1000 would work fine for an ATMEGA64 inside a 9x using the default external crystal, but not in the case of the OP of this thread.
Romolo
9x Developer
Posts: 1109
Joined: Sat Dec 31, 2011 12:11 am
Country: -
Location: Massa (MS), Tuscany, Italy

Re: Recovering from bricked?

Post by Romolo »

looking to avrdude man page -B specify a period in uSec... the highest the frequency the lowest the value... with 1Mhz it should be higher than with 16Mhz
That's why I had to increase it to be able to write fuses with the internal osc.
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Recovering from bricked?

Post by rperkins »

Thanks. Once again I was wrong. I was confusing the -b (baud rate) option with the -B (bitclock) option you were speaking of.
User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: Recovering from bricked?

Post by ShowMaster »

Ok, now I'm no longer feeling dumb on using AVRdude and unbricking , but instead I now feel "stupid"!
You've given me new hope but I need more please.
I'm using the Digikey 1 MHz Osc and a working HK Usbasp and the boards disconnected from the 9x to be clear.
Is it possible for someone in the know to please write the steps needed to make Avedude work for me? Being a CMD line program I'm confused. Could someone please write the commands in a txt file I can enter exactly to slow the SCK down and send the correct fuse reset commands? Is it possible to make a script or macro type file that will make it automatic with my setup?
This is exciting to learn but wow it's like my first rc flights so many years ago, I'm crashing.
If I master this I hope to help others that recover their bad flashes.
Sorry to be so challenged but I'm trying to learn to not be.
Thank you



ShowMaster
Sent from my iPod touch using Tapatalk
calla969
Posts: 94
Joined: Wed Jun 06, 2012 11:56 pm
Country: -
Location: East Central Florida

Re: Recovering from bricked?

Post by calla969 »

In the avrdude configuration screen (the little gear icon) put -B 100 or whatever value you need in the extra arguments line. I think.

Sent from my DROID BIONIC using Tapatalk 2
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Recovering from bricked?

Post by jhsa »

I don't know anything about this programming thing but is it not possible to insert these extra arguments in eepe? eepe it is already a kind of GUI.. and it works with avrdude...
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

Post Reply

Return to “Software”