Baud rates when using ISP

Hi,

I understand that if I am programming my ATMega328(p), via the ISP interface, that a bootloader on the chip is not involved? If I have got this wrong, please ignore the rest of this post!

However, if correct, can anyone help me out with the following questions?

  1. If using an ATMega328P (or an ATMega328 with a bootloader that I have installed), what happens to the bootloader code after loading a new sketch via ISP? Is it ignored or wiped with new reset vector addresses to the newly installed code?

  2. Additionaly, as I understand it, the AVR ISP interface has its own clock (SCK?) and therefor the chip is syncronus with the programmer. Thus any and all baud rate references in this context only relate to, and effect the PC to low-voltage serial programmer (USBasp etc). Is this correct?

Best regards, Martin

  1. When you upload a sketch with a programmer, the bootloader is removed. I'm not 100% sure if the bootloader section is released or if the bootloader would still be in the bootloader section.
    If you want the bootloader back again, you have to burn the bootloader (using a programmer).
    All those commands are in the menu. If you use the commands from the Arduino IDE menu, then everything is okay, the fuses and bootloader section and everything is okay with or without bootloader and with or without programmer.

  2. There is not really a baudrate. The USBasp programmer supplies the SCK clock, and the ATmega328P has to follow. The SCK clock can often be changed in a configuration file.
    The ATmega328P must also have its own clock, either internal or external. If a fuse is set for external clock, and there is no external clock, then the programmer can not communicate with the chip.

mprowe:
as I understand it, the AVR ISP interface has its own clock (SCK?) and therefore the chip is synchronous with the programmer. Thus any and all baud rate references in this context only relate to, and effect the PC to low-voltage serial programmer (USBasp etc). Is this correct?

Correct.

Koepel:
When you upload a sketch with a programmer, the bootloader is removed. I'm not 100% sure if the bootloader section is released or if the bootloader would still be in the bootloader section.

The program area is first erased in its entirety, which includes the bootloader. The reset vector points to where the bootloader was expected to be toward the end of memory as the fuses are not altered. If the code extends over this point, it will attempt to execute whatever it finds from that point. If there is no code from your uploaded sketch at that point, it will execute NOPs (or something similar) until it folds back to zero and starts your sketch.

one should be aware that ffffffff is a 4 byte instruction so not quite nop. with fully erased boot area it wont matter but if there is a single word instruction anywhere in there it will not be on even byte boundary and so not wrap properly and the user code wont run.

Nevertheless the bootloader location is always a four byte boundary and the chip will be erased (to 0xFFFFFFFF) by the ISP programming, will it not?

Thank you all for a most enlightening thread.

Regards, Martin

Paul__B:
The program area is first erased in its entirety, which includes the bootloader. The reset vector points to where the bootloader was expected to be toward the end of memory as the fuses are not altered. If the code extends over this point, it will attempt to execute whatever it finds from that point. If there is no code from your uploaded sketch at that point, it will execute NOPs (or something similar) until it folds back to zero and starts your sketch.

Does anybody know if this was ever brought up as an issue in github to have the IDE fix the reset vector fuse bit during Upload Using Programmer?