Serial connection becomes unresponsive


Hello all,

I’ve been working on getting a simple serial camera running on the MangOH Red (the Adafruit VC0706 to be exact). The camera is connected to UART1 and is available to the user space as /dev/ttyHS0. The code for this project is open source and can be found at Everything appears to be working well with the exception of reading images (usually ~48kb in size).

The process for reading images is as follows:

  1. Send a command to get the size of the frame on the camera
  2. Send a command to the camera asking for a block of data (a block is currently defined as 32 bytes)
  3. Verify the response to the command
  4. Read the block into a buffer
  5. Write the buffer to a file
  6. Repeat steps 2 to 5 until we have read the entire frame

Typically this process fails after 10 reads of 32 bytes. Yesterday I decided to try a wild idea and reset the serial connection after each read by calling le_tty_Close followed by a call to le_tty_Open. This “fix” allows us to read the entire image, though the data does not form a correct JPEG as the image is not viewable.

This leaves me with the following questions:

  1. Are we encountering some limitation of the le_tty interface? Is it not designed to read this much data?
  2. Would be better off using Linux system calls directly (though I’m sure le_tty uses the same calls under the hood)?
  3. Have the latest releases of Legato resolved any serial issues (we’re running Legato 17.07.1)?
  4. I interpreted the int numChars and int timeout parameters on the le_tty_Open function as "time and size limit for each call to read". Is this correct?


Ahoy all,

So we have continued to do some work on this and feel like we may be encountering a kernel-level buffer overflow issue. We may be loading up this buffer and then when we reset the tty interface we are hard-flushing the buffer. When we are closing the connection we are losing some of our data and thus corrupting our JPG photos.

Do you guys have any clues on any data capacity? Should we be abandoning the the legato TTY interface and go system-level?



Hello all,

We seem to have solved this by using exclusively system calls (we’re able to take complete and viewable photos) . If there is a known limitation on the le_tty interface it may be worth documenting somewhere.


Thanks Nick. Can you send us some log files if available? We’ll open a ticket.


Hey @asyal, what specific logs would be helpful? I don’t recall seeing any system log messages regarding serial issues. I could attach logs from our application but they don’t expose much beyond what I described above.