AnsweredAssumed Answered

Issue with USB communication between iMX25 and Cortex-M3 core-based MCU

Question asked by Daniele Romano on Nov 18, 2013
Latest reply on Nov 21, 2013 by jimmychan

Hi everyone,


My name's Daniele Romano, I'm an electronic engineer living in Rome, Italy.

I'd like first to beg all your pardon for the complexity of the experimental setup I needed to create for the actual project I'm currently working on. I'll try to illustrate it by the easiest way I can do.


I'm currently involved in the development of a Qt application which should run on a iMX257 microprocessor with the support of an embedded Linux kernel distribution. The application needs to communicate, via USB, with an ARM Cortex-M3 core-based microcontroller. The communication protocol is serial, as trivial as a RS232-based TX-RX-GND wires-only cabling: the iMX257 acts as the master of the communication, while the CM3 as the slave. The latter uses a FT2232D interface on the board to translate the UART serial protocol to a USB one; onto the former, the HAL is represented by an FTDI_SIO driver, which acts as the interface between the serial protocol (handled by the application and redirected by the kernel, using the FTDI driver, to the USB Host PHY controller of the iMX257) and the USB protocol.

The development setup is currently set as I'm going to show: the board onto which the iMX257 is mounted is connected with:

(1) Via a USB Host PHY port, to the Cortex-M3-mounted board;

(2) Via a RS232 3-wires only port, to a COM port on the host computer onto which I'm developing the application;

(3) Via an Ethernet port, to the Ethernet port of the same host computer.

The reason is that I'm developing the application using the Qt framework which is running, under Ubuntu, onto a Virtual Machine, which is in turn running under Windows XP on the host computer. Thus I needed to create a network composed by three nodes: the host computer, the virtual machine and the iMX257 board. In this way, I can make a NFS server, created onto the storage memory dedicated to the virtual machine, accessible by the iMX257 board, in order to test a cross-compiled application directly onto this board, without flashing it into. The RS232 communication with the host computer is used to talk with the iMX257 board by using a simple serial terminal and the BusyBox shell running onto the processor. On the host computer I can thus use the Linux console commands by using, e.g., HyperTerminal.


Now, when I connect the Cortex-M3-based board, via USB, to the iMX257 board, the latter immediately recognizes the plugging of the former (because of the FTDI_SIO driver help) and the console correctly shows the usual message "FT2232D device is now connected to /dev/ttyUSB0".

When I try to send raw data to the Cortex-M3-based board by using the console command "echo "string_to_send" > /dev/ttyUSB0", all is working fine: onto the OLED display of the Cortex-M3-based board I actually see the string I sent from the iMX257. The procedure works just fine for every baud rate and flow control settings of the serial communication.

The issue I'm facing shows up when I try to read data from the USB port. That is, the Cortex-M3 MCU is using a loop to repeatedly send a string, through the UART controller-FT2232D chip-USB cable system, to the iMX257 MPU. When I try to read data by using the console command "cat /dev/ttyUSB0" or "cat /dev/ttyUSB0 > my_file.txt" (or by using a simple test program who uses a C++ class implementing a classic POSIX serial communication, both blocking and non-blocking), it seems nothing can be read from the USB port.

Did anyone already face this issue in the past or does anyone know where I should check and then fix the problem?


Sorry again for the complexity and the long post, and thanks in advance for your help.


Best regards,