NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » Upgrade to Atmega328p
January 18, 2010 by ton_mit |
I got the nerdkit and the led array about a month ago. I breezed through the initial build and all the projects. The led array was a bit tricky but, with the help of the forum I figured it out. I recently upgraded to the ATmega328p chip. After following the nano guide to a to a T, I was able to flash the chip with no error codes.........but, now the led array doesn't work. It stays blank. I thought mabey it was in the wiring and checked it thoroughly everything looked right. So I put the ATmega168 back in and the led array worked perfectly.....now I'm stuck! Any help would be greatly appreciated? ton_mit |
---|---|
January 18, 2010 by mongo |
I recently purchased a couple myself. Haven't had the time to try them out but will post what I get when I do. |
January 19, 2010 by Rick_S |
I'm assuming you purchased the 328p from the NK guys right?? I've used several 328p's and haven't run across this one yet. The only thing I could think of is this. I created a separate code folder for the 328p programs. This way I could make sure I didn't inadvertently send the hex file for a 168 to the 328. To do this, after I created a copy of the code folder, I made sure the *.o and *.hex files had been deleted from the folder. I then changed the target in both GCCFLAGS and AVRDUDEFLAGS in the makefile. Then I would run make (I usually do this within Programmers notepad). If .o and .hex files aren't deleted from the folder, make won't re-make them and then avrdude will transfer the hex for the 168 to the 328 and it won't work. That's what I did with success. YMMV Rick |
January 19, 2010 by ton_mit |
yes, purchased 2 328p's from NK. I followed the nano guide to the letter and also created a new folder for the 328p.....Exactly what do I have to do in the libnerdkits folder? I tried to delete the .o files but get errors when thying to compile. I am using Programers Notepad. |
January 19, 2010 by Rick_S |
There's a file called io_328p.h that needs to be added to the libnerdkits folder and you have to add the #include "../libnerdkits/io_328p.h" to your program to compile for the 328. Then if you delete the *.o and *.hex files you should be able to re-compile without error. If you don't place that file there AND add the include to your program you will get compile errors. Rick |
January 19, 2010 by ton_mit |
Now I get an error that says: I tried the unaltered code from "ledarray_test".....with the exception of the changes that you recomended: "There's a file called io_328p.h that needs to be added to the libnerdkits folder and you have to add the #include "../libnerdkits/io_328p.h" to your program to compile for the 328. Then if you delete the .o and .hex files you should be able to re-compile without error." I even deleted all the ".o" files in the ../libnerdkits folder and ran make all for the libnerdkits to recompile the .o files. still getting the sig error.....any suggestions? thnx ton_mit |
January 19, 2010 by ton_mit |
here is the program....
|
January 19, 2010 by N3Roaster |
I seem to recall reading that the SIG_* style was depreciated and it's possible that you're using a version of avr-libc that no longer has them. I don't have the LED array kit or a 328p so I might be entirely off base here, but it looks like you want that function to be called in response to an overflow on timer 0. It might be as simple as switching to the non-depreciated form. Try replacing
with
|
January 20, 2010 by Rick_S |
You may be onto something N3Roaster. I forgot that I changed that interrupt statement early on. While I think the SIGNAL will still work for some mcu's it won't for all and since the 328p is newer, it may be one that it doesn't work on. I think you're almost there. BTW, if you want to add a few more effects, I posted a few I had made in some other threads. There are links to the threads in newsletter#8. Rick |
January 20, 2010 by ton_mit |
"I seem to recall reading that the SIG_* style was depreciated and it's possible that you're using a version of avr-libc that no longer has them. I don't have the LED array kit or a 328p so I might be entirely off base here, but it looks like you want that function to be called in response to an overflow on timer 0. It might be as simple as switching to the non-depreciated form. Try replacing SIGNAL(SIG_OVERFLOW0) { with ISR(TIMER0_OVF_vect) {" thank you and much acolades to N3Roaster!!!!!!! works like a charm! |
January 20, 2010 by ton_mit |
also thank you to Rick_S.....I noticed you help alot on this forum. |
Please log in to post a reply.
Did you know that you can control multiple LEDs from one microcontroller output? Learn more...
|