Community
cancel
Showing results for 
Search instead for 
Did you mean: 
jbon1
Novice
1,770 Views

FTDI + mraa + radiolink comms

Hi all.

First of all I want to say that I've been reading a lot of messages related with my problem in this forum and others and trying all I saw in them, but it didn't work so I'm desperate so I'm trying to ask directly.

I'll try to explain the exact point where I am at this moment with the problem.

I'm trying to configure my intel edison in order to establish communications between two radiolink antennas via ftdi serial.

I have a code in c++ that is working perfectly in the same way but in a raspberry pi so I migrated it to the mraa library to be able to use it in the intel edison.

I establish comms correctly (I installed correctly FTDI drivers and mount the radiolink to ttyUSB0) but it seems that the messages don't arrive well. For example i send from edison the message: "REAL:2:4.44444:5.55555" it seems that the first message arrives ok, but then next messages arrive cut (for example: "EAL:4.4*********" where * are squares), and finally it seems to receive the same message that is send to the intel edison from the other pc.

Well, after a lot of debugging an tracing i have no idea of what is the reason of this behavior (remember same code works for rasPI, the only change is that in edison i'm usin lib mraa).

I had mraa v. 0.7XXX so I thought that it could be something related with the mraa lib, so I tried to update it but I can't, so I did this:

1. Flashed the intel edison to the last image from the official web (edison-iotdk-image-280915) with the flash tool --> OK

2. Tried to update mraa (https://software.intel.com/en-us/node/561722 IoT - Updating the MRAA I/O and UPM sensor libraries | Intel® Developer Zone) --> didn't work, finally I had to do "opkg install mraa" instead "opkg install libmraa0"

3. Install FTDI drivers with "opkg install kernel-module-ftdi-sio", fist attempt didn't work because apparently I hadn't enough space on my edison, so I removed the kernel-module-ftdi-sio, restarted the edison and tried it again --> apparently it worked OK

Now I'm trying to mount the radiolink, but the edison doesn't mount ttyUSB0 so I think I missed something.

Some clues:

dmesg | grep FTDI:

[ 211.995177] usb 1-1: Manufacturer: FTDI

[ 2586.998826] usb 1-1: Manufacturer: FTDI

lsusb:

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

Bus 001 Device 002: ID 0403:6015 Future Technology Devices International, Ltd Bridge(I2C/SPI/UART/FIFO)

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

In /dev I think i'ts mounting it as: usbmon1 and usbmon2

First of all, I need to be able to mount the ttyUSB0 and then I need to fix the communications (if it is not the mraa library).

Thank you very much!

0 Kudos
6 Replies
Carlos_M_Intel
Employee
110 Views

Hi juanB,

Are you setting the ttyUSB0 in your code with: dev = new mraa::Uart("/dev/ttyUSB0") or how are you setting it?

If you have the latest image correctly flashed you should have 0.8.0 MRAA version.

Run configure_edison --version, you should get as result 159.devkit

Check the MRAA version with: opkg list-installed mraa

Yes, in order to update it to the latest one (0.9.0) you have to run opkg install mraa

How did you mount the ttyUSB0 before, when you were receiving wrong data in the UART?

In order to see the ttyUSB0 device I suggest you to follow the instructions in http://alextgalileo.altervista.org/blog/install-kernel-from-repo-onto-edison-official-image/ How to install a kernel from my repo onto Edison with the official image; there are other makers that have been able to use this device after following that guide:

About the error while writing in the UART

Have you tried to check the signal with an oscilloscope or logic analyzer in order to see if there noise or another problem?

Are you using the Arduino Expansion Board or the Breakout Board?

Are you setting all the parameters correctly with the setMode and setFlowcontrol functions? I suggest you to check those functions. [http://iotdk.intel.com/docs/master/mraa/uart_8h.html# aa4550f55d2f6273c0652007c54b87599 MRAA - UART.h File Reference]

Are you disabling the timeout or changing it in order to see changes in the data?

Is this happening with all the data you try to read/write or is it happening only with strings?

Regards,

Charlie

jbon1
Novice
110 Views

Hi CMata, thanks for your answer.

- I set the ttyUSB0 the way you wrote (dev = new mraa::Uart("/dev/ttyUSB0") ) and I was able to establish connection between the two radiolink antennas, but the messages apparently didn't arrive well (now the edison does not mount the ttyUSB0 archive although I installed the FTDI drivers). This time I followed the instructions in this page, the same I did previously and it worked: https://scivision.co/using-usb-serial-ftdi-adapters-with-intel-edison/ Using USB-serial FTDI adapters with Intel Edison | SciVision

- I checked the version of the image --> 159.devkit so it's OK

- Also checked the mraa version --> you are right, it's 0.8.0, the 0.7.xxxx is the version of libmraa0

I'm going to read the links you copied.

About UART:

- I did'nt try an oscilloscope, if there is noise it must be at the tx of the edison, all the other hardware is correctly checked with other pc's and raspberry (radiolink antennas included).

- I'm using the mini breakout board

- the setmode and setflowcontrol are set the same way in both sides, so I think it's correct (8-n-1 in this case) and the baud rate it's correctly configured too.

- I'm not changing the timeout, how can i do that? Can you give me some example in order to se changes? The program transmits a lot of data every second. However, I tried to do a usleep y the Tx side to see if the rx side was overloaded, apparently it wasn't the problem.

- I send an array of 256 bytes (ascii 0-255, raw char data), then I transform it to a string in order to see it in the console.

Again, thank you for your help.

Carlos_M_Intel
Employee
110 Views

Hi juanB

Thanks for the information, I'm glad to know that you are able to see the ttyUSB0 now.

The latest MRAA version is the 0.9.0 you can try with that one too: http://iotdk.intel.com/repos/2.0/intelgalactic/ http://iotdk.intel.com/repos/2.0/intelgalactic/

In order to work with the timeout, take a look at: http://iotdk.intel.com/docs/master/mraa/uart_8h.html# aa4550f55d2f6273c0652007c54b87599 mraa: /var/lib/jenkins/workspace/mraa-doc/api/mraa/uart.h File Reference

mraa_result_t mraa_uart_set_timeout ( mraa_uart_context dev, int read, int write, int interchar)

Set the timeout for read and write operations <= 0 will disable that timeout</em>

Parameters

dev The UART context

read read timeout

write write timeout

interchar inbetween char timeout

Also, are you doing loop tests by connecting the Tx to the Rx of the Board?

Regards,

Charlie

jbon1
Novice
110 Views

Hi Again.

Maybe I didn't explain it correctly, I was able to mount ttyUSB0 and link it to my code before I did the new flashing of the intel edison.

At this moment edison didn't mount the ttyUSB0 file.

Carlos_M_Intel
Employee
110 Views

Hi juanB,

How are you currently trying to mount the ttyUSB0? Are you using the guide on http://alextgalileo.altervista.org/blog/install-kernel-from-repo-onto-edison-official-image/ How to install a kernel from my repo onto Edison with the official image ?

Regards,

Charlie

Carlos_M_Intel
Employee
110 Views

Hi juanB,

Have you been able to mount the ttyUSB0?

Let me know if you still have problems with this.

Regards,

Charlie

Reply