My application is to receive data from java (GUI) application,and send it back to the GUI.
The reading of the received data is creating the issue. It is only able to read one byte.
I can send other data it is not a problem. So i'm assuming that the read call is creating issue.
->I'm working using atmel studio 7.0, the code which i'm using is USB Communication Device Class (CDC) for ATSAMD21.
->The code which i'm using and the documentation link is here Microchip® Advanced Software Framework.
Code snippet:
static void usart_rx_callback(struct usart_module *const module) { /* Data received */ ui_com_tx_start(); /* Transfer UART RX fifo to CDC TX */ if (!udi_cdc_is_tx_ready()) { ///* Fifo full */ udi_cdc_signal_overrun(); ui_com_overflow(); } else { udi_cdc_write_buf(&rx_data, 10); //Writes a RAM buffer on CDC line. } ui_com_tx_stop(); usart_read_buffer_job(&usart_module_edbg, &rx_data, 10);//Asynchronous buffer read.Sets up the driver to read from the USART to a given buffer. // If registered and enabled, a callback function will be called. return; }
void uart_rx_notify(uint8_t port) { UNUSED(port); if (!tx_callback_flag) { /* Transmit first data */ ui_com_rx_start(); usart_enable_callback(&usart_module_edbg, USART_CALLBACK_BUFFER_TRANSMITTED); tx_data = udi_cdc_getc(); //Waits and gets a value on CDC line & read rx_data=tx_data; udi_cdc_putc(rx_data); usart_write_buffer_job(&usart_module_edbg, &tx_data, 10); //rx_data Pointer to data to be received } }
Please help me with this issue . Any help will be appreciated.
Thanks in Advance.