Tuesday, February 25, 2020

Using Fast Opto-Isolated Serial Interface Mode in the FT2232H with CYC1000 FPGA and libftdi1

After learning more about FPGA programming i.e verilog, nmigen, migen, and generating test benches finally got back on finishing the Avalon bus for the quad-copter.

The core gateware is Avalon bus with slave PWM (oneshot125), DSHOT150, slave LED APA102, slave on board LED, slave PWM decoder, and general timer.  The master is using Avalon bus master  bytes to packet interface over Fast Opt-Ioslated Serial interface.  One of the issues I was having was how to communicate from Linux to the CYC1000 board, could do standard serial, the top speed is 2Mbps, so, took the time and implemented Opt-Isolated serial interface at 25Mbps.  Reading more about the interface it is half duplex, but, it is still faster than serial.

So, use the standard FTDI driver with Linux with standard tty termios, but after trying to get 1ms round trip packet processing, the CPU usage was high and still slow.  I tried setting  setserial /dev/ttyUSB0 low_latency, that helped but still high CPU usage.

Next was trying libftdi1, with a latency timer of 0.  After a few few mod's to libftdi1, using a 100us timer to generate packets and uses 40% CPU usage.  Validated the data stream using LA2016 Logic Analyzer and the rrt is 180us.  So, not bad. Next is to move everything on to the orangePI plus2 H5.




No comments:

Post a Comment