SDC2130 TTL TX/RX not working with Arduino SoftwareSerial

6 years 5 months ago - 6 years 5 months ago #29528773 by richwill
>> - mismatched baud rate. Since communication works partially, the rate looks ok, but if one of the two is not exactly 115200, this may cause the issue
>> - mismatched setting. We need 8-bit, no parity, one stop bit, no flow control
>> - floating ground. Make sure that a ground wire goes from the ground pin on the 15-pin DSub, to the Arduino ground. Do not depend on the main ground wire on the controller's terminal strip as a ground return.

I verified all these are correct. Still get the same garbled results. I have a theory that the Arduino Uno SoftwareSerial implementation isn't able to cleanly run at 115200.

I just trued another approach: using the SDC2130 TTL TX/RX pins and the hardware serial port from an Arduino Mega 2560. Success! Works like a charm. No inverter needed, no level shifters. Plug and play! I'm going this route, the Mega has 4 hardware serial ports I can use to control my two SDC2130s.

So, I think the take home here is that the SDC2130 cannot be reliably controlled via ->SoftwareSerial<- from an Arduino Uno. Probably good to keep that in mind for the future.

Please Log in or Create an account to join the conversation.

6 years 5 months ago #29528815 by Griffin Baker
So we ended up picking up an Arduino Uno. I have no idea just yet how to set this up other than a run a few setups as instructed by the Second edition "30 Arduino Projects for the Evil Genius" book.

This will be a learning experiment of ours to help with Arduino related questions in the future.

At best what I can do right now is to wire this up to the SDC21xx controller, but in terms of communicating to i, I'll have to figure out. I've opened up the serial monitor to send in ?fid, but nothing showed up in the box, it is clearly evident I didn't set up the code to read the serial line.

Please Log in or Create an account to join the conversation.

6 years 4 months ago - 6 years 4 months ago #29528862 by Griffin Baker
We are still working out the kinks in our coding with an MDC2260 RS232 lines. I'm also using the Arduino Uno with an inverter applied.
The Arduino pin 1 Tx goes into the inverter, and the inverted signal goes to the Rx of controller, and the Tx of controller goes into the inverter input and the inverted signal then goes to the Rx of the Arduino.

So far we managed to get some of the data from the controller back without asking for the ?FID. Unfortunately it seems to be random depending on our delay time we set.

Here so far is the code we have used to get this much.

I've also attached a screenshot of the results.

We found that we had to clear the buffer history as it would fill up. At the moment we are trying to see what the Arduino is getting back from the controller. And we are hoping to get the full fid string that normally gets reported back in the Roborun+ utility.

The attached results are from power cycling the controller every so often to see if new data would populate.

Code:

char Rdata[127]; //Read data
int L = 0; // length
int i = 0; // count

void setup() {
Serial.begin(115200);
//Serial.write("?fid");
Serial.println("");
}
//++++++++++++++++++++++++++++

void loop() {
delay(75);
L = Serial.available() ;
if (L > 0); {
for (i = 0; i < L; i++) {
Rdata = Serial.read();
}
}
Serial.print("Received: ");
Serial.println(Rdata);
//delay(1);
//++++++++++++++++++++++++++++
int num;
while(1)
{
num = Serial.available();
if (num == 0)
{
break;
}
else
{
Serial.read();
}
}
//+++++++++++++++++++++++++++++
}

Perhaps you wouldn't mind sharing the code you are using?
Attachments:

Please Log in or Create an account to join the conversation.

Moderators: tonysantoni
Time to create page: 0.092 seconds