This is a summary and conclusion of using a NI6259 with Xenomai/Analogy for digital data I/O. First of all, many thanks to Alexis whose Analogy branch really allowed us to succeed! We would just like share the final results of our implementation with the hope that this might help others.
Goals: We needed a 19 bit parallel I/O for bi-directional communication between a host computer and a robot controller. The 32bit DIO of the NI6259 seemed to well suited. The communication protocol needs about 300 DIO commands per ms, where every about 20 commands the DIO port needs to switch from write to read and then back. Problems: Initially we tried a4l_sync_dio() (synchronous communication). We measured that one a4l_sync_dio() takes about 5us. Additionally, the switch from read to write mode also seems to take some additional time. Thus, the communication speed was not sufficient. A 2nd attempt was to use instructions and instruction lists using a4l_snd_insnlist() and a4l_snd_insn(). We measure that this can bring down one data acquisition to about 3.5us when all commands are queued up in an instruction list, but due to the read/write switch we needed, we cannot use very long instruction lists, and the read/write switch takes too long. Thus, the communication speed did not improve a lot. A 3rd attempt was to use CMD structures. Following comedi examples, we create a 200ns clock and triggered the CMD streaming with this clock. This allows VERY fast DIO. But, again, the read/write switches that are needed frequently made CMD structures inefficient as we could not cue up a lot of DIO commands before the next read/write switch, and in order to do the read/write switch, the CMD has to be aborted. We also noted that starting a CMD has some delays. We realized that none of these approaches was feasible. Solution: We create a simple IC-based circuit that allowed to branch the read/write DIO protocol such that we could use one DIO channel of the NI6259 for write only (never switched to read), and the 2nd DIO channel on the NI6259 for read only (no switching). By avoiding the read/write switching, all three ideas from above are possible and run fast enough (after some optimization of our communication protocol). We ended up using a4l_sync_dio() as it is the easiest to use, and yielded sufficient speed. With the CMD approach, we would be able to go a factor 5-10 faster even. For you info, our interface C-code is attached. This is not general purpose software, but should allow other to get the idea of what we do. Best wishes, and thanks again to Alexis! -Stefan
ni6259_interface.c
Description: Binary data
_______________________________________________ Xenomai-core mailing list Xenomai-core@gna.org https://mail.gna.org/listinfo/xenomai-core