Trouble reading from RS232 device

I’m trying to troubleshoot an RS232 connection via Serial1 and don’t really know where to start. If I connect to the device via an RS232-USBC converter to my MBP and use screen (screen /dev/xxx 38400), everything works great. However, when I connect a SparkFun RS232-TTL adapter to my photon and try with the code below, I get nothing. Where can I begin to debug?

Code Example

void setup(){
    // set up serial comms over the USB for debugging
    Serial.begin(9600);

    // set up serial1 for RS232 comms
    Serial1.begin(38400);
}

void loop(){
    Serial.println(Serial1.available());
}

Obviously, this shouldn’t accomplish much, but it would be nice to see that there are bytes to read…

Have you tried swapping RX/TX?
Do you see any activity on the RX or TX LEDs?

1 Like

Yes - tried switching RX/TX, and no, the LED’s don’t ever light up! I’ve got a Logic Analyzer I can bust out, but not sure what that’s going to tell me since it appears nothing is happening…

What if you send data from the Photon, does the TX LED then light up?
Also, do you know whether your RS232 device may require flow control?

Yes…I do see some lights flash if I send commands from the photon…why wouldn’t it be able to receive data…?

Try a simple passthrough app:

void setup(){
    // set up serial comms over the USB for debugging
    Serial.begin(9600);

    // set up serial1 for RS232 comms
    Serial1.begin(38400);
}

void loop() {
	uint8_t byte;

	if (Serial1.available()) {
		byte = Serial1.read();
		Serial.write(byte);
	}
	if (Serial.available()) {
		byte = Serial.read();
		Serial1.write(byte);
	}
}

Maybe it’s not that the Photon can’t receive data, but …

… in order to actually send data.

Ahh didn’t see the flow control part - I will go look that up in the manual. Would the screen command work if it required flow control?

If you can disable flow control on the target side, then do that.
Otherwise it depends what kind of flow control is used in order to know how to emulate/circumvent/mimik it.

There may also be hardware flow control which would necessitate the use of a null modem adapter or cable.

According to the manual (below), there is no flow control. Are there any other things I can check/be aware of?

34%20PM

Is there a way to determine whether hardware flow control is enabled? I used a standard Tripp Lite DB9-USBC cable to easily interact with the device from my Macbook Pro…

Any other common things I should look into?