Serial port asynchronous reading

More
1 year 2 months ago #334027 by ts
Hi.
i need to read every 100 millisec some values from rs232. (Old equipment and i haven't source) and during work have to change this values. Also with this values i switch to working state equipment. I understand command which i have to send and to read.

And now i see only solution when i write all commands on the arduino-like board for connecting with target board, and for upper lever (linuxcnc) via mobdus (arduino as slave). But im trying to find more simple solution with only linuxcnc.

how to do this elegance)?

Regards
 

Please Log in to join the conversation.

More
1 year 2 months ago #334035 by andypugh
Does your system have a Mesa card? If it does then you could look at using a Mesa UART.

Otherwise it ought to be possible to use the onboard serial port, but for some reason I haven't seen anyone do that through HAL in realtime.

In theory you ought to be able to do it with inb and outb commands:
stackoverflow.com/questions/47048726/bau...-outb-commands-linux
(note that the advice there is "don't" but they are not considering realtime limitations)

There is an existing hal component that uses the serial port status lines for GPIO
github.com/LinuxCNC/linuxcnc/blob/master...drivers/serport.comp
which it might be possible to tweak. But the fact that nobody seems to makes me wonder if it is impossible for some reason?

Please Log in to join the conversation.

More
1 year 2 months ago #334036 by ts
Replied by ts on topic Serial port asynchronous reading
Andypugh, Thanks for reply!

I didn't use mesa board. I think about ehtercat + rs232 , this is more simple for me (ethercat modules avaible from stock, but mesa is not available). But of course best way to use onboard rs232 to sending and receiving data.

About realtime -This is not critical , because speed is 19200, so i dont need realtime.

I will read links more detailed this evening.
And may be there are some another way if no needed realtime.

Please Log in to join the conversation.

More
1 year 2 months ago #334041 by PCW
Since it's not realtime, you should be able to make a simple (python?) userspace
hal component using the kernels serial driver.

Please Log in to join the conversation.

More
1 year 2 months ago #334054 by ts
Replied by ts on topic Serial port asynchronous reading
PCW, thanks for your reply!

Is there any example for this solution with userspace hal component?

Please Log in to join the conversation.

More
1 year 2 months ago #334059 by PCW
There's an old thread here that may give some ideas:

forum.linuxcnc.org/24-hal-components/280...n-cleanup-using-comp

Please Log in to join the conversation.

Time to create page: 0.147 seconds
Powered by Kunena Forum