freeRTOS_UART example faults in UART_RTOS_Send

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

freeRTOS_UART example faults in UART_RTOS_Send

1,651 Views
bgraham
Contributor IV

MCUXpresso IDE v11.0.0 [Build 2516] [2019-06-05]

Device: MKL26Z256xxx4

SDK_2.x_MKL26Z256xxx4 2.4.1

 

I started with the freeRTOS_UART example project.

I had to change the MCU and package.

See attached project 

 

My custom board has a MKL26Z256 that is connected to a modem at 115200.

 

In fsl_uart_freertos.c, UART_RTOS_Send() calls UART_TransferSendNonBlocking().

The problem is that UART_RTOS_Send()'s 2nd parameters is not a uart_handle_t *.

This causes a fault when UART_TransferSendNonBlocking() attempts to deference the bad pointer.

Call stack:

Thread #2 536867576 (Uart_task : Running [P: 4]) (Suspended : Breakpoint) 
UART_TransferSendNonBlocking() at fsl_uart.c:734 0x18a0 
UART_RTOS_Send() at fsl_uart_freertos.c:229 0x6e8e 
uart_task() at freertos_uart.c:133 0x5ec 
pxPortInitialiseStack() at port.c:102 0x2dfc

The amazon-freertos code appears to be out of sync with the generated drivers files.

Does anyone have a suggestion that will correct this?

Thanks,

Bruce

2 Replies

1,424 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Bruce

I debugged your code on my board. Please see below picture.

The parameters transfer is OK.

In your project, the variable "handle" address <0x15> is in flash, so it will result from a hardfault.

pastedImage_1.png

I increased the stack size , then it  can work on my side.

    xTaskCreate(uart_task, "Uart_task", configMINIMAL_STACK_SIZE + 200, NULL, uart_task_PRIORITY, NULL);

Could you please double check ?

Regards

Daniel

1,424 Views
bgraham
Contributor IV

Yep, stack corruption.

I forget to increase the stack size.

Now to sort out why the UART RX is always giving me a kStatus_UART_RxHardwareOverrun in the UART callback.

Thanks,

Bruce

0 Kudos
Reply