dmammolo commented on issue #11594:
URL: https://github.com/apache/nuttx/issues/11594#issuecomment-1910235712

   @davids5 I think you are right and I have a suspicion what could cause the 
issue that I am observing. It is probably only an issue in combination with the 
PX4 SPI wrapper/stack.
   
   The issue can only occur if you have multiple devices on the same SPI and/or 
an IMU such as BMI055 or BMI088 which require requesting data for gyro and 
accel separately.
   E.g. if we take the bmi055 there is a chance that the gyro and accel spi 
transfer happens one after each other. During the `spi_dmarxwait(priv)` there 
can be a context switch from accel/gyro which will start a new dma transfer. We 
will then again be in `spi_dmarxwait(priv)`. On some point the dma transfer of 
the first spi dma transfer will be completed and proceed with the code, but in 
the background the dma will be executing the last dma transfer and update the 
memory. This update might happen during the `memcpy(xbuffer, priv->rxbuf, 
nbytes)`. In my case I observed that roughly the first half of the bytes were 
not as expected, e.g. the accel data did contain gyro data in the first half.
   
   I think that the px4 layer is not protecting against this, see my comment 
and link 
[above](https://github.com/apache/nuttx/issues/11594#issuecomment-1908246967).
   
   If you agree I can create an issue on PX4-Autopilot.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to