Problem of running

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

Problem of running

616 Views
Garam_Kim
Contributor I

Hi

when I run this code

//--------------------------------------------------------------------------------------------

#include "S32K148.h" /* include peripheral declarations S32K144I  */
#define PTE21 21 /* Port PTD0, bit 0: FRDM EVB output to blue LED */
#define PTC12 12 /* Port PTC12, bit 12: FRDM EVB input from BTN0 [SW2] */
void WDOG_disable (void){
WDOG->CNT=0xD928C520; /*Unlock watchdog*/
WDOG->TOVAL=0x0000FFFF; /*Maximum timeout value*/
WDOG->CS = 0x00002100; /*Disable watchdog*/
}
int main(void) {
int counter = 0;
WDOG_disable();
/* Enable clocks to peripherals (PORT modules) */
PCC-> PCCn[PCC_PORTC_INDEX] = PCC_PCCn_CGC_MASK; /* Enable clock to PORT C */
PCC-> PCCn[PCC_PORTE_INDEX] = PCC_PCCn_CGC_MASK; /* Enable clock to PORT D */
/* Configure port C12 as GPIO input (BTN 0 [SW2] on EVB) */
PTC->PDDR &= ~(1<<PTC12); /* Port C12: Data Direction= input (default) */
PORTC->PCR[12] = 0x00000110; /* Port C12: MUX = GPIO, input filter enabled */
/* Configure port D0 as GPIO output (LED on EVB) */
PTD->PDDR |= 1<<PTE21; /* Port D0: Data Direction= output */
PORTE->PCR[0] = 0x00000100; /* Port D0: MUX = GPIO */
for(;;) {
if (PTC->PDIR & (1<<PTC12)) { /* If Pad Data Input = 1 (BTN0 [SW2] pushed) */
PTE-> PCOR |= 1<<PTE21;
}
else { /* If BTN0 was not pushed */
PTE-> PSOR |= 1<<PTE21; 
}
counter++;
}
}

//-------------------------------------------------------------------------------

There are some problems with running 

Garam_Kim_0-1608685301301.png

Could you tell me how can I fix it?

thanks

0 Kudos
1 Reply

609 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Garam_Kim,

The code you attached is similar to the S32K148_Project_Hello in S32 Design Studio for ARM Version 2.2.

S32K148_Project_Hello.pngS32K148_Project_Hello S32 Design Studio for ARM Version 2.2.png
I am not sure if you are using custom board or S32K148EVB board.
Would you please test this example on S32K148EVB board to check if it's ok?
Please first build it and then click Debug in Debug Configurations views.

Build and Debug.png

If you are not familiar with S32DS and S32K148EVB, then I recommend you refer: Get Started with the S32K148EVB 

Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos