hansdejongehv
Posts: 8
Joined: Wed Jan 04, 2017 10:14 pm

I could program an Arduino Nano from RPi - but not any longe

Wed Jan 04, 2017 11:49 pm

I have been successfully programming Arduino Nano from RPi up to and including Raspian release 2016-03-18. However starting from Raspian release 2016-05-10 it still wants to program the genuine Arduino Nano, however the Chinese clones with CH340G chip fail to be programmed.
This problem is reported by the Arduino IDE: avrdude: stk500_recv(): programmer is not responding.

Further detail:
  • I have no idea whether the CH340G is relevant to the problem.
  • Communicating to an already programmed Arduino Nano works FINE. I use scratchClient to make the link between Scratch and the Arduino Nano and that works fine with BOTH releases.
    So the only problem that I found is with the Arduino IDE. It therefore does not look like a general driver problem.
  • On both releases the Arduino version is Arduino 2:1.0.5 + dfsg2-4.
  • Starting Arduino with sudo does not make a difference.
  • It is reproducible. I have downloaded both releases and only did
    sudo apt-get install arduino
    So there is nothing else in play than the Raspian release and the Arduino IDE. And the latter is reportedly the same version. Actually I tried all Raspian versions from 2016-02-09. Before 2016-05-10 it works, starting with 2016-05-10 the problem appeared and stayed.
So my conclusion is that there is something changed with the release 2016-05-10.

Does anyone know what could be the cause and - more importantly - what can be done about it.

User avatar
scruss
Posts: 2420
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: I could program an Arduino Nano from RPi - but not any l

Thu Jan 05, 2017 1:34 am

I've tested a real Uno and a clone CH340 Nano using the packaged Arduino development system. Both compiled and uploaded fine. I'm using Raspbian Pixel, whatever the most recent version is. What were your complete error messages? Make sure that verbose output is set in Arduino preferences, and post the errors here.

I'd strongly recommend using a regularly updated version of Raspbian, and also using the ARM version of the Arduino Development Environment, currently v1.8.0: Arduino - Software. The Raspbian version is ancient (v1.0.5) and misses many useful new features like pluggable architectures for ATMega/ARM/ESP86/... and also easy library maintenance.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

hansdejongehv
Posts: 8
Joined: Wed Jan 04, 2017 10:14 pm

Re: I could program an Arduino Nano from RPi - but not any l

Thu Jan 05, 2017 7:28 am

Thanks for your fast reply and for trying it out.
I found the verbose option in the Arduino preferences. When switching it on, a small sketch like Blink did upload without problems, while when verbose is not on then it fails with the error in my original post.This is very consistent and reproducible.

Uploading a large sketch looks to work fine, until it at some moment it still stops working with the same error message. The log is very large and the first part of the log has already disappeared from the screen.

I have to rush to work now but will tonight try to make a full log and post it here.

I will then also try to use the more recent version of the Arduino IDE (if I can find out how to get and install it).

The fact that it works at least a bit better when verbose is ON looks to indicate a timing issue. Does anyone know whether in the 2016-05-10 release something has changed in the way the USB interface is driven?

User avatar
DougieLawson
Posts: 35823
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: I could program an Arduino Nano from RPi - but not any l

Thu Jan 05, 2017 11:43 am

https://blog.arduino.cc/2016/05/17/disc ... arm-linux/

V1.8.0 has an ARM build that should run on a Raspberry, that will include the board data for a Nano.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
scruss
Posts: 2420
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: I could program an Arduino Nano from RPi - but not any l

Thu Jan 05, 2017 10:07 pm

You can install the ARM version of Arduino 1.8.0 like this:

Code: Select all

wget https://downloads.arduino.cc/arduino-1.8.0-linuxarm.tar.xz
tar xvJf arduino-1.8.0-linuxarm.tar.xz
cd arduino-1.8.0/
./install.sh
It might be an idea to remove the Raspbian version first to avoid confusion: sudo apt remove arduino

I'll try a couple of larger sketches with my CH340 Nano, such as K3NG's CW (Morse Code) keyer, as I only tested with Blink.

You can copy the entire log by clicking in the log window, hitting Ctrl-A, then Ctrl-C, and pasting the results into a text editor. I think the 1.8.0 version has a "Copy Log to Clipboard" button. I think there are too many variables to say if USB serial handling has definitively changed in new Raspbian releases. I don't ever recommend staying with anything other than the newest.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

hansdejongehv
Posts: 8
Joined: Wed Jan 04, 2017 10:14 pm

Re: I could program an Arduino Nano from RPi - but not any l

Thu Jan 05, 2017 11:32 pm

OK, I have used a clean install of the latest Raspian (2016-11-25) and then installed Arduino 1.8.0 in the way scruss suggested. The install worked, apart from some files that were intended to be touched but did not exist. However these were some icon files, so I expect there is nothing essential there.

Then I tried compiling and uploading blink. With no logging it always fails. With logging switched on it sometimes worked, and sometimes it did not work. Then I got the log below.
The messages at the end that the programmer is not responding did not stop, so at a certain moment I cancelled the process.

Hope someone has any clue.

I have also tried to upload a large file using Raspian release of 2016-03-18 and the packaged Arduino. That always worked flawlessly.

I will tomorrow night try to upload to other Arduino Nano clones using the latest Raspian release and Arduino 1.8.0 (I have 3 different types of clones).
----------------------------------------------------

Sketch uses 928 bytes (3%) of program storage space. Maximum is 30720 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.
/home/pi/ard18/arduino-1.8.0/hardware/tools/avr/bin/avrdude -C/home/pi/ard18/arduino-1.8.0/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -carduino -P/dev/ttyUSB0 -b57600 -D -Uflash:w:/tmp/arduino_build_675337/Blink.ino.hex:i

avrdude: Version 6.3, compiled on Dec 16 2016 at 12:14:49
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

System wide configuration file is "/home/pi/ard18/arduino-1.8.0/hardware/tools/avr/etc/avrdude.conf"
User configuration file is "/home/pi/.avrduderc"
User configuration file does not exist or is not a regular file, skipping

Using Port : /dev/ttyUSB0
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

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading input file "/tmp/arduino_build_675337/Blink.ino.hex"
avrdude: writing flash (928 bytes):

Writing | ###########################################avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
####### | 100% 10.30s

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding

User avatar
RST8
Posts: 64
Joined: Tue Nov 25, 2014 1:57 pm

Re: I could program an Arduino Nano from RPi - but not any l

Fri Jan 06, 2017 10:51 am

Have you got some other USB cables you can try?
I've had similar problems with nano clones before and some seem really fussy about the USB cable, even when clone UNOs are happy with the same cable. I spent a while chasing round drivers to no avail and was down to my last USB cable in the house which just then worked.

Joe

User avatar
scruss
Posts: 2420
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: I could program an Arduino Nano from RPi - but not any l

Fri Jan 06, 2017 9:35 pm

I've just tried uploading a 25,318 byte (82% of Nano memory) sketch to a Nano clone. No problems in either standard or verbose modes on a Raspberry Pi 3.

What else is running on your Raspberry Pi? Any other hardware attached? No power problems?
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

stderr
Posts: 2178
Joined: Sat Dec 01, 2012 11:29 pm

Re: I could program an Arduino Nano from RPi - but not any l

Fri Jan 06, 2017 10:27 pm

hansdejongehv wrote:I have been successfully programming Arduino Nano from RPi up to and including Raspian release 2016-03-18. However starting from Raspian release 2016-05-10 it still wants to program the genuine Arduino Nano, however the Chinese clones with CH340G chip fail to be programmed.
When you plug in the nano, are you seeing it picked up in /dev ? Do you have more than one device plugged in that the software might be confused about? Are you seeing it in the menu option as a device?

I know that I was using x86 ubuntu 16.04 and then 16.10 and it had a working driver but I couldn't get the pi's raspbian to see the clone esp8266 with built in usb, the thing is called linlo, linlanloon, I don't know, liloo, don't have it here, some name like that. Have you tried the 4.9 kernel on the pi, there seems to be some additional support for possibly relevant stuff recently out of China in there somewhere.

hansdejongehv
Posts: 8
Joined: Wed Jan 04, 2017 10:14 pm

Re: I could program an Arduino Nano from RPi - but not any l

Sat Jan 07, 2017 12:16 am

Hmm, this is embarrassing. Actually, the Arduino Nano is connected to a powered USB hub, which is then connected to the RPi.
I had earlier looked whether it made a difference. And then it did not.
However now that I use 1.8.0, I tested again with the Arduino Nano directly connected to the RPi, and, voila: it works and quite consistently. Also with an image that takes more than 70% of the space.

So still it is strange that with the Arduino IDE 1.0.5 release and Raspian up to and including 2016-03-18 it worked with USB hub.
Also strange that with the new Raspian releases and Arduino IDE 1.0.5 the removal of the USB hub did not help.

Anyway it looks that I have to first run further investigations. So thanks to all of you who reacted. I will do a systematic test of two Raspian releases / two Arduino IDE releases / Hub yes and no and then come back to it.

I had put a powered USB hub in to avoid drawing too much power from the RPi, as well as with the idea that if the Arduino is not wired correctly, it has less chance of blowing up the RPi. Anyway, I will for the time being do without the hub.

Thanks again for your reactions.

Return to “Troubleshooting”