Configuring SNVS button interrupt at M4

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

Configuring SNVS button interrupt at M4

605 Views
shrinathwadkar
Contributor I

I am working on custom board with iMX7S. I am trying to configure SNVS button debounce interrupt at M4 to give periodic Interrupt at every 500ms if button is pressed.

This is the code snippet:

void PowerButton_Config( uint8_t config_ )
{
       uint32_t temp; //temp. variable to hold read values
       uint32_t newValues; //for applying mask


 newValues = SNVS_LPCR_ON_TIME(PWRBTN_OFF2ON_TIME_500MS ) |     SNVS_LPCR_DEBOUNCE(PWRBTN_DEBOUNCE_TIME_500MS )
| SNVS_LPCR_BTN_PRESS_TIME(PWRBTN_ON2OFF_TIME_DISABLED );

temp = SNVS_LPCR_REG( SNVS_BASE_PTR );
temp = temp & 0xFFC0FFFF;
temp = newValues | temp;

SNVS_LPCR_REG (SNVS_BASE_PTR ) = temp;

//Button Interrupt Configuration to give interrupt at both edges

SNVS_HPCR_REG( SNVS_BASE_PTR ) &= ~( SNVS_HPCR_BTN_CONFIG_MASK & ( 4 << SNVS_HPCR_BTN_CONFIG_SHIFT ));
SNVS_HPCR_REG( SNVS_BASE_PTR ) |= SNVS_HPCR_BTN_MASK_MASK;
NVIC_SetPriority( BOARD_SNVS_IRQ_NUM, 3 );
NVIC_EnableIRQ( BOARD_SNVS_IRQ_NUM );

}

But with this configuration a single interrupt is received but both cores M4 and A7 get hung.

Please help with configuration here.

Labels (2)
1 Reply

393 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Shrinath,

did you configured the pin in the Device Tree to work as GPIO and use interrupts? The Device Tree describes all the hardware in the MCU. Please take a look to following links for reference.

Device Tree Tutorial (ARM) | Linux Kernel For Newbies 

Configure GPIO as interrupt source 

Default config of GPIO's using device tree - Freescale i.MX6 - Stack Overflow 

Any examples on how to modify the .dts (device tree) source for custom hardware? 


Regards,
Carlos

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------