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
Could you tell me how can I fix it?
thanks
Hi Garam_Kim,
The code you attached is similar to the S32K148_Project_Hello in S32 Design Studio for ARM Version 2.2.
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.
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.
-------------------------------------------------------------------------------