I am attempting to interface between a device with a UART to USB FTDI230R IC - and a USB type B socket.
I am using a FTDI232 module connected to Serial1 (TX, RX) pins on a photon.
I can talk to the device if I connect a USB lead to a Mac and use SerialTools to open a serial port - usbserial-DJ008HDU at 115200 baud 8N1. When I connect the CTS mimic lights on the SerialTools - not sure if this is significant - I can type in commands and get responses.
When I try to get the photon talking I am getting nothing on the Serial1:
TX Photon connected to RX on module
RX Photon connected to TX on module
Photo of setup:
#define RXBUFLEN 2000
while (!Serial.available()) delay(100);
Serial.println("Test USB charger API Driver");
Serial.println("Serial1 started 115200 baud 8N1");
int to = 0;
while (!Serial1.available() && to < 10)
Serial.println("Serial1 not available");
Serial.println("Serial1 available for write");
Serial1.flush(); //wait until all buffer sent
int i = 0;
Serial.println("Serial1 available for read");
rxBuff[i++] = (char) Serial1.read();
rxBuff[i] = '\0'; //terminate as string
Serial.printlnf("Response: %s", rxBuff);
Serial.println("Serial1 not available for write");
Any suggestions as to what I doing wrong or could try out welcomed.
What was your thinking about why this would work. I am wondering if it is the control of RTS and CTS pins on this module OR am I driving it the wrong way?
What is the exact type of your FTDI module?
You could try grounding the CTS pin on the module.
Not sure whether this module is meant to be wired as terminal device, so you could try to not cross RX/TX.
My thinking is that the simplest approach to discovering a problem is the best way.
@ScruffR I tried all options CTS to gnd and not, TX/RX swapped and not and still no reply. It could be that the FTDI232R is not compatible with the FTDI230R that is in the device I am attempting to connect to. I tried 3.3V option with supply from 3V3 pin. I then tried removing power from Photon to the FTDI module and CTS to GND and I got a Serial1.available() but not consistently - this turns out to be a cheap breadboard I think the baud rate must be wrong - Thanks for the ideas - seem to be making some progress.
Opening this thread again as I am back on it.
I bought a Sparkfun FT231X board and got precisely the same result - nothing.
I tried plugging the output from the FTDI232RL back into one of my mac’s USB ports - then I got a flash on the send LED on the UART to USB module and I received the command. CTS to GND and/or DTR to GND made no difference.
I plugged the FTDI232RL output back into the charger device but this time stopped waiting for Serial1.available and just write the command - there is no send LED flash - mostly when reading into the receive buffer I get hex FF occasionally [actually always when the 5V supply from the photon is removed] it mirrors back the command with the termination 0x0D .
The specification for the device mentions that it uses ANSI terminal emulation and at boot up sends a string of escape characters. Is there a way these should be handled?