****************************** * Hifive stuff ****************************** https://www.sifive.com/boards ****************************** It seems that libftdi is best documented in : file:///usr/share/doc/libftdi-dev/html/ftdi_8c.html The main functions we need See : https://www.huitsing.nl/irftdi/test2.c struct ftdi_context ftdic; ftdi_init(&ftdic); ****************************** * 03/28/2019 ****************************** Some simple programs to use libftdi can be found in : /usr/share/doc/libftdi-dev/examples Notice that when you plug an ftdi board into the USB, using FT_Prog, or just looking at the virtual machine Devices-->USB you can hover over the FTDI device, and see the VendorID=0403 and ProductID=6001 If you now copy simple.c and compile it as : ----- gcc simple.c -lftdi a.out greg@carbox:~/ftdiWork$ a.out ftdi_read_chipid: 0 FTDI chipid: 6B863D57 ------ Now compiling gcc baud_test.c -lftdi greg@carbox:~/ftdiWork$ a.out -p "i:0x0403:0x6001" -d 32768 -b 153600 -m r real baudrate used: 153600 this test should take 2.13 seconds and took 2.1686 seconds, this is 151101 baud or factor 0.984 greg@carbox:~/ftdiWork$ a.out -p "i:0x0403:0x6001" -d 32768 -b 9600 -m r real baudrate used: 9600 this test should take 34.13 seconds and took 33.9997 seconds, this is 9638 baud or factor 1.004 Good overview of serial port : https://www.mathworks.com/help/instrument/serial-port-overview.html Excellent article : https://www.swharden.com/wp/2018-06-03-bit-bang-ftdi-usb-to-serial-converters-to-drive-spi-devices/ (beware of FT232R in bit bang mode. Use FT232H) Check out minicom - https://medium.com/@amitasinghchauhan/serial-port-debugging-101-loopback-test-4a7e40da9055 Start it with minicom -s Turn flow control off Then hook to /dev/ttyUSB0 * ********************************************************************* After all of this, you can run python without being sudo : greg@carbox:~/pwork$ python -m pylibftdi.examples.list_devices FTDI:FT232R USB UART:AK06VDT0 greg@carbox:~/pwork$ * ********************************************************************* See this webpage for info on standard debian groups https://wiki.debian.org/SystemGroups sudo adduser greg dialout groups greg@carbox:~/pwork$ lsusb Bus 001 Device 003: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 002: ID 80ee:0021 VirtualBox USB Tablet Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub greg@carbox:~/pwork$ sudo python -m pylibftdi.examples.list_devices FTDI:FT232R USB UART:AK06VDT0 greg@carbox:~/pwork$ sudo vim /etc/udev/rules.d/99-libftdi.rules greg@carbox:~/pwork$ cat /etc/udev/rules.d/99-libftdi.rules SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", GROUP="dialout", MODE="0660" SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6014", GROUP="dialout", MODE="0660" https://pylibftdi.readthedocs.io/en/0.15.0/installation.html#linux sudo apt install python-pip pip install pylibftdi sudo apt-get install libftdi-dev sudo python -m pylibftdi.examples.list_devices Need to fix permission problem Also, note, you must enable the device in the virtual machine in the Devices Tab at the top http://physics.oregonstate.edu/~hetheriw/whiki/py/sys/21.php I have the FTDI FT232R Hopefully I can get it to work with python