Saturday, October 16, 2010

Bricked chip

Last night I received an email from Steve G0XAR to let me know that a replacement chip for the QRSS beacon had been programmed but not posted yet as he had been ill with a bad cold. However my impatience had got the better of me and I started wondering whether I could reprogram the chip myself. Perhaps this was the opportunity I needed to start playing with microcontrollers? The source code was on Hans G0UPL's website, the development tools were all free. All I would need is a programmer, and I was sure I had seen circuits for microcontroller programmers knocked up from junk box parts on the web.

A bit of searching revealed that simple programmers for the AVR ATtiny13 chip can easily be made, such as this one built by Alan, VK2ZAY, but they require a parallel port, an antique piece of hardware that went out of use around the time Bill Gates made his first billion and is now as obsolete as the USB port will one day surely be.

However I also came across an article that described how to program AVR microcontrollers using a Microchip PICkit2 programmer. A couple of years ago I obtained a PICkit2 because it was being offered in an electronics magazine for just the cost of the postage. Apart from running a couple of demo programs I had never done anything with it. What more of an excuse did I need?

In less than an hour I had downloaded and installed the AVR Studio software, WinAVR which was also needed, PK2AVRISP (the program which makes the PICkit2 look like an AVRISP or STK500 programmer), soldered six short leads to a 6-way header to attach to the PICkit2 and wired up the connections to the chip on my solderless breadboard. I already had a pair of virtual serial ports set up on the shack PC to use with the TrueTTY packet TNC so I was good to go.

PK2AVRISP detected my PICkit2 and I assigned it to one of the pair of virtual serial ports. The QRSS keyer program compiled in a couple of seconds and I was ready to program the chip. I selected the AVRISP programmer on the other end of the virtual serial port pair. The programmer read the signature from the chip and reported it was correct - an encouraging sign. Then I wrote the hex code into the flash memory. The write appeared to work but the verification failed with "WARNING: FLASH byte address 0×0006 is 0xFF (should be 0xCF)."

I searched forums for solutions to this error and tried various suggestions such as reducing the SPI clock speed or trying the STK500 option but I could not get past this error. One person claimed that he had somehow managed to program the chip despite the error so I put it back in the QRSS keyer, but now I just got a steady carrier with no keying at all. Oh dear!

I tried programming the code again this time using the avrdude command line programming software which is included with WinAVR but can't be run directly from AVR Studio. This appeared to work, no error was displayed when the code was verified, but the chip still did not work when put back in the keyer.

To avoid moving the chip back and forth to test it after each programming attempt I tried programming a simple LED flasher into it so I could test it on the breadboard (hence the LEDs in the photo.) This works fine if I simply ignore the flash verification error. So the chip isn't bricked. But why the keyer program doesn't work is a mystery. I assume it should flash the LED on pin 3 in time with the keying, but it doesn't.

Obviously a new chip will get the QRSS keyer working again but having spent all this time on trying to do it myself I would like to know why I couldn't. Usually when something doesn't work it is because I have made a stupid error, but I can't see what I have done wrong. It's so frustrating.

6 comments:

Steve GW7AAV said...

Reminds me of the horrible sinking feeling I got when I bricked a Bios chip on a PC, which I was updating so as to enable USB support (Days of Windows95). Fortunately someone I knew had an EPROM blower and was able to wipe and reprogram it.

Paul Stam PAØK said...

Hello Julian, this stuff is beyond my comprehension, so I can't help you. But I can understand your frustration. Good luck, 73 Paul

PE4BAS, Bas said...

Hello Julian, well did have something similair. I built the USB stick soundcard with VOX like you made. But till now it only heats up the USB stick. I probabely did something wrong. But I just stopped to take a deep breath. Will look at it next week...I guess you just need to have a little patience or try it over and over again till you manage to program the chip yourself. 73, Bas

Unknown said...

Hi Bas. Well the only thing that could heat up the USB stick is taking too much current from the 5V rail. Though I would expect the computer to limit the current and display an error. So I would remove the connection from the +5V and it shouldn't heat up, then check the current. It should only draw a few mA, enough to illuminate the transmit LED.

Theodore said...

Some people do crosswords, some people do electronics.
The only difference is the smoke.

73s

Anonymous said...

I see from the Knights QRSS mailing list that PA0TAB just spotted you, so you must have received your correctly programmed chip. Congratulations,

Dave
AA7EE.