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…
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…
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);
}
}
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.
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…