Open stenbergd opened 9 years ago
Using the INT1 pin to send an interrupt to CPU now works, but we really want one of the acc or mag interrupts to go through the DRDY pin on the LSM303DLHC.
The pulse width of the INT1 set to DRDY1 using the oscilloscope is 750microseconds.
The actual time to read the accelerometer is 480 microseconds, as measured on GPIO pin & oscilloscope. This is the time it takes for BSP_ACCELERO_GetXYZ
to execute, reading only 1 value at a time instead of 6 in one go.
The interval between the flanks of the INT1 and "accelerometer read" pulses is about 25 microseconds. This is the time it takes to send a message to a queue from the ISR, the message to leave the queue.
According to chapter "I2C Operation" in LSM303DLHC" Data Sheet, multiple read/write seem possible though the current STM32Cube code does not appear to take advantage of this.
Interrupts now work for Gyroscope, Accelerometer and Magnetometer.
Still work to do according to previous comment and also with DMA:
It takes about half a millisecond to read the magnetometer and accelerometer respectively.
Improve the sensor data reading from accelerometer, magnetometer and gyroscope.
By using an interrupt for when sensor data is ready (DRDY pin/INT1/IN2 pins from sensors) and reading it through DMA - much more efficient sensor reading and CPU usage.
Read more: http://letanphuc.net/2014/06/stm32-mpu6050-dma-i2c/