Hi,
I'm getting a serial write manager hard fault error. This error I'm getting if I write multiple times in UART using LPUART_WRITE_BLOCKING Api's.
Here is my code snippet.
When I'm getting a hard fault error, I can only receive 5 bytes.
Hello @yalin_10,
Could you please use GPIO_PinWrite() instead of GPIO_WritePinOutput() as this function is deprecated?
Also, did you receive an error window? Did the program stop when you receive only 5 bytes? Or the communication continues? In case you receive an error window, or the program stops while debugging, could you please share them with us?
Finally, could you please make sure you are sending one character at a time? For example, in the lpuart_polling example if you input/send too many characters each time, the receiver may overflow.
Best regards, Raul.
Hello @yalin_10,
Have you made the change to GPIO_PinWrite() from GPIO_WritePinOutput()? Did you have the same results?
How often the communication is failing? Is it happening at random moments or is a consistent failure, either by time or number of data transmitted?
Also, could you please send again the picture? It is a little blur, and we could not see it clearly.
Finally, could you tell us with which device are you communicating?
Kind regards, Raul.
1, No change in the result after we change the API's
2, consistent failure happens every time I send 3 frames, each frames having 15 bytes. even if I send once in one minute.
our device is MIMXRT1062.
We are using FreeRtos
Hello @yalin_10,
Could you please try only using the lpuart_polling example? This is to double check, if it could be something related with FreeRTOS or the driver and UART's communication.
Also, could you please check the FreeRTOS - Open Source RTOS Kernel for small embedded systems? There are some ideas to troubleshooting on FreeRTOS issues.
Best regards, Raul.
I tried one more method using Freertos-Uart Apis
############################################################################################
#define RT_LPUART LPUART7
#define RT_LPUART_CLK_FREQ BOARD_DebugConsoleSrcFreq()
#define RT_BAUDRATE 9600U
#define RT_LPUART_RINGBUFFER_SIZE 120U
lpuart_rtos_handle_t rt_rtos_uart_handle = {0};
lpuart_handle_t rt_uart_handle = {0};
lpuart_rtos_config_t rt_uart_cfg = {0};
uint8_t uart_rtos_buffer[RT_LPUART_RINGBUFFER_SIZE + 1] = {0};
###########################################################################################
status_t Init485Uart(void){
rt_uart_cfg.srcclk = RT_LPUART_CLK_FREQ;
rt_uart_cfg.baudrate = RT_BAUDRATE;
rt_uart_cfg.base = RT_LPUART;
rt_uart_cfg.stopbits = kLPUART_OneStopBit;
rt_uart_cfg.parity = kLPUART_ParityDisabled;
rt_uart_cfg.buffer = (uint8_t *)uart_rtos_buffer;
rt_uart_cfg.buffer_size = RT_LPUART_RINGBUFFER_SIZE + 1;
/*call the HAL UART init function from HAL section */
return LPUART_RTOS_Init(&rt_rtos_uart_handle, &rt_uart_handle, &rt_uart_cfg) ;
}
Getting Assert Error as handle is Null which is very weird because it is already declared.
So, I am at a fix now could not proceed in any direction.