NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » ATMega328p Nerdkit programming
January 05, 2011 by weijiajun |
So I am having an issue with using an ATMega328p chip in my project. The chip I picked up didn't have a bootloader on it, so I picked up a usbasp programmer and installed the bootloader, then I used the usbasp programmer to upload the initialload program and everything seemed to work fine. (I am using a 20Hz crystal as well). However when I try to turn on programming mode (attaching pin 14 to ground) nothing seems to happen. Basically the chip runs just like regular, and I cannot connect to the chip using the supplied USB cord. I guess I'm just looking for ideas that people might have as to how I should go about finding the problem. Thanks! |
---|---|
January 05, 2011 by Rick_S |
If you used the usbasp programmer to send the initialload program you may have overwritten your bootloader. If you want to program the micro with the bootloader, you could probably re-send the bootloader, and make sure the fuses are set properly. Then just use the USB-serial cable from the NK to upload. Rick |
January 05, 2011 by Ralphxyz |
To use the Nerdkit bootloader I believe you have to use the 14.7456MHz crystal supplied with the Nerdkit. You can program with the 14.7456MHz crystal and then switch crystals to run the program. Or so it has been said here in the forums. Ralph |
January 05, 2011 by weijiajun |
Well turns out you were both right. I originally tried to switch between the 20 and the 14.7.. crystal and it hadn't worked for me, but that is because it looks like I was overwritting the bootloader as Rick mentioned. Thanks for the quick replies! |
January 18, 2011 by ramaral |
Hi Guys, I'm trying to understand the UART. I'm using the libnerdkits library and using the uart functions. All I want to do is send the MCU an aphanumeric string and have it echo it back to me via the USB-to-Serial cable. I'm using termite for my serial client. Here's the heart of the code.
When I send "V1234" I get echoed back "v124". If I send "V123" I get "v123". It seems like I the uart code can only handle 4 characters? Is that right? -Rich |
January 19, 2011 by mrobbins (NerdKits Staff) |
Hi Rich, There shouldn't be anything special with 4 characters. Is it possible that your delay is causing some bytes to overwrite others? As-is, the serial library doesn't do any buffering, so if one byte comes in while another one hasn't been "collected" yet by the uart_read call (or uart_getchar), then you might loes a byte. (It is possible to create buffered input using UART interrupts.) Mike |
January 19, 2011 by ramaral |
Hi Mike, That was it. I had assumed the data was buffered. I changed the code to read as fast as it can from the UART into a buffer, after which I process the buffered data. I did this crudely, without using interrupts. Can you point me to an example that uses UART interrupts to buffer incoming data? Thanks. -Rich |
January 20, 2011 by mrobbins (NerdKits Staff) |
Hi Rich, I thought that someone had provided an example of interrupt-based UARTs on the forums some months ago, but I'm having trouble finding it right now! Mike |
Please log in to post a reply.
Did you know that you can build a giant scrolling LED array with our microcontroller kit? Learn more...
|