Howdy all. I've got some external serial boards talking on an rs485 bus (all in a Linux environment.) Those boards have all kinds of functionality, but some of it maps to analog and digital inputs, along with analog and digital outputs. I've done work before grabbing that info from user space via standard serial port open/read/write/close and making it available via sysfs for consumption. I'm thinking it might be "better" to use the libiio framework instead of the more brute force (and more proprietary) way. I've looked around and seen mention of the uart backend for libiio (via iiod I guess.) There was also mention of tinyiiod, which might be another route. I guess my main question is what is the best way to do this as far as interfacing to a standard Linux serial port via the iio framework?
libiio allows you to connect to remote devices using it's backends. Currently supported backends are Network IP, USB and Serial.
You can use tinyiiod on a small microcontroller hand have your desktop libiio to create a context from the remote serial device.
All you need to do is create a XML context structure, describing the devices attributes and channels. And then provide callback OPS which can handle it.
Please see here:
Some more complex example can be found here:
Thanks Michael...I'll take a look. I did see some spi examples, but this communication is via very slow rs485 serial (9600 baud), so I figured required something a bit different. I won't be able to use tinyiiod on the remote devices, as those are really just dumbish boards that reply to rs485 requests.
Maybe a way to go is to get something running in user space that handles the read/write to the rs485 serial device (those are slow boards.) That code can provide some callbacks and take direction via the xml structures. Cached readings can then be provided for specifically what is necessary. Any code like that laying around? ;-)
daveoman said:Any code like that laying around?
No - and I'm also not sure what it will get you.
Ok...thanks for all of the info.