Hi,
I was able to write the bootloader (lilypad) into my bare Atmega328P using this guide.
But it does not work.
Depending on which way I connect the RXD/TXD wires I get either error 0x00 or 0xFC.
Did the program set the fuses to external clock without asking?
So I attached an ~15 Mhz crystal I had laying around, but this did not change anything.
I would like to understand the topic of the bootloaders.
There is the lilypad which is labeled with 8 Mhz. is this the "old" bootloader?
Then there is the "new" bootloader named "optiboot" and said to be 16 Mhz.
Are these both the old and new from Arduino or something else?
Problem is, my device is going to run at 27 Mhz. So is any of these bootloaders gonna work?
before someone asks: yes the project is proven to work at 27 MHz. Several people already have produced boards. they even ran the Atmega at 3.3V which I find odd and changed to 5V. But I don't know all of the details, like bootloader.
can I try a serial terminal at 115200?
does RTS up trigger the reset signal?
do not see anything
Yes. Bootloaders are written for specific processors and specific clock frequencies. When you burn the bootloader, it also sets the fuses as needed. So they are now probably set for 16MHz external (depending on which bootloader you burned).
Your 15MHz crystal will result in an incorrect baud rate by the processor (instead of e.g 115200 it will be 115200 times 15 divided by 16 and hence communication normal uploads will more than likely fail.
The old bootloader is for Nanos and it is written for 16MHz; the file is ATmegaBOOT_168_atmega328.hex. Optiboot is for Unos and newer Nanos and is also designed for 16MHz; the file is optiboot/optiboot_atmega328.hex.
You can find those files in a subdirectory under the Arduino15 directory; on my Windows system they are in C:\Users\Wim\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6.
In that directory is also a file called boards.txt that will tell you which board uses which bootloader.
A 328P at 27MHz? You are aware that that is far out-of-spec?
Serial communication (the bootloader or the serial monitor, etc.) has to work at a known baud rate and both devices have to run at the same rate.
Of course mllis() delay() and any other built-in timing functions will also be off.
...I'll leave that for someone else. I've only used the bootloader.
It's OK if it's a one-off product and/or if you want to risk it. It's not guaranteed to work next time with a different chip, maybe from a different batch and or with a different date code. It's also not guaranteed to work reliably.