bootloader on 328p

Hi,

I have a custom board with a 328p chip running at 16mhz.
I have modified the preferences.txt file to use USBtinyISP to load scketches instead of bootloader through TX/RX.
I can load scketches just fine uning Arduino IDE.
Everything was working just fine until I changed my mind and I want now to use the bootloader.
So, I used the USBtinyISP to burn the bootloader to the chip and everythings comes out ok as far as burning the bootloader, but after it is burned and I disconnect the USBtinyISP from ISP header and apply power to the board, with nothing connected to it, I get pin 13 blinking every second.
I think it's getting reset somehow by something and thus, I can't upload any scketches.
Is the blinking a sign of being reset?? No scketches have been ever uploaded at this point.
I have the following:

  • 12K pull-up resitor to VCC on reset pin.
  • 12K pull-down resistor to ground on RX pin.
  • 100nF decoupling capacitor between RTS# header pin of FTDI cable to reset pin. Although the FTDI cable is unplugged so far...
    Is there anyone that can shed some light on me?
    I've reached a dead stop and can't figure this one out.

Thanks

Ny chance it could be the wrong bootloader?

I'm loading the bootloader that came with 0016

Tools>Board>Arudino Duemilanove w/ ATMega328
I've even tried the wrong one, say the 168, but it gave me an error: Expected signature for ATMEGA168 is 1E 94 06

Can you still load and run sketches thru the icsp?

Has this bootloader ever worked on your custom board? I'm just remembering something vaguely similar that was the wrong loader.

Does your board have an automatic reset? Does that visibly work? Try resetting the board once you've started the upload from the IDE - wait till you get the message about the size of the file.

Hi Bill,

Thanks for the reply.
Yes, I can load and run scketches just fine if I load it through USBtinyISP. They behave normal and I haven't had a problem loading or running any scketch I load thorugh ISP header.
It is my first attempt to load the bootloader and try to upload scketches through the serial port. So, no the bootloader never worked for me. The bootloader does get uploaded fine when I burn it using USBtinyISP, but then right after it is burned, I disconnect the programmer and power the board with external power source, and the led13 keep blinking every second.
My board does have automatic reset through RTS# pin of FTDI cable via a 100nF ceramic capacitor. Yes it does visibly work as I can see the pin13 blink once everytime I initialize the com port that FTDI cable is attached to.
Just to clarify, I am using the TQFP32 package of ATmega328P and not the standard DIP28. Would that make a difference on the bootloader?? If I'm using the wrong bootloader, where would I be able to find the correct one?

Thanks

Notsure about the package but it seems very unlikely.

Can you confirm you have a good serial connection? Would there be anything in the changes made to use the programmer that could mess up (say) the baud rate?

Ah, wait now... To use the bootloader it has to be loaded somewhere specific and protected somehow - right? Could that have gotten messed up somehow?

I'm over my head with the specifics of how the bootloader works but if you have good serial and your regular sketches don't reset every second why should the bootloader.

Hi,
Yes, I have a good serial connection as my scketches that use serial.print work just fine and I receive the data on my computer.
The only change made to the preferences.txt to use the programmer was 1 line.
It was changed from upload.using=bootloader to upload.using=usbtinyisp, so I really doubt that the baud rate would be messed up, but I can't guarantee.... Would it?
I believe the bootloader is burned in the same memory area as the scketches are if you are using ISP programmer. So, if my scketches work fine, i'd have to assume that that part of the memory is fine too... Is my assumption correct? Besides, this behavior is occurring in another board I have too... So it is not this particular chip that is bad... Unless both my chips have the same issue. :frowning:

Thanks

The fact that the loader has never worked on this hardware makes it tough.

You burned the bootloade using the IDE - right? So all the fuses etc. would be set as expected.

Why the pull-down on RX, that's the only difference in what you described from my usual schematics.

Yes, I used the Arduino IDE to burn the bootloader with successful result.
The only reason for pull down on RX is because I followed the recomendation of the question "Why doesn't my sketch start when I'm powering the board with an external power supply? (Arduino Diecimila or earlier)" from http://www.arduino.cc/en/Guide/troubleshooting

Just to clarify, I am using the TQFP32 package of ATmega328P and not the standard DIP28. Would that make a difference on the bootloader?? If I'm using the wrong bootloader, where would I be able to find the correct one?

You know, the darned chips are a bit different aren't they. If I were you I would hop on to avrfreaks and poke around there.

I'm not sure the 328 in the arduinos are 328p's. have you tried installing the bootloader from avrdude? I hav to do that (including lockbits and fuses) on my custom made board with 168p because the signature is different than 168. -F will do the trick, otherwise the chips should work similarly.

Joachim

Thanks Joachim, your hint led me to solve my own problem.
I actually found out that there is nothing wrong with the bootloader that came with 0016 that I was using.
So, here is what I did:
I went to look for another bootloader and found the Adaboot328 from adafruit.com
I burned both Adaboot328 and Duemilenove bootloaders and they both were not loading up the scketches.
The difference is that Adaboot328 didn't blink as Duemilenove did. So I thought it couldn't be 2 bad bootloaders.... It would be too much out of luck on my end.
When Bill asked me about my serial connection and I said it was ok... Well, I got to find out it was not. I never actually used RX on my application, so when I said it was ok, I was just referring to TX. What I discovered was that a bad board had a short on the TX line.
After correcting the TX line, Adaboot328 started loading up sketches... :slight_smile:
I then went back to Duemilenove bootloader and tried again. After burning the bootloader, I still got that every second blinking. So I thought it was really a bad bootloader for the chip I had. But it was not... The Duemilenove bootloader has that behavior after it is burned and no sketches have been uploaded yet. After I burned my first sketch using the bootloader, everything went to normal and I didn't have that blinking problem anymore. :wink:
So, thank you very much for the help you guys gave me to solve my problem.

The Duemilenove bootloader has that behavior after it is burned and no sketches have been uploaded yet.

Hah! Good thing to know!

Glad you got it fixed.