How to customise arduino bootloader for programming different types of atmega328 - Page 1
Forum section: electronics / beginners

author: marekpasek
author_rank: Contributor
timestamp: June 16, 2019, 01:35:52 pm
content: Hello,Recently I have ordered few atmega328's from ebay. They were listed as atmega328p. When they arrived I tried to programme them with arduino uno board. The transfer failed. It seems that there are multiple types of these chips and everyone of them needs some special settings of bootloader. In my case I received the type atmega328p-u, while my board operates with atmega328p-pu. Since I am not good at programming, I cannot programme appropriate bootloader myself, therefore I ask you for help. Where could I find some pre-made bootloader or at least a proper description of what has to be done?Thank you very much.Post scriptum:Here is the error announcement:avrdude: stk500_recv(): programmer is not respondingavrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x17avrdude: stk500_recv(): programmer is not respondingavrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x17avrdude: stk500_recv(): programmer is not respondingavrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x17avrdude: stk500_recv(): programmer is not respondingavrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x17avrdude: stk500_recv(): programmer is not respondingavrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x17avrdude: stk500_recv(): programmer is not respondingavrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x17avrdude: stk500_recv(): programmer is not respondingavrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x17avrdude: stk500_recv(): programmer is not respondingavrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x17avrdude: stk500_recv(): programmer is not respondingavrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x17avrdude: stk500_recv(): programmer is not respondingavrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x17

author: sleemanj
author_rank: Super Contributor
timestamp: June 16, 2019, 01:44:47 pm
content: The error shown is notning to do with that, you have a connection problem.

author: marekpasek
author_rank: Contributor
timestamp: June 16, 2019, 01:57:02 pm
content: It works perfectly with atmega328p-pu. The problem has to be in the chip.

author: sleemanj
author_rank: Super Contributor
timestamp: June 16, 2019, 02:01:35 pm
content: In that case either the chip is dead, it has had reset or spi programming disabled, or you are connecting it incorrectly, check the pinout. The error literally means NO comms can be established, if it was just "different chip variant than expected" you would get a signature error with a valid but unexpected signature bytes.

author: sleemanj
author_rank: Super Contributor
timestamp: June 16, 2019, 02:08:05 pm
content: Also, to confirm you are attempting to burn a bootloader (tools > burn bootloader), and you can successfully do so using the "-pu" you have but not with this other suspect chips you have.

author: marekpasek
author_rank: Contributor
timestamp: June 16, 2019, 02:18:06 pm
content: It does not allow me to burn it in any case, no matter which chip I insert. But it still allows to transfer code to the "p-pu" without a problem.

author: sleemanj
author_rank: Super Contributor
timestamp: June 16, 2019, 02:22:25 pm
content: Ok sounds like your problem may be a lack of understanding.I am guessing you are unplugging the working chip from ardunio, plugging in new chip and trying to "upload" some program over normal upload process, that will not work.If that is what ypu are trying to do then I suggest you google arduino on breadboard as starting point for your learning.

author: marekpasek
author_rank: Contributor
timestamp: June 16, 2019, 02:30:33 pm
content: Your initial presumption sounds very accurate. So does the second. Though I am not sure what you mean by your advice. How does that help, if I connect the chip via jumper wires and breadboard instead of the socket, which is mounted nicely on the board?

author: kosine
author_rank: Regular Contributor
timestamp: June 16, 2019, 03:03:47 pm
content: A factory-new ATmega chip has no bootloader, though you can buy the chips with a bootloader preprogrammed.If your chips are "raw", then they won't work on an Arduino board until a bootloader has been written to them. This has to be done by SPI, on a breadboard if necessary.The raw chips have no hardware or software to handle USB, only SPI. The Arduino board has the USB hardware and the bootloader provides the software - once it's installed. A raw chip won't know what to do with the USB until it has a bootloader on it. So you can't do it in a spare Arduino board over USB. (Catch-22) It has to be done on a breadboard via SPI using a working Arduino as a ISP programmer.Instructions are here:https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard

author: marekpasek
author_rank: Contributor
timestamp: June 16, 2019, 03:11:46 pm
content: Sounds great. Thank you.

author: malagas_on_fire
author_rank: Frequent Contributor
timestamp: June 16, 2019, 08:29:07 pm
content: Also in the future if you plan to have more atmega328p search for USB tinyISP or USBasp which is a serial 3 wire programmer that comes with header , so you place the chip on an arduino board or custom board and burn the bootloaders in a more easy way.Search linkhttps://www.ebay.com/sch/i.html?_from=R40&_sacat=0&_nkw=usbtinyisp&_blrs=spell_checkWin Driver:https://www.hobbyist.co.nz/?q=usb-tiny-ispOr do a homemade one:https://malagas.wordpress.com/2012/04/28/homemade-isp-usbasp/