Serial Write manager hard fault

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Serial Write manager hard fault

1,078 次查看
yalin_10
Contributor II

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.

yalin_10_0-1699279188003.png

 

yalin_10_0-1699278824102.png

 

When I'm getting a hard fault error, I can only receive 5 bytes.

 

0 项奖励
回复
6 回复数

1,056 次查看
RaRo
NXP TechSupport
NXP TechSupport

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.

0 项奖励
回复

1,041 次查看
yalin_10
Contributor II

Yes my program stops after receiving 5 bytes.

image.png

0 项奖励
回复

1,033 次查看
RaRo
NXP TechSupport
NXP TechSupport

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.

0 项奖励
回复

1,023 次查看
yalin_10
Contributor II

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. 

yalin_10_0-1699595335157.png

 

our device is MIMXRT1062.

We are using FreeRtos

0 项奖励
回复

960 次查看
RaRo
NXP TechSupport
NXP TechSupport

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.

0 项奖励
回复

1,016 次查看
yalin_10
Contributor II

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.

image (1).png

 

So, I am at a fix now could not proceed in any direction.

0 项奖励
回复