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 https://github.com/brnkl/VC0706-cam-lib-legato. Everything appears to be working well with the exception of reading images (usually ~48kb in size).
The process for reading images is as follows:
- Send a command to get the size of the frame on the camera
- Send a command to the camera asking for a block of data (a block is currently defined as 32 bytes)
- Verify the response to the command
- Read the block into a buffer
- Write the buffer to a file
- 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:
- Are we encountering some limitation of the
le_ttyinterface? Is it not designed to read this much data?
- Would be better off using Linux system calls directly (though I’m sure
le_ttyuses the same calls under the hood)?
- Have the latest releases of Legato resolved any serial issues (we’re running Legato
- I interpreted the
int timeoutparameters on the
le_tty_Openfunction as "time and size limit for each call to
read". Is this correct?