I am using nrf51822, sdk version 11.0, sofdevice 130, i2c initialized in non-blocking mode. The read seems ok. The write is problematic for me.
I am using nrf51822, sdk version 11.0, sofdevice 130, i2c initialized in non-blocking mode. The read seems ok. The write is problematic for me.
Which I2C device are you trying to write to? You will have to look in the datasheet of the device you are interfacing to know how to perform a write operation.
Typically you put the register address and your data into a buffer and then transfers this to the device using a single nrf_drv_twi_tx() call. See for instance the function eeprom_write()
in TWIS Slave and TWI Master mode drivers Example in the SDK.
Which I2C device are you trying to write to? You will have to look in the datasheet of the device you are interfacing to know how to perform a write operation.
Typically you put the register address and your data into a buffer and then transfers this to the device using a single nrf_drv_twi_tx() call. See for instance the function eeprom_write()
in TWIS Slave and TWI Master mode drivers Example in the SDK.
MPU56050. I try to write to register 0x1F value 0xFF.
I have done this:
uint8_t buffer[] = {0x1FU, 0xFFU};
nrf_drv_twi_tx(&twi_instance, slave_address, buffer, sizeof(buffer), false);
I'll take a look at that. Thank you!
Here is an example project for the MPU-6050. Can you test it out if you did not get it working yet?
Hello Jorgen ! With the help of your example, I made it work ! It was the waking up of the MPU6050 that was my problem ! Thank you, Jorgen ! I think this example should be part of a twi_example in the sdk.