mma8453 accelerometer - interrupt always active

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

mma8453 accelerometer - interrupt always active

Jump to solution
1,426 Views
bergo
Contributor III

Hey freescalers,

I'm using mma8453 accelerometer in a current project I'm working on.

I'm setting the interrupt INT 1 to be active low (once setting I can see in the oscilloscope that the INT 1 line is high).

As soon as I finish the rest of the configurations I detect an interrupt, and to clear the interrupt I read the register INT_SOURCE, but I read all 0's, ie. no interrupt to be handled.

looking at the oscilloscope I can see the INT 1 line is now low. and stays low.

I wonder what might be the cause for that and how can I force clean the interrupt line?

Thanks in advance,

Tags (1)
0 Kudos
Reply
1 Solution
1,015 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Bergo,

It would be fine to see your complete source code and schematic.

Anyway, the interrupts are deasserted by reading the appropriate status register for the embedded functions or reading the X, Y and Z data for the DRDY and FIFO.

Regards,

Tomas

View solution in original post

0 Kudos
Reply
3 Replies
1,016 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Bergo,

It would be fine to see your complete source code and schematic.

Anyway, the interrupts are deasserted by reading the appropriate status register for the embedded functions or reading the X, Y and Z data for the DRDY and FIFO.

Regards,

Tomas

0 Kudos
Reply
1,015 Views
tramela
Contributor I

Hi, 

I'm working with the same accelerometer (MMA8453) and i'm expecting exactly the same issue. I already tried a simple code where i'm reading the accelerometer values every time a flag is triggered in the interruption. After it I read the interruption register to clean the interrupt flag. After some time working, my accelerometer stops working and, using a digital analizer, I saw it was the interruption pin that was blocked in low. 

 
Here is some parts of the code where you can see how it was implemented. I already tried to enable the Transient mode but stills not working properly. 

``` 

/**  * configure  * @brief Accelerometer configuration.  *          To configure the MMA8453 set it to Standby mode, perform the  *          modifications and change it back to Active mode.  *  *  @param none  *  *  @return none  *  */ void CMMA8453::configure() {  /* MMA8453 configuration for Data Ready mode */
 /* Set the module in standby mode to configure it */
 this->sleep();

 /* Set full-scale range to 2G */
 this->writeByte(REG_XYZ_DATA_CFG_ADDRESS, REG_RANGE_2G_VALUE);

 /* Configure Transient */
 this->writeByte(REG_TRANSIENT_CFG_ADDRESS, REG_TRANSIENT_ELE_VALUE);

 /* Data Ready mode */
 this->writeByte(REG_CTRL_REG2_ADDRESS, REG_CTRL_REG2_NORMAL_MODE_VALUE);
 /* Set open drain on interrupt pad */
 this->writeByte(REG_CTRL_REG3_ADDRESS, REG_CTRL_REG3_OPEN_DRAIN_WAKE_TRANSIENT_VALUE);
 /* Enable data ready interrupt */
 this->writeByte(REG_CTRL_REG4_ADDRESS, REG_CTRL_REG4_DATA_READY_TRANSIENT_INT_EN_VALUE);
 /* Route interrupt to INT1 pin */
 this->writeByte(REG_CTRL_REG5_ADDRESS, REG_CTRL_REG5_DATA_READY_INT2_VALUE);

 /* Set the module in active mode to start collecting data */
 this->wakeUp(); }

/**
 * hasNewData
 * @brief Check if new accelerometer data is available
 *
 * @param none
 *
 * @return true if new data is available
 * false if new data is not available
 *
 **/
bool
CMMA8453::hasNewData()
{
 /* Request interrupt source */
 uint8_t interruptSource = 0;
 uint8_t interruptTransient = 0;

 if (true == this->has_interrupt_occured ) {

 /* Clear interrupt flags*/
 this->readByte(REG_TRANSIENT_SRC_ADDRESS, &interruptTransient);
 this->readByte(REG_INT_SOURCE_ADDRESS, &interruptSource);

 /* Handle interrupt data is ready */
 if ((interruptSource & REG_SRC_DATA_READY_VALUE) == REG_SRC_DATA_READY_VALUE) {
 /* Signal that new data is available */
 return true;
 }
 }
 return false;

}


/**
 * sleep
 * @brief Put the accelerometer in standby mode
 *
 * @param none
 *
 * @return none
 *
 **/
void
CMMA8453::sleep()
{
 /* Set output data rate (ODR) to 6.25Hz and Standby mode */
 this->writeByte(REG_CTRL_REG1_ADDRESS, (REG_CTRL_REG1_6Hz_VALUE | REG_CTRL_REG1_STANDBY_VALUE));
}


/**
 * wakeUp
 * @brief Put the accelerometer in active mode
 *
 * @param none
 *
 * @return none
 *
 **/
void
CMMA8453::wakeUp()
{
 /* Set output data rate (ODR) to 6.25Hz and Active mode */
 this->writeByte(REG_CTRL_REG1_ADDRESS, (REG_CTRL_REG1_6Hz_VALUE | REG_CTRL_REG1_ACTIVE_VALUE));
}


/**
 * interruptHandler
 * @brief Handles the Interrupt by checking the interrupt source
 * and acts accordingly.
 *
 * @param none
 *
 * @return none
 *
 **/
void
CMMA8453::interruptHandler()
{
 /* Disable Interrupt */
 nrf_drv_gpiote_in_event_disable(CGPIO::INT1_ACC);

 this->has_interrupt_occured = true;

 /* Enable Interrupt */
 nrf_drv_gpiote_in_event_enable(CGPIO::INT1_ACC, true);
}
0 Kudos
Reply
1,015 Views
tramela
Contributor I

I forgot to send the defines:

MMA8453_ADDRESS = 0x1C;

REG_CTRL_REG1_ADDRESS = 0x2A;
REG_CTRL_REG2_ADDRESS = 0x2B;
REG_CTRL_REG3_ADDRESS = 0x2C;
REG_CTRL_REG4_ADDRESS = 0x2D;
REG_CTRL_REG5_ADDRESS = 0x2E;

REG_CTRL_REG1_6Hz_VALUE = 0x30;
REG_CTRL_REG2_NORMAL_MODE_VALUE = 0x00;

REG_CTRL_REG3_OPEN_DRAIN_WAKE_TRANSIENT_VALUE = 0x41;

REG_CTRL_REG4_DATA_READY_TRANSIENT_INT_EN_VALUE = 0x01;

REG_CTRL_REG5_ALL_INT_ROUTED_INT1_VALUE = 0xBD;

REG_TRANSIENT_CFG_ADDRESS = 0x1D;

REG_TRANSIENT_SRC_ADDRESS = 0x1E;

REG_INT_SOURCE_ADDRESS = 0x0C

REG_SRC_DATA_READY_VALUE = 0x01;

Regards

0 Kudos
Reply