S32K1 GPIO input, falling-edge interrupt with digitalfilter, but entering IRQHandler after init

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

S32K1 GPIO input, falling-edge interrupt with digitalfilter, but entering IRQHandler after init

Jump to solution
809 Views
Leon_Hsieh
Contributor II

Hi all,

I'm using the S32K1 MCU, and I define an input pin to detect the signal falling edge. 

pin_mux.c

 

Spoiler
{
.base = PORTC,
.pinPortIdx = 8U,
.pullConfig = PORT_INTERNAL_PULL_NOT_ENABLED,
.driveSelect = PORT_HIGH_DRIVE_STRENGTH,
.passiveFilter = false,
.mux = PORT_MUX_AS_GPIO,
.pinLock = false,
.intConfig = PORT_INT_FALLING_EDGE,
.clearIntFlag = false,
.gpioBase = PTC,
.direction = GPIO_INPUT_DIRECTION,
.digitalFilter = true,
.initValue = 1U,
},
Spoiler

const port_digital_filter_config_t PTC_filter_Paras={
.clock = PORT_DIGITAL_FILTER_LPO_CLOCK,
.width = 5U,
};
#define PTC_Filter_Conf ((port_digital_filter_config_t*)&PTC_filter_Paras)

static inline void Set_Pin_Interrupt_Filter(void){
PINS_DRV_ConfigDigitalFilter(PORTA, PTA_Filter_Conf);
PINS_DRV_ConfigDigitalFilter(PORTC, PTC_Filter_Conf);
}

Spoiler
void PORTC_IRQHandler(void){
FLT_OVP_VBUS_Handler();//Check the PTC8 interrupt enabled or not
PINS_DRV_ClearPortIntFlagCmd(PORTC);
}

I add a breakpoint  inside the PORTC_IRQHandler.

After the pins and pins filter initialized, and then PORTC_IRQHandler() triggered, but I used oscilloscope to measure the input signal is always high, no falling edge exited.

In the same time, The register data:

PORTC/ISFR,0x4004B0A0,0x00000100

PTC/PDIR,0x400FF090,0x00024130

The PTC8/PDIR is High but PORTC8/ISFR is High, it's not expected action, how to set this pin?

Regards,

Leon

0 Kudos
Reply
1 Solution
779 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Leon,

Did you followed the order mentioned in the chapter "Digital input filter configuration sequence while using GPIO interrupt"?

Digital input filter configuration sequence while using GPIO interrupt.png

If the problem persists, please tell me the part number of S32K1, SDK or RTD version number you are using.


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.
-------------------------------------------------------------------------------

View solution in original post

0 Kudos
Reply
2 Replies
780 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Leon,

Did you followed the order mentioned in the chapter "Digital input filter configuration sequence while using GPIO interrupt"?

Digital input filter configuration sequence while using GPIO interrupt.png

If the problem persists, please tell me the part number of S32K1, SDK or RTD version number you are using.


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
Reply
761 Views
Leon_Hsieh
Contributor II

Hi Robin,

I am using S32K148 and SDK4.0.2.

I was following the guidelines Chap. 12.1.4.1 and changed some initial pin configurations and the pin initializing processes from s32ds auto-code-gen.

 

pin_settings_config_t g_pin_mux_InitConfigArr[NUM_OF_CONFIGURED_PINS]={
{
.base = PORTC,
.pinPortIdx = 8U,
.pullConfig = PORT_INTERNAL_PULL_NOT_ENABLED,
.driveSelect = PORT_HIGH_DRIVE_STRENGTH,//PORT_LOW_DRIVE_STRENGTH,
.passiveFilter = false,
.mux = PORT_MUX_AS_GPIO,
.pinLock = false,
.intConfig = PORT_DMA_INT_DISABLED,//not using PORT_INT_FALLING_EDGE initialized when .digitalFilter = true
.clearIntFlag = false,
.gpioBase = PTC,
.direction = GPIO_INPUT_DIRECTION,
.digitalFilter = true,
.initValue = 1U,
},
}
status_t Config_GPIO_Module(void)
{
	status_t st;
	st = PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
	Set_Pin_Interrupt_Filter();
	PINS_SetPinIntSel(PORTC, 8U, PORT_INT_FALLING_EDGE);
	return st;
}
status_t Config_IRQ_System(void){
	INT_SYS_EnableIRQ(PORTC_IRQn);//PTC8 for FLT OV
	INT_SYS_SetPriority(PORTC_IRQn, 7);
}

After Config_GPIO_Module() initialized, and then do Config_IRQ_System() initialized. After the processes and then the PTC8 is normally worked and raising the interrupt flag when the falling-edge siganl existed. And now it's worked as what I need.

Thanks for help.

Regards,

Leon

 

 

 

0 Kudos
Reply