Closed Floyddotnet closed 7 years ago
Its a Nano v3 from Robodyn with CH340G - USB-UART interface
http://robotdyn.com/catalog/boards/nano_v3_ch340g_compatible_with_arduino_nano_v3/
Output from Arduino Studio in Windows 10:
avrdude: Version 6.3, compiled on Dec 16 2016 at 13:33:19
...
Using Port : COM6
Using Programmer : arduino
Overriding Baud Rate : 57600
AVR Part : ATmega328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : Arduino
Description : Arduino
Hardware Version: 2
Firmware Version: 1.16
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us
avrdude: AVR device initialized and ready to accept instructions
...
I upgrade my avrdude on my raspberry pi also to version 6.3 .. but change nothing
that's the most common arduino error ever, its got dozens of causes which doesn't help much, usually nothing to do with the makefile (its usually seen with the ide).
first i'd say try setting ARDUINO_SKETCHBOOK
, as i assume most of those paths aren't supposed to be from the root dir and those libraries aren't really system libs e.g. /source/Ambilight/ArduinoMk and /libraries. i'm surprised it even compiles with that setup.
also is you user in the dialout group, otherwise it won't have permissions to do the serial upload.
what are the permissions of /dev/ttyUSB0 ? i assume you don't have anything else using that port (serial console or a hat?)
finally as is usually the problem with pi's - do you have enough power to power the usb nano - a 500mA phone charger is no good
first i'd say try setting ARDUINO_SKETCHBOOK, as i assume most of those paths aren't supposed to be from the root dir and those libraries aren't really system libs e.g. /source/Ambilight/ArduinoMk and /libraries. i'm surprised it even compiles with that setup.
I can try this but compiling isn't the problem.
also is you user in the dialout group, otherwise it won't have permissions to do the serial upload.
Yes
root@pi:~# groups
root dialout video
what are the permissions of /dev/ttyUSB0
root@pi:~# ls -l /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 0 Feb 19 2017 /dev/ttyUSB0
and also
screen /dev/ttyUSB0 115200
works
finally as is usually the problem with pi's - do you have enough power to power the usb nano - a 500mA phone charger is no good
The Nano is directly powerd from a good 5V 15A Power supply. Also the Pi.
Note: if i unbox a new nano, the first upload works
A manuell call of avrdude 6.3
root@pi:~# avrdude -q -V -p atmega328p -C /etc/avrdude.conf -D -c arduino -b 57600 -P /dev/ttyUSB0 -U flash:w:build-nano328/AmbilightSketch.hex:i
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xbd
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xfc
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x53
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x0a
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x9f
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xad
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0xbd
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0xdd
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x0a
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x0a
avrdude done. Thank you.
Change the programmer to avrispmkII
didn't help. But get different error.
root@pi:~# avrdude -q -V -p atmega328p -C /etc/avrdude.conf -D -c avrispmkII -b 57600 -P /dev/ttyUSB0 -U flash:w:build-nano328/AmbilightSketch.hex:i
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
...
you shouldn't be running it as root. permissions are irrelevant as root. try adding the pi (or whatever user you are) to the dialout group. but as its not working as root i guess that's not the problem.
is this raspbian jessie, as that has some weird systemd stuff that interferes with the serial ports (getty console etc.)
i'm just wondering if you're messing up the fuses or bootloader and that's why it works the first time. shouldn't be able to do that over serial though, that's iscp only. try avrdude without the -D option, that'll force a chip erase e.g. in your Makefile:
BOARD_TAG = nano328
MONITOR_PORT = /dev/ttyUSB0
AVRDUDE_OPTS = -v
include /usr/share/arduino/Arduino.mk
i assume your nano is a 16MHz 328p version and not the 168p or 20MHz version? flashing the wrong chip or crystal can definitely cause the problem.
programming my nano uses the following avrdude command:
/usr/share/arduino/hardware/tools/avr/../avrdude -q -V -p atmega328p \
-C /usr/share/arduino/hardware/tools/avr/../avrdude.conf -D -c arduino \
-b 57600 -P /dev/ttyUSB0 -U flash:w:build-nano328/blink.hex:i
Perfect .. After adding "MONITOR_PORT" it works Thanks.
I found that if you choose Tools>Processor>ATmega328P (Old Bootloader) then uploading works on ubuntu linux. Perhaps that is useful to someone reading this.
thanks @fluentart it worked for me
i had this Makefile
, which was generated by ardmk-init -b nano -u atmega328
(per readme)
# WRONG:
BOARD_TAG = nano
BOARD_SUB = atmega328
/usr/bin/avrdude -q -V -p atmega168 -C /etc/avrdude.conf -D -c arduino -b 19200 -P ...
solution
BOARD_TAG = nano328
/usr/bin/avrdude -v -p atmega328p -C /usr/share/arduino/hardware/tools//avrdude.conf -D -c arduino -b 57600 -P ...
Some new arduino nano boards when uploading sketches to them the Make file needs weird configuration parameters.
For example setting BOARD_TAG = uno, instead of nano.
Check this post in case the above solutions do not work.
I try to upload sketches via my Raspbian (Debian / Raspberry Pi) and Windows 10 to my Nano 328.
Arduino Studio 1.6.7 tells me:
Board: Arduino Nano Processor: ATmega 328 Programmer: AVRISP mkII
Upload the Sketch via Arduino Studio on Windows 10 works fine. Upload the same Sketch vias Raspbian fails with the following error:
I try it with Arduino-Makefile release 1.5 and the current git version 1.5.2+ (last commit: 08b4f441ff5e608b67d43491f414f43b1c4c5384)