mdelay causes kernel panic

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

mdelay causes kernel panic

Contributor II


I'm using an i.mx6ull based custom board and is battery powered. I have an LCD device driver using i2c. I need to enable all segments during booting and wait for three seconds then disable all segments. Once all segments are turned off, I need to print some messages on the display.

  • For waiting three seconds I have used mdelay(3000). This causes kernel panic when it is powered from a battery(Battery was fully charged and there is no severe voltage drop). It works as expected when it is powered from USB. Also, if we split the mdelay(3000) to (mdelay(1000) X 3 times) or (mdelay(2000) and mdelay(1000)), no issue is found. What would be the reason for it? Any workaround for this?
  • Since mdelay was causing panic, I created a timer delay and initialized a tasklet for displaying a message from timer ISR. There are around 30-40 i2c transactions for displaying the message. While executing this it throws.Screenshot from 2020-06-16 10-33-14.png

It takes a long time to boot. Is it a clock stretching? What will be the best solution for the given requirement?

This is bit critical. Please reply fast.

Thanks in advance.

Labels (3)
0 Kudos
1 Reply

NXP Employee
NXP Employee

Hi mathew_k_t

seems mdelay is blocking other tasks which could cause linux problems: 

msleep() vs. mdelay() – Energiequant 

Best regards
Note: If this post answers your question, please click the Correct Answer button. Thank you!

0 Kudos