Hello Everyone,
I have implemented FREERTOS CLI using uart on RA4m2. actually i am able to trasnmit using uart interface but unable to receive any command using uart.
I am facing to generate RX interrupt . here is my source code for uart call back function. It is an event based application using thready queue .
Now the same source code using same call back function is working on RA6M3 controller but not on RA4M2.
do i need to specify something
void cli_dbgUartCallback(uart_callback_args_t *p_args) { Event_t event = { .id = EV_NO_EVENT, .payload.u32Arr[0] = 0 }; m_dbgUartEvent = p_args->event; if ((UART_EVENT_RX_CHAR == m_dbgUartEvent) && (m_cmdInProgress == false)) { if (m_bufferIndex < (CMD_BUFFER_SIZE - 1)) { switch (p_args->data) { /* If Enter is pressed by user, send event to process the data */ case '\r': { /* Send command received event */ event.id = EV_DBG_UART_CMD_RCVD; event.payload.u32Arr[0] = (uint32_t)&m_cmdBuffer[0]; evh_handleEvent(&event); /* Set command in progress flag */ m_cmdInProgress = true; /* Clear buffer index */ m_bufferIndex = 0; break; } case '\b': { /* Backspace was pressed. Erase the last character in * the input buffer */ if (m_bufferIndex > 0) { m_bufferIndex--; m_cmdBuffer[m_bufferIndex] = '\0'; } break; } case '\n': /* ignore \n escape */ break; default: { /* Write RX data to input buffer */ m_cmdBuffer[m_bufferIndex++] = (char) p_args->data; break; } } } else { /* Buffer overflow! */ m_bufferIndex = 0; } } }
Hello,
Thanks for reaching out to Renesas Engineering Community.
Have you confirmed that data are transferred to P410 pin ?
Do you mean that the 'p_args->event' value is never equal to 'UART_EVENT_RX_CHAR' ?
Regards
hi AZ-Renesas,
how can i confirm that data are transferred to P410 pin ?.
i am able to transmit data on serail tera term port. so i thought serail interface is fine.
only the RX interrput is not at all firing.
confusing part is this that same code is working on RA6M3 evluation kit.
Regards,
Do the data length, parity and stop bits on FSP configurations match the settings of the transmitted data ?
YES, i have checked that.
everything is fine. I have checked UART_EVENT_TX_COMPLETE interrupt is also firing.
only problem lies with RX interrupt.
Is the callback function called at all ? If yes, what are the p_args->event values ?
Can you see any data in RSR(Receive Shift Register) and RDR(Receive Data Register) registers while debugging ?
Hi , yes actually callback functions is called when i transmit something and i am also able to see data on H-term. for any receiving caracter callback is not called at all. and i am also not able to see any data in RSR and RDR.
Can you share some of your SCI-UART related code ?
/** * Initializes the debug UART driver * * @retval FSP_SUCCESS Initialization successful * @retval FSP_ERR_* Any error during initialization */ fsp_err_t dbgUart_init(void) { fsp_err_t err = FSP_SUCCESS; /* Initialize UART */ err = R_SCI_UART_Open(&g_uartDbg_ctrl, &g_uartDbg_cfg); return err; } /** * Writes data to the UART interface * * @param[in] pBuffer Buffer containing the data to write * @param[in] numBytes Number of bytes to write * * @retval FSP_SUCCESS Write successful * @retval FSP_ERR_* Any error during write */ fsp_err_t dbgUart_write(const uint8_t *const pBuffer, size_t numBytes) { fsp_err_t err = FSP_SUCCESS; /* Write data to UART */ err = R_SCI_UART_Write(&g_uartDbg_ctrl, pBuffer, numBytes); return err; }
but any way i am using this write functions after handleling received data.
Can you pause the program and then check the register values ? They are greyed out when the program is running
This is the vlalues of my sci_uart resistor .
i do not see any problem .
If you do not see no data in RDR it means that there is no data in Receive Shift Register too, because they are transferred automatically from RSR to RDR.
But no data in RSR means that there is no serial data received from the RxD pin. Since this pin is configured correctly as shown above, it is possible that serial data do not arrive to RxD pin.
Can you make sure that that the transmitting device transmits data on P410 line ?