S32k 14x systick

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

S32k 14x systick

跳至解决方案
5,800 次查看
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 项奖励
回复
1 解答
4,486 次查看
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 项奖励
回复
5 回复数
4,485 次查看
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 项奖励
回复
4,485 次查看
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 项奖励
回复
4,487 次查看
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 项奖励
回复
4,485 次查看
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 项奖励
回复
4,485 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

Please try the attached code.

It should work.

Regards,

Daniel

0 项奖励
回复