linux device driver - Reading multi-channel serial usb in pure data -
i have multichannel serial data 8 channel adc chip i'm connecting computer via serial-usb cable. want use these separate channels in pure data, pd_comport object doesn't read multi-channel serial data. i've scoured pd discussion fora there's no mention of how this. thoughts on how can go it?
per definition serial connection single-channel. if have multiple (synchronized) channels, it's called parallel.
so problem 1 of 2 following:
parallel serial streams
if transmitting 8 adc-channels via different serial connections, (special) cable should register 8 different devices (e.g. /dev/ttyusb5
, /dev/ttyusb6
, .../dev/ttyusb12
). in case, use multiple [comport]
objects (one each serial device want interface)
single multiplex stream
in (more likely) case, adc transmits it's 8 channels in single serial connection multiplexing data, have demultiplex serial stream yourself. how this, depending on actual format of data.
assuming adcs 8bit , have 4 channels (for simplicity), might receive serial stream like: ... a1 b1 c1 d1 a2 b2 c2 d2 a3 b3 ....
(with a, b,... being samples 4 channels; , 1,2,... being sample frames), demultiplex signal 4 streams like
| [t b f] | | | +------------+ | [i ]/[+ 1]/[% 4]/ | | | [pack 0 0] | [route 0 1 2 3] | | | |
in practice protocol might different (e.g. there ought way specify frame boundaries (there's no way looking @ numbers, whether seeing a1 b1 c1 d1 a2 b2
or b1 c1 d1 a2 b2 c2
, it's unclear whether 1st sample belongs channela or channelb).
thus must hands on protocol definition , interpret data [comport]