Skip to main content
peppea82
Associate II
October 22, 2013
Question

STM32F4 Discovery Integrated LIS302DL Interrupt

  • October 22, 2013
  • 2 replies
  • 716 views
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?
    This topic has been closed for replies.

    2 replies

    Tesla DeLorean
    Guru
    October 22, 2013
    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
    peppea82
    peppea82Author
    Associate II
    October 22, 2013
    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?