I am currently working with the S32K144-EVB and attempting to perform data transmission and reception using UART. However, I am encountering difficulties with the UART configuration, especially since I am new to S32Design Studio.
Initially, I tried the example UART project and successfully received the transmitted value. However, when I created a new project and configured the UART, I did not receive any data.
Could you please provide guidance on how to properly configure UART in a new project.
Solved! Go to Solution.
Hi @DIVYAJ1,
In order to use UART, you can simply add the UART component and configure the pins through Config Tools:
If you want to use interrupts or a callback for your reception and transmission, then the IntCtrl driver must also be added, but for a simple uart configuration that should be enough.
I've attached a simple example which echoes the inputs through a serial terminal through UART1 (connected to the EVB's USB):
Best regards,
Julián
Hi @DIVYAJ1,
In order to use UART, you can simply add the UART component and configure the pins through Config Tools:
If you want to use interrupts or a callback for your reception and transmission, then the IntCtrl driver must also be added, but for a simple uart configuration that should be enough.
I've attached a simple example which echoes the inputs through a serial terminal through UART1 (connected to the EVB's USB):
Best regards,
Julián
Hi,
Thankyou for replying.
I imported the file you provided and successfully received transmitted data in the debug terminal.
However, after following the UART configuration steps to create a new project, I am only seeing ‘NULL’ in the debug terminal instead of the expected transmitted data.
Hi @DIVYAJ1,
Could you share your code (main.c)? Maybe you are missing some steps initializing or using the functions.
The basic uart project should look something like this:
int main(void)
{
/* Initialize and configure clocks
* - see clock manager component for details
*/
CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT,
g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);
CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);
/* Initialize pins
* - See PinSettings component for more info
*/
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS0, g_pin_mux_InitConfigArr0);
/* Initialize for UART_PAL */
UART_Init(&uart_instance, UART_PAL_CONFIG);
/* Send a welcome message */
UART_SendDataBlocking(&uart_instance, (uint8_t *)welcomeMsg, strlen(welcomeMsg), TIMEOUT);
}
Best regards,
Julián
Hi @DIVYAJ1,
Sorry for the misunderstanding, but are you using config tools or are you configuring the drivers yourself with registers? Following the thread, I was giving recommendations on how to configure the UART by using the GUI for the drivers, but the project you shared does not use these generated configurations.
If you need to configure the example in bare metal, please follow AN5413: S32K1xx Series Cookbook, which includes an example for a simple UART 9600 baud transfer to a COM port on a PC in chapter 2.7.
Best regards,
Julián