melcus
Posts: 4
Joined: Wed Jan 09, 2013 7:38 am

Raspberry pi to Arduino pro mini using FTDI cable

Thu Jan 09, 2020 3:55 pm

Hi All,
I have run into an issue trying to update a arduino pro mini from my pi.
I am able to update arduinos that has a usb connection without any issue, but I also have a number of old arduino pro minis that use FTDI to update them.
When I connect the cable the power led lights up on the arduino and in the arduino ide the Serial port is selected so it appears to know something is there, but when I try to upload a sketch I get the following error
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
...
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00

It's been a while since I used the FTDI cable but it did work before on a PC and I have tried this on a number of different arduinos and I get the same result for all of them.
The version of the Arduino ide I am using is '2.1.0.5' I got it using sudo apt-get

If anyone one has any suggestions I would be grateful.

Thanks

LTolledo
Posts: 2405
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: Raspberry pi to Arduino pro mini using FTDI cable

Thu Jan 09, 2020 8:46 pm

am still using Arduino IDE 1.8.2 on this RPi3B+ with Raspbian Stretch Desktop

am able to flash my Arduinos, ESP8266, ATTinys, using FT232RL or FT232R1, as well as CP2102N and CH340.
its installed using this proocedure:
ArduinoIDE_Raspbian.jpg
ArduinoIDE_Raspbian.jpg (141.04 KiB) Viewed 321 times

Code: Select all

cd ~
wget https://downloads.arduino.cc/arduino-1.8.2-linuxarm.tar.xz
tar -xvf arduino-1.8.2-linuxarm.tar.xz
cd arduino-1.8.2
sudo ./install.sh
upon checking the Arduino site... the latest is version 1.8.10
so replace that version on the procedure above.
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

hippy
Posts: 6498
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Raspberry pi to Arduino pro mini using FTDI cable

Fri Jan 10, 2020 12:16 am

melcus wrote:
Thu Jan 09, 2020 3:55 pm
The version of the Arduino ide I am using is '2.1.0.5' I got it using sudo apt-get
LTolledo wrote:
Thu Jan 09, 2020 8:46 pm
am still using Arduino IDE 1.8.2 on this RPi3B+ with Raspbian Stretch Desktop
The version numbering of the 'apt-get install arduino' version is somewhat confusing. I have seen a number of people report it as 2.something but it's actually an ancient 1.0.5 version.

Code: Select all

[email protected]:~ $ apt-cache policy arduino
arduino:
  Installed: (none)
  Candidate: 2:1.0.5+dfsg2-4.1
  Version table:
     2:1.0.5+dfsg2-4.1 500
        500 http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages
The latest version is 1.8.10. Remove the apt-get version with 'sudo apt-get purge arduino' then install as per LTolledo above, replacing 1.8.2 with 1.8.10

You might have to delete the .desktop file first or post-edit it so it contains "Exec=/home/pi/arduino-1.8.10/arduino" or it may end up pointing to the old version you just removed.

melcus
Posts: 4
Joined: Wed Jan 09, 2013 7:38 am

Re: Raspberry pi to Arduino pro mini using FTDI cable

Fri Jan 10, 2020 11:25 am

LTolledo wrote:
Thu Jan 09, 2020 8:46 pm
am still using Arduino IDE 1.8.2 on this RPi3B+ with Raspbian Stretch Desktop

am able to flash my Arduinos, ESP8266, ATTinys, using FT232RL or FT232R1, as well as CP2102N and CH340.
its installed using this proocedure:
ArduinoIDE_Raspbian.jpg

Code: Select all

cd ~
wget https://downloads.arduino.cc/arduino-1.8.2-linuxarm.tar.xz
tar -xvf arduino-1.8.2-linuxarm.tar.xz
cd arduino-1.8.2
sudo ./install.sh
upon checking the Arduino site... the latest is version 1.8.10
so replace that version on the procedure above.
Thanks for this info I have been able to upgrade my version of the ide. Still not having any joy talking to the ardunios I am beginning to suspect the ftdi cable.
Thanks

LTolledo
Posts: 2405
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: Raspberry pi to Arduino pro mini using FTDI cable

Fri Jan 10, 2020 11:42 am

When almost the same thing happened to me....(arduino installation fail to open, communications disruptions [....can only mean one thing....])

take a new microSD card....
flash new raspbian install
update and upgrade
backup microSD card
install arduino IDE
test
if OK backup
then install other fave software
test
backup microSD card
.
.
.
.
.

and so on and so forth.

when I suspect the FTDI module /cable:
change to CP2102 or CH340 or even USBASP
if CP2102 or CH340 communications OK.... then FTDI module or cable fail.
actually I also have one FDTI module that did not work with RPi3B, but worked with RPi4B (USB2.0 port)... quite a mystery :shock: ...
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

hippy
Posts: 6498
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Raspberry pi to Arduino pro mini using FTDI cable

Fri Jan 10, 2020 12:29 pm

melcus wrote:
Fri Jan 10, 2020 11:25 am
Still not having any joy talking to the ardunios I am beginning to suspect the ftdi cable.
You should be able to disconnect the FTDI from the Arduino, loop-back TX to RX, then run a test to see if it is sending and receiving data.

You could use 'minicom' or something else. I have a Python program to check serial loop-back. You might have to change /dev/ttyUSB0 to match your FTDI port at the end of the code -

Code: Select all

#!/bin/usr/python2

import serial
import threading
import time

comPort = None

def TransmitThread():
  while comPort:
    for n in range(ord("A"),ord("Z")+1):
      if comPort:
        comPort.write(chr(n))
        time.sleep(1)

def ReceiveThread():
  while comPort:
    if comPort.inWaiting() > 0:
      n = comPort.read(1)
      print( n )
    else:
      time.sleep(0.1)

def LoopbackTest(comPortName, comBaudRate):
  global comPort

  comPort = serial.Serial \
            (
              port=comPortName,
              baudrate=comBaudRate,
              parity=serial.PARITY_NONE,
              stopbits=serial.STOPBITS_ONE,
              bytesize=serial.EIGHTBITS
            )

  threading.Thread(target=TransmitThread).start()
  threading.Thread(target=ReceiveThread).start()

  try:
    while True:
      time.sleep(1)
  except KeyboardInterrupt:
    print("")
  finally:
    comPort = None

if __name__ == "__main__":
  LoopbackTest("/dev/ttyUSB0", 9600)

melcus
Posts: 4
Joined: Wed Jan 09, 2013 7:38 am

Re: Raspberry pi to Arduino pro mini using FTDI cable

Tue Jan 14, 2020 4:38 pm

You should be able to disconnect the FTDI from the Arduino, loop-back TX to RX, then run a test to see if it is sending and receiving data.

You could use 'minicom' or something else. I have a Python program to check serial loop-back. You might have to change /dev/ttyUSB0 to match your FTDI port at the end of the code -

Thanks for the loopback code, I tried it and it looks like my cable is working fine, I watched A,B,C... scroll down the screen without an issue, not really sure what to try now, I believe I have fixed my arduino IDE software, I know my cable is working but the arduinos still won't talk to me :( :(

hippy
Posts: 6498
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Raspberry pi to Arduino pro mini using FTDI cable

Tue Jan 14, 2020 10:04 pm

melcus wrote:
Tue Jan 14, 2020 4:38 pm
Thanks for the loopback code, I tried it and it looks like my cable is working fine, I watched A,B,C... scroll down the screen without an issue, not really sure what to try now, I believe I have fixed my arduino IDE software, I know my cable is working but the arduinos still won't talk to me :( :(
Yes, that would seem to prove the cable is fine; A, B, C exactly as expected. Four possibilities I can think of -

The Arduinos are not working. Is there any 'program' button needs to be pressed or link which needs to be set ?

TX/RX are crossed over, or some header link isn't set right, a 0V connection is missing.

Some Pi/IDE/FTDI setting is preventing things from working, such as wait for CTS to be signalled when it never will.

You have the wrong program downloader selected, some mismatch with what the Arduino has, so it's never seeing what it expects to see. Is there even a bootloader in the Arduino ?

I am not familiar with Arduino programming via serial. Maybe try avr-dude or whatever to see if you can get something from the Arduino at the command line.

I would get the Arduino programmed on something other than a Pi. Have it output a character once a second, and echo back anything received. Test that on the something else, then try with a Pi, see if you can receive what the Arduino sends out, that it does echo back what is sent. The loop-back code should be usable for testing that.

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

Re: Raspberry pi to Arduino pro mini using FTDI cable

Tue Jan 14, 2020 10:54 pm

hippy wrote:
Tue Jan 14, 2020 10:04 pm
You have the wrong program downloader selected, some mismatch with what the Arduino has, so it's never seeing what it expects to see. Is there even a bootloader in the Arduino ?
Oh yes, they do. It's a very small programme that allows the system to be updated from serial. As supplied, ICSP is about the only way to do it.

Talking of bootloaders, I've had that sync error with some boards (mostly Arduino Nano clones). Seems there's an old version of the bootloader code, and you have to set the uploader to something like "ATMega328 16 MHz (Old bootloader)" for it to work. You'll probably want to flash the new bootloader at some point.

I'd also recommend the OP to upgrade the ancient Arduino version that comes with the system. It's almost useless.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

hippy
Posts: 6498
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Raspberry pi to Arduino pro mini using FTDI cable

Wed Jan 15, 2020 4:01 pm

scruss wrote:
Tue Jan 14, 2020 10:54 pm
hippy wrote:
Tue Jan 14, 2020 10:04 pm
Is there even a bootloader in the Arduino ?
Oh yes, they do. It's a very small programme that allows the system to be updated from serial. As supplied, ICSP is about the only way to do it.
Sorry I wasn't clear; I was meaning is it actually installed and present, that what the OP has isn't just a bare or erased Atmel Chip with the bootloader having not been flashed. Not being present could explain a "no response" error.

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

Re: Raspberry pi to Arduino pro mini using FTDI cable

Wed Jan 15, 2020 4:11 pm

Fair enough. It's fairly unlikely to have no bootloader at all, but having the old bootloader has much the same effect. Many of the super cheap Arduino Nano clones still use the old bootloader. I picked up four or five that a local hobbyist was throwing out and the only problem was that they had the old code. Yay, free Arduinage!
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

melcus
Posts: 4
Joined: Wed Jan 09, 2013 7:38 am

Re: Raspberry pi to Arduino pro mini using FTDI cable

Thu Jan 16, 2020 11:26 am

scruss wrote:
Tue Jan 14, 2020 10:54 pm
hippy wrote:
Tue Jan 14, 2020 10:04 pm
You have the wrong program downloader selected, some mismatch with what the Arduino has, so it's never seeing what it expects to see. Is there even a bootloader in the Arduino ?
Oh yes, they do. It's a very small programme that allows the system to be updated from serial. As supplied, ICSP is about the only way to do it.

Talking of bootloaders, I've had that sync error with some boards (mostly Arduino Nano clones). Seems there's an old version of the bootloader code, and you have to set the uploader to something like "ATMega328 16 MHz (Old bootloader)" for it to work. You'll probably want to flash the new bootloader at some point.

I'd also recommend the OP to upgrade the ancient Arduino version that comes with the system. It's almost useless.
Hi,
Thanks for this info, but it does raise a couple of other questions for me.
Setting the uploader to "ATMega328 16 MHz (Old bootloader)" when I read that it did seem familiar but I can't find it in the Arduino IDE I have version 1.8.10 installed should I install an older version maybe?

Secondly flash a new bootloader, how would I do that?

Thanks

LTolledo
Posts: 2405
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: Raspberry pi to Arduino pro mini using FTDI cable

Thu Jan 16, 2020 12:45 pm

If you're not seeing this on your Arduino IDE then your IDE version is wrong..
InstallingArduinoBootloader_Burn_Bootloader_Arduino_IDE_ArduinoasISP.jpg
InstallingArduinoBootloader_Burn_Bootloader_Arduino_IDE_ArduinoasISP.jpg (78.84 KiB) Viewed 71 times

I just checked the Arduino IDE 1.8.10 on my RPi4B-4G desktop.... the "Burn Bootloader" menu item is there.
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

hippy
Posts: 6498
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Raspberry pi to Arduino pro mini using FTDI cable

Thu Jan 16, 2020 1:05 pm

melcus wrote:
Thu Jan 16, 2020 11:26 am
Setting the uploader to "ATMega328 16 MHz (Old bootloader)" when I read that it did seem familiar but I can't find it in the Arduino IDE I have version 1.8.10 installed
Unfortunately I don't seem able to get a screenshot from my Pi with the menus open but ...

For 1.8.10, clicking Tools, the drop-down shows for me, about halfway down -

Board: "Arduino Nano"
Processor: "ATMega328P"

Clicking on the Processor option brings up a selection -

ATMega328P
ATMega328P (Old Bootloader)
ATMega168

I'm guessing doing similar is how you would select for what you have. But I must admit Old Bootloader options didn't seem to be available for "Mini" or "Pro or Pro Mini". That many be "Nano" specific.

I am out of my depth here, but it might be worth seeing if you can program using "Nano" and "Old Bootloader" option. I would contact the Arduino forum as well, ask them what option it should be if no one here has an answer. Though from what I can tell there is no Old Bootloader option mentioned for Pro Mini -

https://www.arduino.cc/en/Guide/ArduinoProMini

Added : Actually; "For the 5V versions of the Arduino Pro Mini, select Arduino Duemilanove or Nano w/ ATmega328P or Arduino Diecimila, Duemilanove, or Nano w/ ATmega168". So selecting "Nano" and "Old Bootloader" as suggested above may be the course to take

If that doesn't work I would be tempted to work my way through all board types and options and see if anything works. But nothing will if there is a wiring or board fault. I would still suggest checking the board, wiring and programming works from a PC to rule that out.

For flashing new firmware on a device with serial interface I believe you need an ICSP programmer as noted earlier. I don't believe you can do that with just with a serial connection, but I might be wrong. You would probably have to be able to download over serial anyway to do that if it is possible.

Return to “Advanced users”