I’m trying to upload a program to an arduino nano copy, in the Arduino IDE I have to select Processor: ATmega328 to upload successfully.
This is my platrom.ini file:
How ever platformio failes and gives me this output:
Configuring upload protocol...
AVAILABLE: arduino
CURRENT: upload_protocol = arduino
Looking for upload port...
Use manually specified: COM4
Uploading .pio\build\nanoatmega328new\firmware.hex
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xe6
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xe6
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xe6
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0xe6
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0xe6
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xe6
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0xe6
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0xe6
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0xe6
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xe6
avrdude done. Thank you.
When I select ATmega (Old Bootloader) in the Arduino IDE, I get the same output. I was told that it could be possible that this is a problem of the Arduino copy and not platformio.
I also tried board = nanoatmega328 which gave me the same out put as above.
I’ve also have successfully uploaded the same program with board = nanoatmega328 on an other Arduino nano which i think is from a different manufacturer. For this Arduino I also had to choose ATmega (Old Bootloader) in the Arduino IDE.
Any ideas what I could try?
EDIT TO SOLUTION:
I’m not exactly sure but I think burining the bootloader fixed it.
Does your Nano have a CH340 chip as serial converter? Then I’d recommend you install the latest driver from the vendor CH341SER.EXE - 南京沁恒微电子股份有限公司 (blue download button).
And your Arduino Nano has a Atmega328 chip on it and not a 168 one?
You could also try to use different bootloader baud rates, that is the main difference (115200 on new vs 57600). See docs for setting that. you could use board = nanoatmega328 and then add
If none of these baudrates work, then chances are that
the bootloader programmed into your Arduino Nano copy is different
there is no bootloader programmed
the board has a physical defect
Note that in the first two cases, you can indeed try and rescue the board by programming it with an ISP programmer. Basically, you can use another Arduino Uno (I think Nano, too) and flash a special sketch on it that will make that board act like a programmer. Using that programmer, you can reflash the chip directly via the SPI/ISP interface, without going through a bootloader program. If the target chip is not damaged, this will work.
I’ve just been burning the Bootloader but it’s still not working, I already installed the WCH driver and I’m 100% shure that it’s not a 168 because it doesn’t work in the Arduino IDE.
Well it’s not realy a good solution but you can upload the binary after compiling it in PlatformIO with this command in the Terminal:
<Path to arduino IDE home>\hardware\tools\avr/bin/avrdude -C<Path to arduino IDE home>\hardware\tools\avr/etc/avrdude.conf -patmega328p -carduino -P<Port> -b115200 -D -Uflash:w:.pio\build\<env name>\firmware.hex:i
If you try this for your program replace the paths in <> with the ones on your machine.
I got this by copying the command from the Arduino IDE with verbose upload.
No I meant now that the bootloader is on there and you can flash with the Arduino IDE, then PlatformIO should be able to upload normally too now via the serial bootloader, no?
I just tried uploading it again and magicly it worked. Maybe it was the bootloader, but i’d guess that some thing with the USB port on my Arduino meight be broken.