SysTick Interrupt Disable generates HardFault

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

SysTick Interrupt Disable generates HardFault

3,210 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lokinhas on Wed Oct 29 03:05:18 MST 2014
Hi everyone.

In my current project I'm using a LPC1788 with the SysTick acting has a global timer, for non blocking code, the problem is that when a function needs to disable momentary the SysTick the interrupt (SysTick_IRQn) a HardFault occurs.

In the past I've used several LPC microcontrollers with a Cortex-M0 core (LPC1227, LPC11U68, etc) with the exact same code, without problems.

In attachment there's a example project that you can try.

Thanks in advance for the help.

Original Attachment has been moved to: FW.zip

Labels (1)
0 Kudos
2 Replies

1,662 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_Paul on Wed Oct 29 08:14:00 MST 2014
Try disabling the Systick interrupt using the following:
SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_ENABLE_Msk;

Then re-enable the interrupt using:
SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_TICKINT_Msk  |               SysTick_CTRL_ENABLE_Msk;

The Disbale IRQ function states the following in the core_cm3.h file:

/** \brief  Disable External Interrupt

    The function disables a device-specific interrupt in the NVIC interrupt controller.

    \param [in]      [u]IRQn  External interrupt number. Value cannot be negative.[/u]
*/

If you look in the cmsis_1777x_8x.h file, it shows that the Systick has a negative value:
SysTick_IRQn                  = -1,/*!< 15 System Tick Interrupt */

I changed your program using the disable/enable as shown above, and there is no longer a hardfault error.

Regards
Paul
0 Kudos

1,662 Views
thasin_akhand
Contributor III

I tried that code, It doesn't disable the systick, well at least for the k50. Would you know how to disable systick on K50? 

0 Kudos