SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By lamlash
#137968
Hello everyone,

This is my first post and I'm a bit of a novice with microcontrollers so please be gentle!

To get me started I bought an Arduino Duemilanove with Atmega 328P and have created some successful sketches of my own and this is all OK. I eventually want to start making up some of my own PCB's for hardware designs which use an Atmega microcontroller so bought a sparkfun Clockit kit to build up my understanding (and it looked like a pretty neat kit)

Having assembled the sparkfun clockit kit (which uses a pre-programmed Atmega 328P) I accidentally burned out the Atmega IC by connecting it in reverse polarity (oops). I happened to have a spare new new (bootloaded) 328P so I used my Arduino to upload the Clockit sketch to this new IC. The sketch verified and uploaded fine but the clockit kit doesn't work : the piezo buzzer comes on constantly almost as soon as the power is applied but the 7 segment display remains off.

I have checked (buzzed out) all the PCB connections one by one and am 100% sure the board is correctly assembled. I also confirmed that the 7 segment display works properly. Finally I double checked that the new 328P works by uploading a known working sketch to it in the Arduino and checking some of the inputs and outputs operate as expected. Now I am a bit stumped as to why I can't make the clockit kit work. The only thing I can think of is that the fuse settings of the new (bootloaded) 328P differ from the settings of the IC that is shipped with sparkfun kit. The required fuse settings for the clockit kit are in the comments within the sketch (avrdude -p m168 -P lpt1 -c stk200 -U lfuse:w:0xE6:m) - are these different to the defaults or am I barking up the wrong tree?

If you've got this far, thank you for reading this rather long first post.
By Roychook
#138093
Hey I was actualy wondering the same thing and when you told me you saw the fuse bits in the code I think i know what you have to do. Im actualy just about to do this but I opened up the arduino application directory java/hardware/arduino and then opened up the file boards.txt after that just find the block that is called arduino pro 3.3v 8mhz and make a copy of it change the name and then the there are the three needed parameters that you just change to the fuse bits you said

HIGH 0xDA
LOW 0xE2
Extended 0xFF

its pretty straight forward I think or hope so :)
By lamlash
#138139
Thanks Roychook. I'll have a look at that but I thought the fuse bits could only be set with an AVR ISP programmer and not directly through Arduino.
By lamlash
#138267
OK, it was the fuses. Once I figured out how to set the fuses I uploaded the sketch again and it worked.

To set the fuses I fitted my "new" 328P microprocessor into a Breadboard and used my existing Arduino Duemilanove as a programmer. Here is a step by step for anyone else trying to do reprogramme an Atmega 328P in this way:

1. Connect Duemilanove to PC and upload the Arduino ISP sketch.
2. Set Tools > Programmer > Arduino as ISP
3. Build breadboard as per the instructions on http://arduino.cc/en/Tutorial/ArduinoISP (the version with 16MHz crystal)
4. Install AVRdude 5.11
5. Set 328P fuses as required for Clockit using avrdude -p m328p -c avrisp -P com3 -b19200 -U lfuse:w:0xE6:m (of course you will have to set the port that your Arduino is connected to which may not be com3 on your machine - check in Device Manager)
6. Load sketch into 328P using avrdude -p m328p -c avrisp -P com3 -b19200 -U flash:w:clockit-v11.hex (I first copied the clockit-v11.hex file into the avrdude folder)
7. Remove the 328P from the breadboard and stick it back in the clockit PCB (luckily I had used an IC socket)
8. Power on the Clockit and it works perfectly.
By kamiel
#142322
Hi All,

I have trouble compiling and uploading (modified or original) c-code to Sparkfun Clockit module. I tried simply by recompiling the original code fromhttp://dlnmh9ip6v2uc.cloudfront.net/datasheets/Kits/clockit-v11.zip
by running ‘make all’.
I subsequently uploaded the code using the TinyUSB programmer.
avrdude -p m328p -c usbtiny -P usb -b19200 -U flash:w:clockit-v11.hex
The above works OK with the original (downloaded) hexfile. If I compile the code myself and try to upload the new hexfile nothing but a loud beeping noise is the result. What am I doing wrong ?
Even reprogramming fuses makes no difference.
avrdude -p m328p -c usbtiny -P usb -b19200 -U lfuse:w:0xE6:m

any help is appreciated.
K