Jump to content

Recommended Posts

Geschrieben

Dear List

I have a strange behavior by the communication between a RS-232 bricklet and an Arduino (TTL-based communication). The communication is only one-way (using only one wire between TX of the bricklet and the RX of the Arduino.

The information sent is a simple ASCII-string terminated with an "\r\n".

The application on the TF-side is written in C#.

Using the setting

  • BrickletRS232V2.FLOWCONTROL_OFF

the communication only works, if the C#-application is stopped by a debugger-stop and launched again. As soon as the C#-application runs normally (without debugger-stop), the communication is not successfully on the Arduino-side. The code sending the message over the TTL-connection runs in a background-worker-thread. And an additional sleep of the calling thread is not solving the problem (the assumption was, to simulate the debugger-stop.

Using the settings

  • BrickletRS232V2.FLOWCONTROL_HARDWARE and rickletRS232V2.FLOWCONTROL_SOFTWARE

lets running the data-exchange, but the data are not received correctly.

Question:

  • Does anyone has an idea, what could cause this kind of behavior?
  • Do I have to implement a two-way-communication to get it running?
  • Is FLOWCONTROL a good starting-point for any further research to solve the problem?

Looking forward to any ideas and thoughts.

Cheers,

Yvo

Geschrieben

If you only have TX connected then hardware flowcontrol does nothing, as it needs extra pins connected. With software flowcontrol you also need to turn that on on the Arduino side.

Maybe you're sending the data faster than the Bricklet can transfer it or the Arduino can handle it.

What's the baudrate? How big is the data you send? How long does the Arduino take to handle the data?

Maybe simplify your C# program to just do a single write and make sure that works.

Geschrieben

Dear photron

Thank you very much for the fast replays and the suggestions.

Currently I am using a baudrate of 9600 and the data I am sending are rather small:

  • "123.444;-999.99;-999.99;2199.456;2076.765;-999.99;-999.99;-999.99\r\n"

The values of -999.99 are for further use and eventually replaced later by smaller numerical values similar to the other ones. Each dataset can be sent once every 500msec.

In a simplified C#-application, the approach works. Based on this experience, I implemented it into the main application using a loop sending data constantly instead of once and then the application stops.

The strange thing is, that using a debug-stop allows the Arduino doing the work. But not a paused thread on the side of the C#-application.

Almost 20 years ago, I had to trigger system-calls within C#-applications by a specific system call. As I remember, this call allowed the system to get the internal jobs done. No idea, if this is a similar problem ... and no idea anymore, how we triggered this call then.

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

×   Du hast formatierten Text eingefügt.   Formatierung jetzt entfernen

  Only 75 emoji are allowed.

×   Dein Link wurde automatisch eingebettet.   Einbetten rückgängig machen und als Link darstellen

×   Dein vorheriger Inhalt wurde wiederhergestellt.   Clear editor

×   Du kannst Bilder nicht direkt einfügen. Lade Bilder hoch oder lade sie von einer URL.

×
×
  • Neu erstellen...