cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 Discovery Integrated LIS302DL Interrupt

peppea82
Associate II
Posted on October 22, 2013 at 15:28

Hi Everybody and thanks in advance for support.

I'm trying to rewrite code to read LIS302DL to handle/generate an interrupt every Data Ready Signal.

Here is my code

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOE, ENABLE);

RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);

GPIO_InitTypeDef   GPIO_InitStructure;

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;

GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;

GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;

GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

GPIO_Init(GPIOE, &GPIO_InitStructure);

SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOE, EXTI_PinSource0);

EXTI_InitTypeDef EXTI_InitStructure;

EXTI_InitStructure.EXTI_Line = EXTI_Line0;

EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;

EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;

EXTI_InitStructure.EXTI_LineCmd = ENABLE;

EXTI_Init(&EXTI_InitStructure);

NVIC_InitTypeDef   NVIC_InitStructure;

NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn;

NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x01;

NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x01;

NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

NVIC_Init(&NVIC_InitStructure);

Interrupt is never generated. Any help?
2 REPLIES 2
Posted on October 22, 2013 at 16:29

Does the pin actually transition?

Does it transition in the manner you're detecting?

Do you need to enable/configure the interrupt on the LIS302DL?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
peppea82
Associate II
Posted on October 22, 2013 at 16:39

I've written 0x04 in CTRL_REG_3 to enable Interrupt Generation on Data Ready (INT1 -> PE0). 

Could you please suggest me some code to trigger reading (using provided lis302dl) on interrupt 1?