I am working on a project including the Artemis Nano and also struggling to fully understand the am_hal_iom_nonblocking_transfer
function. I simply need to read sensor values via I2C. I assume you were using this function to get the I2C communication to work. Would you be so kind to explain how you have used the offset to specify the sub-adress of the register you were trying to read?
What I have tried so far is to send two bytes with the first one containing the 7-bit slave address plus the write bit and the second byte being the sub-address of the register containing the sensor measurements. In a second function call I have set the read/write bit to read
and the direction to read
as well, expecting the sensor value to get stored in the RxBuffer
. Unfortunately that did not work.
I tried to follow along the datasheet for the ST LSM6DSOX
, which can be found here for reference: https://www.st.com/en/mems-and-sensors/lsm6dsox.html
If you could provide me with a simply read and write example, that would be really highly appreciated.