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,
Yes, The same program works perfectly fine on RA6m3 evalualtion kit . i recieve correct data from Hterm on Ra6M3 evalualtion kit.
when i tried to run the same program with correct pin configuration on custom RA4M2 hardware,
traansmission from MCU to Hterm works but Hterm to MCU transmission does not work. seems .
UART_EVENT_RX_CHAR event is not happening at all.
The issue is that you do not get data in RDR register. If you do not get data you will not get a receive interrupt.
Can you attach the RA4M2 project so I can take a better look ?
Hi AZ_Renesas,
I have checked the data on RxD pin and it is coming on RxD pin.
only have problem that RX interrupt is not happening. I will clean up the code and will send you later so that you can look into it.
Bhavin
AZ_Renesas,
I managed to get interrupt on RX.
but the control always goes into BSP_CFG_HANDLE_UNRECOVERABLE_ERROR(0);
I have checked NMI and fault resistor but i dont see any problem in stack overflow.
can you please check this source code and tell me your opinion on it.
RA4M2_CLI.zip
This error is usually caused by not enough main stack size. Try to increase it on the BSP tab.
How did you fix the RX interrupt ? Could you share the solution so that other users can solve similar issues ?
Actually i have mulple thread based application and i have removed all the thread. first tried to run the application using single thread. it worked. do you think may there can be issue of context switching ot interrupt priority which causes RX interrupt to never arise ?
I still have the problem on my main application.
can you tell me how much i can increase the main stack size for RA4M2?
It sounds like other interrupts with higher priority did not let this interrupt to execute.
Looking at your project, the UART stack is used from the CLI thread so you should place it under the CLI thread and not in HAL/Common. Similarly for the other stacks, you need to place them under the correct thread.
Please fix this and then try with the same stack or bigger.
From the project you shared it seems that stack and heap size are big enough. Both have been set to 0x4000 which is 16 Kbytes. Have you tried to debug your code step by step, in order to check after which line control goes to BSP_CFG_HANDLE_UNRECOVERABLE_ERROR(0)?
Best Regards,
IK
Hello IK_Renesas,
I found the Problem.
I was using pin configuration for RA4M2 evluation kit but my contrller is R7FA4M2AD3CFM.
I just deleted unwanted pinconfig file and generated g_bsp_pin_cfg based on my controller .
It worked. Thanks for the support.
We are glad that your issue was solved!
Thanks for sharing your solution with us!