AVR Mega8 Conundrum

Had to build a production test jig that (amongst other things) in circuit programs am AVR Mega8 MCU. Now the first thing you need to send these things to sit up and obey orders is $AC 53 xx yy (programming enable) and you should get $zz AC 53 xx pinged back - except I don't. I get $xx FE 53 xx. However, the instruction has worked - I can subsequently ident the chip and program it and it works fine. Only the ping is wrong.If i send the prog enab command twice, i get the correct ping second time around. I don't think its a timing issue (peppering the code with delays doesn't make any difference), nor does sending other strings prior to prog enab (though then the chip studiously ignores me, as would be expected) Any idea what might be happening here. cheers M

Reply to
Mike Diack
Loading thread data ...

Hi Mike, It would not be the first time an Atmel device needs a 'repeat until OK', rather than a send/check once :) Since it all seems to be otherwise working, just code it so it can re-try maybe a dozen times before deciding the device really is out to lunch. Even then, a proceed-anyway message can be usefull. We have also seen Atmel devices shift/loose their device ID's, but otherwise be OK. This is rare, but possible, as the IDs are in 'hidden flash'.

-jg

Reply to
Jim Granville

You only need to get the 0x53 back, so what you're getting the first time is valid (at least per the Mega128 version of the SPI instructions)...

"When in sync, the second byte ($53) will echo back when issuing the third byte..."

Reply to
Richard

In the old days when the AVR was new, devices such as the AT90S1200 and AT90S8535 had a bug, and you had to poll the sync 33 times to be sure you got the correct response. I have not seen this problem for years now, the new mega devices, (new in the history I have with AVR's) work a lot better. Ah! whatever happened to the mega603 :)

Bryan

--
Bryan Whitehouse - Software Engineer
Embedded Results Ltd.
http://www.kanda.com
Reply to
BryanW

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.