S32k 14x systick

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

S32k 14x systick

Jump to solution
4,713 Views
hajianik
Senior Contributor I

Hi ,

the code below uses design studio, and the NXP eval board for S32k144.

My systick is not triggered. I must be doing something wrong. Ring to toggle red and green LEDS.

typedef struct

{

__IO uint32_t CTRL;

__IO uint32_t LOAD;

__IO uint32_t VAL;

__I uint32_t CALIB;

} SysTick_Type;

#define SysTick ((SysTick_Type *) (0xE000E010UL) )

void SysTick_Handler(void ) {

PTD->PTOR |= 0x1>>15 | 0x1>>16; // Toggle Blue

}

int main()

{

DISABLE_INTERRUPTS();

SysTick->LOAD = 0x00FFFFFF; /* set SysTick timer reload value*/

SysTick->CTRL = 0x7; /* start SysTick timer with Interrupt using core clock */

ENABLE_INTERRUPTS();

//set Peripheral Clock Control for PORTD

PCC->PCCn[PCC_PORTD_INDEX] |= 0x40000000;

// set Pin Control Register

//PORTD->PCR[0] = 0x00000100;

PORTD->PCR[15] = 0x00000100;

PORTD->PCR[16] = 0x00000100;

// set Port Data Direction Register

PTD->PDDR |= (/*0x1<<0*/0) | (0x1<<15) | (0x1<<16);

// set PORT output

PTD->PSOR |= /*(0x1<<0) | */(0x1<<15) | (0x1<<16);

while( 1 ) {

//printf("I am here.\n");

}

return 0;

}

Thanks,

0 Kudos
1 Solution
3,399 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi Koorosh,

If you place a breakpoint in the main function, does it work? Have you placed the breakpoint on a valid code line, tried changing properties of the breakpoint?

Regards,

Daniel

View solution in original post

0 Kudos
5 Replies
3,398 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

I have tried your code and it works.

But you should use left bitshift (<<) instead of right bitshift (>>) in the systick ISR.

 

Regards,

Daniel

0 Kudos
3,398 Views
hajianik
Senior Contributor I

Hi Daniel,

It is blinking so it means that it is triggering the system tick handler, however when I place the break point in the handler , it does not  get hit.

Thanks,

Koorosh Hajiani

0 Kudos
3,400 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi Koorosh,

If you place a breakpoint in the main function, does it work? Have you placed the breakpoint on a valid code line, tried changing properties of the breakpoint?

Regards,

Daniel

0 Kudos
3,398 Views
hajianik
Senior Contributor I

Hi Daniel,

Yes, That's correct. However the issue is that the systick handler does not trigger.I took The demo Blinking _led off the sdk in design studio and modified it and build it and try to download it using open sda and tried to debug it. neither work. put a breakpoint in the handler it never trips.

Any ideas?

Thanks,

Koorosh Hajiani

0 Kudos
3,398 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

Please try the attached code.

It should work.

Regards,

Daniel

0 Kudos