I am currently trying to connect my smartfusion to my Mac computer. I have hooked up an FTDI chip to the SmartFusion and connected it via USB to my computer. I was under the impression that I could just open a file descriptor in the /dev
directory and read and write to it to send messages. Is this not the case? I have tried going into the /dev
directory but I cannot seem to be able to execute cat
on either of the devices that have the string usb
in them. I get garbage when I execute cat
on one of them and get nothing on the other.
I tried using screen with the following command
screen <name_with_usb in /dev> 9600
but that outputted garbage as well
I have also tried to write the following C++ program that uses the FTDI drivers to try and open a connection with the FTDI chip. I installed these drivers using the command below
brew install libftdi
And this is the program
#include <iostream>
#include <ftdi.h>
using namespace std;
int main() {
struct ftdi_context ftdi;
ftdi_init(&ftdi);
if (ftdi_usb_open(&ftdi, 0x0403, 0x6001) < 0) {
cerr << "Can't open FTDI device\n";
return -1;
}
cout << "Hello World" << endl;
return 0;
}
Compiled with the following command
g++ -std=c++14 -I /usr/local/Cellar/libftdi/1.2/include/libftdi1/ -L /usr/local/Cellar/libftdi/1.2/lib/ -l ftdi1 reader_test.cpp -o reader
NOTE I am constantly sending strings over UART to the FTDI chip that is connected to my laptop.
If someone has any suggestion that could be helpful I would be really grateful! I require this as soon as possible!