Hello everyone, I'm severely struggling to perform a simple task. I must be missing a very simple answer and, I hope with your help that I resolve the issue.
I am trying to perform write and read commands to my i2c device. I am using the twi_hw_master.c file to perform some of the low level handling. I have my i2c device hooked up to pins 5 (sda) and 6 (scl). I am relying on the internal pull up resistors within the nrf51 for communication.
At the moment, I am seeing that the i2c device becomes unable to read from the device (possibly locking up). It then performs a hardware reinitialization for the twi device on the nrf51.
If I understand the twi_hw_master file and my i2c device, I believe that I have to call the twi_master_transfer() function twice for a i2c read command.
Once, to write the address+W bit followed by the register address that I want to read (with out a stop bit) and, then A second time to read a byte from the I2c Device (followed by a stop bit).
To make this neat and handle problems during mid messages, I created a class to perform a combination of read and write commands. This way, if I failed during the first or second twi_master_transfer function call, I can repeat the process to get the data that I want.
The problem I am experiencing is that the TWI1->ERROR event is being set every time it performs the i2c read command.
Sorry for the long description, I feel like I've been banging my head on this problem for far too long.
p.s. I am using the nrf51 sdk 9.0.0 -Beau