Search code examples
serial-portarduinousbarduino-unoftdi

Interfacing a USB/serial device with Arduino USB/serial interface


On one side I have a device with a USB (FTDI chip) interface communicating in serial 9600bps,N,8,1 - the default configuration for the Arduino USB/serial interface. On the other side I have a simple Arduino sketch that starts a serial session and transmits data.

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600,SERIAL_8N1);
}

void loop() {
  // put your main code here, to run repeatedly: 
  char* data_to_send="66"; 
  SSEND(data_to_send);
  delay(5000);
}

String SSEND(char* data){
  String protocol="AT$SF=";
  protocol+=(String)data;
//  protocol+="\r";
  Serial.println(String(protocol));
  delay(1000);
  return "OK";
}

The sketch works just fine when connected to the computer. Then I try to connect to the device and I see the Tx LED that stops blinking so it doesn't send anything and of course the device doesn't work like expected. Besides, I tried sending serial commands directly from the computer to the device and it works just fine.

So my questions are:

  • Why does the serial interface between Arduino and my device doesn't work?
  • Why does Arduino stop sending data once the USB/serial interface switched from the computer to the device
  • What would be the solution to make the device work with the Arduino?
  • Should I switch the TX & RX with a splitted FTDI cable plugged to port 0 and 1?

Thanks for your help

Picture of the connection


Solution

  • I suspect that device is a USB device and not a USB host, and you plugged two USB devices together. That Arduino is not a USB host, and a USB connection always needs a host.

    The plug adapter you're using is not even supposed to exist according to the USB spec, because the different shapes of plugs are specifically there to make it impossible to plug two devices into each other like you've done here.

    The way to make it work would be to use another board that actually supports acting as a USB host.