Hi Everyone;
I am trying to communicate with Uart. But I am encountering such an error. What could be the reason for this?
I see the same error when I activate FIFO Support. The difference between activating and not activating FIFO Support is that when FIFO Support is active, the error occurs after a while. What does FIFO Support do?
Thank you in advance.
Regards.guurii
Hi guurii,
Thanks for reaching out Renesas Engineering Community.
For the error message shown in your screenshot, it might because that you don't include the library file of these functions.
You should include the *.h file at the file that you use these functions.
Hope it helps,
NP_Renesas
I think I included the necessary library files. I don't get any error messages. It is not possible for me to communicate only via uart. My code keeps flowing. What does FIFO Support do?
If you have included the library file correct, please check that you have declared the functions in library file.
And the FIFO support will let you get a callback immediately when each byte is received. Or if you set "Receive FIFO Trigger Leve" to max, you will get a callback when FIFO is full or after 15 bit times with no data (fewer interrupts).
For more information about uart FIFO, please check this document:
RA Flexible Software Package Documentation: UART (r_sci_uart) (renesas.github.io)
I still keep getting the OVERFLOW error.
I use circular buffer. I read with the
What could be the reasons why I am getting this error? Do you have any ideas?
Thanks.
Can you share your code where you call R_SCI_UART_Read ? It could be possible that you do not wait until the receive operation is completed before you receive new data.
Hi,
The code I want to write is like below.What should I do to wait for the receive operation is complete before receive new data?
#define UART1_RECEIVEBUFFERSIZE 100 static unsigned char uart1_Receivechar = 100; static unsigned char uart1_Transmitchar = 100; static unsigned char Uart1ReceiveBuffer[UART1_RECEIVEBUFFERSIZE]; static unsigned char Uart1ReceiveCounter = 0U; unsigned char uartByte; void user_uart_callback(uart_callback_args_t *p_args) { /* Handle the UART event */ switch (p_args->event) { /* Received a character */ case UART_EVENT_RX_CHAR: { break; } /* Receive complete */ case UART_EVENT_RX_COMPLETE: { ata_Uart1_ReceiveInterrupt(); break; } /* Transmit complete */ case UART_EVENT_TX_COMPLETE: { ata_Uart1_TransmitInterruptEnd(); break; } default: { } } } static void Uart1ByteReceived(unsigned char uartByte) { if (Uart1ReceiveCounter < UART1_RECEIVEBUFFERSIZE) { Uart1ReceiveBuffer[Uart1ReceiveCounter++] = uartByte; } else { Uart1ReceiveCounter = 0U; trk_PushMessage1msNullUserData(&CheckUartReceiveBufferThread); } } void Uart1ReceiveInterrupt(unsigned char Received_Byte) { Uart1ByteReceived(Received_Byte); } unsigned long CheckUartReceiveBufferThread(void *user_data) { unsigned char ReceiveCounter; unsigned char ReceiveCounterControl = 0U; if (Uart1ReceiveCounter != 0U) { ReceiveCounterControl = Uart1ReceiveCounter; for (ReceiveCounter = 0U; ReceiveCounter < ReceiveCounterControl; ReceiveCounter++) { ata_commcallback(Uart1ReceiveBuffer[ReceiveCounter]); } if (ReceiveCounterControl == Uart1ReceiveCounter) { Uart1ReceiveCounter = 0U; } else { for (ReceiveCounter = 0U; ReceiveCounter < (Uart1ReceiveCounter - ReceiveCounterControl); ReceiveCounter++) { Uart1ReceiveBuffer[ReceiveCounter] = Uart1ReceiveBuffer[ReceiveCounterControl + ReceiveCounter]; } if (Uart1ReceiveCounter >= ReceiveCounterControl) { Uart1ReceiveCounter = (Uart1ReceiveCounter - ReceiveCounterControl); } } } return (unsigned long)msg_ProcessAfter1ms * 10U; } void ata_Uart1_ReceiveInterrupt(void) { Uart1ReceiveInterrupt(uart1_Receivechar); R_SCI_UART_Read(&g_uart0_ctrl, (uint8_t *)&uart1_Receivechar, 1); }
You can add a delay at RX_COMPLETE to wait your process done.
I think you're right. I put a breakpoint in r_sci_uart_c where r_sci_uart_call_callback is and when I debugged I saw that the buffer filled without any problems.
I will follow your advice.
Thanks for be interested.