Hi everybody,
I have some trouble with the _io_cdc_serial_read function in the CDC usb host example.
/*FUNCTION****************************************************************
*
* Function Name : _io_cdc_serial_read
* Returned Value : _mqx_int number of characters read
* Comments :
* This routine reads characters from the USB serial I/O channel
* device, converting carriage return ('\r') characters to newlines,
* and then echoing the input characters.
*
*END*********************************************************************/
int_32 _io_cdc_serial_read
(
/* [IN] the file handle for the device */
FILE_CDC_PTR fd_ptr,
/* [IN] where the characters are to be stored */
char_ptr data_ptr,
/* [IN] the number of characters to input */
int_32 num
)
It is specified that the function returns the "number of characters read". What happens to me is that everytime i call this function the return value is always 1 even if i have more than 1 byte stored by the function in the "data_ptr" location.
For example: i send 5 bytes with _io_cdc_serial_write to a CDC device that send back to the host the same 5 bytes.
then i call:
num_done = _io_cdc_serial_read(f_usb, usb2uart, sizeof(uart2usb))
what i see is that in the usb2uart buffer i have all the 5 bytes received but num_done = 1.
The opposite function, _io_cdc_serial_write , seems to work properly. I send 5 byte and it returns me the same value as "byte sended".
Any ideas?
Thanks,
Matteo Davanzo