AnsweredAssumed Answered

Helping in I2C SDK Driver + GPIO Interrupt

Question asked by Matheus Pinto on Aug 31, 2015

Hello,

 

I am trying to do a driver for the freescale mma8451q accelerometer, using the KSDK + KDS 3.0.0 + Processor Expert.

For test, was made a function calling in main.

 

kkk.png

The function waits a logic 1 in PTA13 to run. There are two options to read the samples from accelerometer:

pooling e interrupt.

 

First, was tested the pooling mode, where the function constantly reads the samples from accelerometer, setting a LED from LED RGB, corresponding to the axis, using this loop:

 

kkk.png

The firmware works right and the first test was passed.

 

In the second test was used the interrupt mode from accelerometer. When a sample is taken from accelerometer, a interrupt, active LOW, is generated in the pin PTA14.

 

Uncomment this loop, to active interrupt:

 

kkk.png

 

The loop used for pooling now is empty, and is used the ISR from PTA14 interrupt to read the samples.

 

kkk.png

But, when try to read the samples, the accel_GetXYZ function gets stucked in the I2C_DRV_MasterReceive function when try send the address of the slave.

 

kkk.png

 

This occurs only inside the ISR!

 

The project is attached (the comments are in portuguese. Sorry!!!)

Original Attachment has been moved to: mma8451.rar

Outcomes