Jump to content
OMRON Forums

Using serial port from capp...


KEJR

Recommended Posts

Hello, I'm planning on communicating to a RS-232 panel meter from within my custom C application. Are there any concerns with using the standard linux filesystem open/read/write calls from within a xenomai RTOS thread? I could have a non RTOS communications thread but it would be simpler and cleaner to embed the serial port query from within my main RTOS thread. Thank you, ~KEJR
Link to comment
Share on other sites

  • 2 years later...
  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

KEJR, I can verify that read/write calls result in a primary to secondary mode switch for Xenomai threads. Whether or not that will cause a problem for your thread depends on your determinism requirements. If you require low jitter, try mmap'ing /dev/ttyS* and then use memory operations instead of read/write. This would only result in one mode switch (the initial mmap).
Link to comment
Share on other sites

I did get the USB serial port working and am using it on a machine in production. I think at the time I ended up talking to someone at Delta Tau and ultimately Henry Bausley built a special kernel for me that included the common USB-RS232 drivers into the kernel. I would think that by now the latest kernel would have this by default. I like the FTDI based USB-232 converters but at the time I bought a TrendNet TU-S9 adapter which uses one of the prolific chips and have not had any issues. I can certainly post some code. It took me a little time to piece it together into something that would be a nice library function. I can't guarantee its perfect, but it worked for me. I have a function to open a serial port connection, and another to read in a terminated line (with timeout). I use the readline function alot for industrial devices since it is common to write a command to the serial port and then wait for a response from a device. As far as the RTOS part of it, I didn't have any speed issues or any surprises in my application. It just worked surprisingly well. Frankly I wouldn't advise trying to do anything that needed to be deterministic with the serial ports. Charles: I'm going to send you an email off list to talk about the code I have and what to do with it. KEJR
Link to comment
Share on other sites

[quote='KEJR' pid='4728' dateline='1363975327'] I did get the USB serial port working and am using it on a machine in production. I think at the time I ended up talking to someone at Delta Tau and ultimately Henry Bausley built a special kernel for me that included the common USB-RS232 drivers into the kernel. I would think that by now the latest kernel would have this by default. I like the FTDI based USB-232 converters but at the time I bought a TrendNet TU-S9 adapter which uses one of the prolific chips and have not had any issues. I can certainly post some code. It took me a little time to piece it together into something that would be a nice library function. I can't guarantee its perfect, but it worked for me. I have a function to open a serial port connection, and another to read in a terminated line (with timeout). I use the readline function alot for industrial devices since it is common to write a command to the serial port and then wait for a response from a device. As far as the RTOS part of it, I didn't have any speed issues or any surprises in my application. It just worked surprisingly well. Frankly I wouldn't advise trying to do anything that needed to be deterministic with the serial ports. Charles: I'm going to send you an email off list to talk about the code I have and what to do with it. KEJR [/quote] RS232 support is indeed incorporated in the kernel that ships with the latest release firmware. If you want to see what options the kernel is compiled with issue this command from the IDE terminal system gzip -d --stdout /proc/config.gz Part of the output will be: CONFIG_USB_SERIAL=y CONFIG_USB_SERIAL_CONSOLE=y # CONFIG_USB_EZUSB is not set CONFIG_USB_SERIAL_GENERIC=y # CONFIG_USB_SERIAL_AIRCABLE is not set # CONFIG_USB_SERIAL_ARK3116 is not set CONFIG_USB_SERIAL_BELKIN=y # CONFIG_USB_SERIAL_CH341 is not set . . . # CONFIG_USB_SERIAL_NAVMAN is not set CONFIG_USB_SERIAL_PL2303=y
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

×
×
  • Create New...