LPC11e6x + FreeRTOS + optimizer = hard fault on _some_ chips

Showing results for 
Search instead for 
Did you mean: 

LPC11e6x + FreeRTOS + optimizer = hard fault on _some_ chips

Contributor IV

I've never seen something like this. Ever.

This software has been in production for some time, but we've recently had a fallout of a considerable percentage. I've spent the last day trying to figure it out, and I've been able to prove that if I turn off optimization (going to -O0 instead of -Os), it runs. Otherwise, it near immediately hard faults.

I've got a batch of identical production run devices, and the one that fail all have similar coding:

23 13

I'm running FreeRTOS 10.0.1


I have one task that does some serious DSP on audio, so I can't live with the RTOS running slow. In fact, to get it to run, I had to disable that task. If I enable it, it hits a hard fault.

Labels (1)
Tags (1)
0 Kudos
4 Replies

Contributor IV

A bit more about that - I can turn on the SPI, so long as I don't actually turn on the DMA that drives it. I have to comment out the last two lines of the init function.


Even if my DMA ISR just dumps the data in the trash, it hard faults - but only on some MCUs. On most boards this is working rock solid.

0 Kudos

Contributor IV

I upgraded to FreeRTOS v10.4.3 - it runs with full optimization. But, I have to disable the I2S (via SPI & DMA) to prevent a hard fault.

0 Kudos

NXP TechSupport
NXP TechSupport

Hi @chrispflieger 

That's an interesting problem. 

If I understand you properly , the issue seems to be parts with the part marking that you gave. 

Are you able to provide some demo code were the issue is replicated?

In you FreeRTOS tasks, could you provide more details on how  the SPI and DMA peripherals accessed and configured ? Do you have some kind of synchronization technique for  this?

Thank you in advance.

All the best, 


Edith: re-phrasing

0 Kudos

Contributor IV

I've attached the I2S driver. On a bad board, I need to disable the last line, which then keeps it from running.

I still can't figure out why an older version of FreeRTOS wouldn't run, but a newer one would. I ran it with minimal tasks, and with no devices, or off chip interfaces... I even tried to run code from another project (we use that chip and code base in a lot of production devices), it hard faulted there as well.

Even with I2S turned off, I still think there's occasional hard faults - maybe every ten or twenty minutes. I need to investigate that more.

Debugging hard faults on a CM0 is a real pain, but I can provide whatever data you want.



Note, I do see some problems on ZSD20 331A parts, but never on any made in 2019 or 2018.

0 Kudos