I'm using a samd21g18a, and trying to connect it to an IMU using an I2C connection. I've set up my chip with atmel start, but am currently experiencing problems when debugging.
I am using the ASF4 functions included in the hal folders, that are generated when using atmel start. The functions can be found here:
In the sidebar navigate to I2C Master Sync -> Functions.
Here, the functions i2c_m_sync_cmd_write and i2c_m_cmd_read are defined. They have specific sequences specified in the manual, in the way that the protocol is set up.
To communicate with my IMU though, a different sequence is used. Both the read and write functions from ASF4 have: sta->address(write)->ack->reg address->ack->resta->address(read)->ack->reg value->nack->stt.
This works alright for reading informations from the registers of the IMU, but when it comes to writing, the sequence is different, and therefore incompatible. If you look at this link: https://invensense.tdk.com/wp-co...
on page 30 chapter 6.3 I2C communications protocol. The singlebyte read sequence is identical, but the write is different.
I've been looking in the function definitions of i2c_m_sync_cmd_write, but can't seem to find where i must make changes to get them to communicate.
Is there any workaround for this? My logic analyser sees proper I2C communication the one way, but nothing happens the other.
The files with the functions are attatched.