KDS KL46Z application stuck in dispatch.S on startup

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

KDS KL46Z application stuck in dispatch.S on startup

Jump to solution
2,531 Views
remibeges
NXP Employee
NXP Employee

Hello,

I'm having an issue with an MQXLite application.

On startup, the program will randomly get stuck in dispatch.S, line 198

I am using a standard freedom KL46Z, with updated pe micro debug com.pemicro.debug.gdbjtag.pne_2.2.1.201509111213

My issue is that program is not responding. If i try to simply pause the debug session (with no breakpoint set), it always throws this message

Temporary breakpoint 1, main () at ../Sources/main.c:71

71  PE_low_level_init();

Program received signal SIGINT, Interrupt.

no_one_to_run () at ../MQXLITE/psp/cortex_m/core/M0/dispatch.S:198

198                ldr r1, [r0, #KD_READY_Q_LIST]      // get first queue from ready list

And the debugger always points to the line "ldr r1, [r0, #KD_READY_Q_LIST]  in dispatch.S

ASM_LABEL(no_one_to_run)

                // wait for interrupt

                cpsie i

                wfi

                cpsid i

                // TODO check r0, must be kernel data

                ldr r1, [r0, #KD_READY_Q_LIST]      // get first queue from ready list

                b find_noempty_que

I'm not very familiar with MQXLite yet... Do you understand what's happening here ?

Here's the full debugging log (with debugging paused multiple times):

GNU gdb (GNU Tools for ARM Embedded Processors) 7.8.0.20150604-cvs

Copyright (C) 2014 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.  Type "show copying"

and "show warranty" for details.

This GDB was configured as "--host=i686-w64-mingw32 --target=arm-none-eabi".

Type "show configuration" for configuration details.

For bug reporting instructions, please see:

<http://www.gnu.org/software/gdb/bugs/>.

Find the GDB manual and other documentation resources online at:

<http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".

Type "apropos word" to search for commands related to "word".

monitor preserve0 0

monitor selectcore 0

Warning: the current language does not match this frame.

continue

Continuing.

Note: automatically using hardware breakpoints for read-only addresses.

Temporary breakpoint 1, main () at ../Sources/main.c:71

71  PE_low_level_init();

Program received signal SIGINT, Interrupt.

no_one_to_run () at ../MQXLITE/psp/cortex_m/core/M0/dispatch.S:198

198                ldr r1, [r0, #KD_READY_Q_LIST]      // get first queue from ready list

Program received signal SIGINT, Interrupt.

no_one_to_run () at ../MQXLITE/psp/cortex_m/core/M0/dispatch.S:198

198                ldr r1, [r0, #KD_READY_Q_LIST]      // get first queue from ready list

Program received signal SIGINT, Interrupt.

no_one_to_run () at ../MQXLITE/psp/cortex_m/core/M0/dispatch.S:198

198                ldr r1, [r0, #KD_READY_Q_LIST]      // get first queue from ready list

Program received signal SIGINT, Interrupt.

no_one_to_run () at ../MQXLITE/psp/cortex_m/core/M0/dispatch.S:198

198                ldr r1, [r0, #KD_READY_Q_LIST]      // get first queue from ready list

Thank you for your help

1 Solution
1,780 Views
isaacavila
NXP Employee
NXP Employee

Hello Remi,

We have found the root cause for this issue. It is caused by LPTMR0 interrupt.

Sensor Fusion library uses LPTMR0 to manage timing in the application, so it generates an interrupt and sometimes, when you RESET your board (except for Power-On Reset or LVD) LPTMR0's interrupt is attending just before MQX is started completely, causing MQX to crash.

I have added a solution for this issue:

  • Disable LPTMR's auto initialization

Disable FTM's auto initialization.jpg

  • Save changes and generate code.
  • Go to mqx_tasks.c and modify main_task in order to initialize FTM module once MQX has started:

Init FTM module.jpg

  • Save changes, compile the code and download in your board. It should work now.

I hope this can help you!

Best Regards,

Isaac

----------------------------------------------------------------------------------------------------------------------------------------

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

----------------------------------------------------------------------------------------------------------------------------------------

View solution in original post

12 Replies
1,781 Views
isaacavila
NXP Employee
NXP Employee

Hello Remi,

We have found the root cause for this issue. It is caused by LPTMR0 interrupt.

Sensor Fusion library uses LPTMR0 to manage timing in the application, so it generates an interrupt and sometimes, when you RESET your board (except for Power-On Reset or LVD) LPTMR0's interrupt is attending just before MQX is started completely, causing MQX to crash.

I have added a solution for this issue:

  • Disable LPTMR's auto initialization

Disable FTM's auto initialization.jpg

  • Save changes and generate code.
  • Go to mqx_tasks.c and modify main_task in order to initialize FTM module once MQX has started:

Init FTM module.jpg

  • Save changes, compile the code and download in your board. It should work now.

I hope this can help you!

Best Regards,

Isaac

----------------------------------------------------------------------------------------------------------------------------------------

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

----------------------------------------------------------------------------------------------------------------------------------------

1,780 Views
remibeges
NXP Employee
NXP Employee

Yes that was it, good catch !

Thank you all for the support, especially you Isaac.

Regards

0 Kudos
1,780 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello ,

Which IDE do you use ? And when you run one demo code , does it can work well ?

BR

Alice

0 Kudos
1,780 Views
remibeges
NXP Employee
NXP Employee

Hello Alice,

I am using Kinetis Design Studio 3.0.0.

I am already running the sensor fusion demo with a few more functions of mine. I am not messing with any MQX tasks in any way but i will try to run the default code.

0 Kudos
1,780 Views
isaacavila
NXP Employee
NXP Employee

Hello Remi,

Could you please attach your MQX-lite code? I can test it on FRDM-KL46Z and check if there is something wrong on your configuration.

Regards,

Isaac

0 Kudos
1,780 Views
remibeges
NXP Employee
NXP Employee

Hello,

I tried with a default MQX application, I cannot reproduce the issue.

The code can be downloaded here https://github.com/Overdrivr/FRDM-Quadcopter/archive/master.zip

Most KDS files are gitignore-d, please tell me if some are missing.

0 Kudos
1,780 Views
isaacavila
NXP Employee
NXP Employee

Hi Remi,

There are some missing files (Generated code from PEx such as LED_RED.h, GREEN_LED.h and more) that is why I cannot compile the project correctly.

Regards,

Isaac

0 Kudos
1,780 Views
remibeges
NXP Employee
NXP Employee

Hi isaacavila,

I was in PTO, could not answer earlier. Thank you for looking into this

The Processor Expert file is in the archive, did you run processor expert code generation ? This should generate all those missing files.

Regards,

0 Kudos
1,780 Views
kingcool
Contributor I

Hi isaacavila,

                I have the same problem with my MK60DN512ZVLQ10, my app is stuck in dispatch.s too . I have tried to disable the RTC clock in my BSP files ,but have no help .I made 8 boards and  four of them have this problem,others  work well.

                I have saw your reply to Remi, I think my designs maybe have the problem,but My BSP files are not gernerated by PE,I clone  them from MQX 3.8, i wanna know how can i  disable the LPTMR0 ,and  initial it after MQX started  without the PE.

Regards.

YangZhou

0 Kudos
1,780 Views
isaacavila
NXP Employee
NXP Employee

Hello Yang,

You only need to clear the TEN bit that is located at LPTMR0_CSR register. Just be sure to clear this bit once LPTMR's clock has been enabled, otherwise, a HardFault interrupt will be triggered.

Regards,

Isaac

0 Kudos
1,780 Views
kingcool
Contributor I

Hi isaacavila,

                    I try to clear the LPTMR0_CSR register in my BSP files,but I found  my BSP files have no files to set the LPTMER0 except the MK60DZ10.h  ,but  the file just  define the  macro  to set the rigister. 

                   So I just describe my situation,my board is stuck in the dispatch.s file after the reset  trigered by the WATCHDOG interrupt,  except for Power-On Reset as you say. if I don't reboot it with shutdown the watchdog, the board works well .By the way ,I have made over 20 pcs boards with the same hardware ,most of them works well ,just 5 of them have this problem.  I have referred to other way the solve  this problem just like disable the RTC clock  in the userconfig.h and the   bsp_cm.c &bsp_cm .h  files ,but nothing helped .I post the pics just where the programes run stoped .

   1.png

                     

2.png

  hope for your suggestion,isaacavila!

Regards.

YangZhou

0 Kudos
1,780 Views
isaacavila
NXP Employee
NXP Employee

Hello Remi,

I am still looking at this issue, have you tried creating a basic MQX-Lite project and then add you source files?

You can look at this document that explains how to create a new MQX-Lite project. How To: Create an MQX RTOS for KSDK project with Processor Expert in Kinetis Design Studio IDE

I hope this can help

Best Regards,

Isaac

0 Kudos