AnsweredAssumed Answered

Helping in I2C SDK Driver + GPIO Interrupt

Question asked by Matheus Pinto on Aug 31, 2015



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.



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:



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:




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



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.




This occurs only inside the ISR!


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

Original Attachment has been moved to: mma8451.rar