Hello,I'm trying to get UART working in our project. I'm working on RA6M5 MCU.I looked at the example "ra-fsp-examples-master\ra-fsp-examples-master\example_projects\ek_ra6m5\sci_uart\sci_uart_ek_ra6m5_ep\iar" in IAR 9.10. I noticed that the TX is P101, RX is P100. For us, the TX is P409; the RX is P408. How can I change the PIN configuration to make it work for our design?Actually I also created my project. I added the UART stack(r_sci_uart). When I tried to configure the RX and TX, I can't configure it for P408 and P409. How can I setup the PIN for RX and TX?Is there any document about how to get UART working?Thanks!
in the pins tab of the configurator, set the pins for SCI channel 3 :-
Then in the properties of the SCI UART driver, set the channel you want to use, and the pin setting for that channel of SCI will be shown :-
Hi Jeremy,
I selected SCI channel 3 for P408/409. The UART works. I saw some string printed out. But the characters are gibberish. They are not the proper characters. What could be wrong?
By the way, is there a mapping table that shows the PIN vs the channels? Such as P100/P100 is channel 0, P408/P409 is channel 3, etc.
Here is the configuration from my Smart Configurator about the UART:
Thanks!
Hi,
Possibly...
I was interrupting on every received character, and....
I was using "R_SCI_UART_Read(&g_uart0_ctrl, &rx485Char, 1);" to read chars and every second on 19K2 baud was incorrect.
I used "rx485Char = (uint8_t)(p_args -> data);"
and all my problems went away
I hope this helps
Thanks Ian.
Could you post more code? I'd like to see how you implement it.
Sorry for the delayed reply, life is just hectic at the moment.
In the FSP the interrupt was set like..
The int looks like:
......
#include "projectZone.h"
void comms485Int(uart_callback_args_t *p_args){ if (p_args -> event == UART_EVENT_RX_CHAR) { //R_SCI_UART_Read(&g_uart0_ctrl, &rx485Char, 1);
rx485Char = (uint8_t)(p_args -> data);
handle485Serial(); comms485Received = 1; // turn the comms LED on }
/* if (p_args -> event == UART_EVENT_TX_COMPLETE) { RX485EN; } */
}
FSP 3.6 now has RS485 Tx enable built in, which is why the TX section is commented out.
The system is strictly poll, and response.
The handle485Serial routine is very short and handles the message byte by byte, and constructs a transmit array on the fly, and executes the following when ready, and then goes back into listening mode.
//TX485EN; status = R_SCI_UART_Write(&g_uart0_ctrl, &tx485Buff[0], num485TxChars);
Hi Pilot-
Here are some additional points to consider fixing:
bsp_clock_init() is not called.
System clocks are not setup properly.
BOARD_ClockInit() calls hal_entry().
Hi Warren,
I checked. bsp_clock_init() is called by SystemInit() which is called by Reset_Handler(). We don't call BOARD_ClockInit().
Speaking of "System clocks are not setup properly", we don't setup system clock. Can you tell me where to find the "system clocks setup"?
H Pilot-
I me3an configuring the clocks in the clock tab as you show above. Just check to see if they are set properly for your application. You might compare it to the example project to see if yours is similar.
Thanks. I compared the clock configuration between mine and the sample project's. They are the same.