hello, SDK.
When I use the following statement, the uart cannot emit any data.But SDK routines do support this.When I add "while(UART_GetTransmitStatus(&uart1_pal_instance, &bytesRemaining) == STATUS_BUSY)" at the end of the statement, the UART can send data as normal.How to solve this problem?
UART_SendData(&uart1_pal_instance, sendbuf, size);
Hi 张 舜毅,
Your method is correct.
UART_GetTransmitStatus returns whether the previous transmission has finished.
Have you check the status of UART_SendData? If it return STATUS_BUSY?
It is not recommend to call UART_SendData regularly, without check whether the previous transmission has finished.
Best Regards,
Robin
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi!
I have a problem using Uart to send a data in order to chek it with the Putty.
I am using s32k146 EVB and S32IDE, and I want to send a data by the uart to learn about this communication. I am quite new in this world. So you can see the code in the next lines:
/* Write your code here */
(void) CLOCK_SYS_Init (g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT, g_clockManCallbacksArr,
CLOCK_MANAGER_CALLBACK_CNT);
(void) CLOCK_SYS_UpdateConfiguration (0U, CLOCK_MANAGER_POLICY_AGREEMENT);
/* For example: for(;;) { } */
pins_channel_type_t result,result2;
HAL_DIO_result_t res;
uint8_t num=3;
res=HAL_DioInit();
LPUART_DRV_Init(INST_LPUART1, &lpuart1_State, &lpuart1_InitConfig0);
for(;;){
result=HAL_DioGet(DIO_INPUT_PTC12);
if(!result){
HAL_DioSet(DIO_INPUT_PTC12, 1);
LPUART_DRV_SendData(INST_LPUART1, &num, 1);
}
else{
HAL_DioSet(DIO_INPUT_PTC12, 0);
}
}
In this code, you can see I want to send a simply uint data(m), when result =0. But I do not have any data in the Putty, when the program run the instruction of sendata. I have checked the following probably errors:
1. The putty is well configured, with the correct COM, the correct baud rate,...
2. I think the Uart12 is also well configured and initialized.
3. I think that Uart sends data using interrupts by default. I tried some ways to prove this but I didn´t have results.
4. The processor Expert is well configured. Uart1 to trasmit, output.
5. I also tried to use the function of SDK, get_TransmitStatus in order to see how the state of the process was during the trasmition, but was always success, surprisingly.
6. I compare with the lpuart example of the guide of the board, but I must use the function of SDK, such as DRV_SendData, DRV_get_TransmitStatus, etc.
7 I also tried to use the functions sendDataPolling and sedDataPolling, but I didn´t have good results.
Can you help me, please?
Thank so much.
Manuel.