optiboot atmega328p not working

if i flash the default bootloader from the arduino duemilanove board in arduino ide or if i use the default optiboot XPLAINED_328p bootlaoder the arduino works fine. but if i compile a bootloader by typing make atmega328 i cannot uplaod the sketch i get sync timeouts. the strange part is i had it working once before now i cant get it to work at all. all of the bootlaoders upload fine but the one i compile wont let me upload any sketches. whats wrong i followed the directions i cant figure out where im going wrong?!?!?

ive tried different baud rates and clock speed when compiling nothing seems to work. if i try to uplaod the sketch as n arduino uno it takes it but dont run the sketch. why is there a bootlaoder call xplained_328p_mini and the make file only allows atmega328p to be passed as args. am i compiling the wrong bootloader?

Is there a reason you're not just using the Tools>Burn Bootloader command in the IDE?

BJHenry: Is there a reason you're not just using the Tools>Burn Bootloader command in the IDE?

i changed the watchdog to 8 seconds so i can have a little more time to send my sketch over the internet. i dont really know anything about bootlaoders. i recompiled a mega2560 stk500 bootloader to have more delay before lauching the sketch and that was successful. but before that i compiled one for the 328p which i can no longer locate but it worked. now im trying to compile for the 328p again and its not working at all

im not sure but i think when i had the working bootlaoder for the 328p it was set at 19200 baud. ive tried all different bauds. im not sure what the default clockspeed of my board is but im not changing any build option until i get it to accept a sketch. i dont kno what to do ive done everything i can think of?

after running "make atmega328" then "make xplained328p i get error

      ^
optiboot.c: In function 'main':
optiboot.c:671:18: error: 'WATCHDOG_8S' undeclared (first use in this function)
   watchdogConfig(WATCHDOG_8S);
                  ^
optiboot.c:671:18: note: each undeclared identifier is reported only once for each function it appears in
make[1]: *** [optiboot.o] Error 1
make[1]: Leaving directory `C:/Users/TV/Downloads/optiboot-master/optiboot/bootloaders/optiboot'
make: *** [xplained328p] Error 2

i dont understand??

notsolowki: i changed the watchdog to 8 seconds...

If that is the case then you can do that in your sketch without changing the bootloader- this link has a pretty good rundown on how to do it.

BJHenry: If that is the case then you can do that in your sketch without changing the bootloader- this link has a pretty good rundown on how to do it.

i dont understand why they have to make this so complicated im getting so sick of working with optiboot. i have no clue how i had it working before. even with the stock compiled bootloader it WILL NOT WORK i am uplaoding them with ide too so its setting the fuses correctly. i can even notice the change in the watchdog timer it will not accept a sketch. then i go flash the bootlaoder that comes stock with optiboot and it works. feel free to compile a bootloader even stock ill flash it and see if im the only person thats having this problem. is there another bootloader besides optiboot i can compile easily?

im sorry my board is a arduino nano with a atmega 328p processor.

I think you need to stop, take a breath, and gather your thoughts. What you're saying isn't very clear. Start with the basics- you want to change the watchdog timer. You can do that without changing anything in the bootloader. Why are you so set on modifying the bootloader, especially since that seems to be a bit beyond you at the moment?

i just really want some help compiling this bootlaoder. i like the idea of the method you mentioned but this is driving me crazy and i want to get it to work. i compiled the bootlaoder at 57600 baud and now i can upload my sketch but the sketch just restart very fast over and over again. i can see my serial print in the setup on the serial monitor. why is it resetting like this? do you have any idea what i could try?

I'd have to guess that you've set up the watchdog timer incorrectly, since the purpose of the WDT is to reset the microcontroller.

BJHenry: I'd have to guess that you've set up the watchdog timer incorrectly, since the purpose of the WDT is to reset the microcontroller.

just to make sure i re downloaded optiboot and recompiled with no modified settings. i get the same result? the only clokcspeed that will work is 16mhz i used 57600 baud when compiling loader. please if you can compile a optiboot loaded that should work im really willing to try it to help debug this issue. i really dont want to give up on it yet

notsolowki: just to make sure i re downloaded optiboot and recompiled with no modified settings. i get the same result?

As a sanity check, use the Tools>Burn Bootloader option in the Arduino IDE. If the board doesn't keep resetting once the stock bootloader is uploaded then the issue is in the bootloader that you're compiling and uploading.

notsolowki: please if you can compile a optiboot loaded that should work im really willing to try it to help debug this issue. i really dont want to give up on it yet

If you select 'Uno' as the board type and then use Tools>Burn Bootloader it will load Optiboot onto the board. It will think it is a Uno rather than a Nano, but that's the only real difference.

BJHenry: As a sanity check, use the Tools>Burn Bootloader option in the Arduino IDE. If the board doesn't keep resetting once the stock bootloader is uploaded then the issue is in the bootloader that you're compiling and uploading. If you select 'Uno' as the board type and then use Tools>Burn Bootloader it will load Optiboot onto the board. It will think it is a Uno rather than a Nano, but that's the only real difference.

that worked. it took the bootloader and the sketch. please forgive me for saying this but now how can i modify the watchdog of this bootlaoder and how do i build it? is all i have to do is "make atmega328" and if so, with no modified optiboot files i will compile the loader and send it to the processor. at bauds 19200 OR 57600 i suffer from the bootloop?

this is the board i am using, nano the onboard crystal “if that is on” is too small to read i assume it is running at 16mhz but ive also tried 8 mhz on compile

do you have a bootloop with the Uno bootloader on Nano?

Juraj: do you have a bootloop with the Uno bootloader on Nano?

no just when i compile. im going to delete the optiboot and re-download everything and try version 8.0 and 7.0

okay so that all resulted in the same bootloop outcome. im even getting the loop when i flash the stock bootloader from boards manager i select optiboot 8.0 xplained atmega 328p mini. the only thing i havnt check are the fuses. could they cause this to happen? also i never dealt with a bootloop before however i can see my serial.print from the setup() in the sketch. it just repeats really fast. assuming this is what you talking about

notsolowki: okay so that all resulted in the same bootloop outcome. im even getting the loop when i flash the stock bootloader from boards manager i select optiboot 8.0 xplained atmega 328p mini. the only thing i havnt check are the fuses. could they cause this to happen? also i never dealt with a bootloop before however i can see my serial.print from the setup() in the sketch. it just repeats really fast. assuming this is what you talking about

I meant Arduino AVR core boards package's Uno bootloader. it is Optiboot 4 build for Uno and used in new Nanos too