Hi forum,
I have an I2C device that has a slave address, followed by a register address within the slave device and then 4 bytes of data for that register.
Following the MSP432E4 Example Project for I2C-Master for Simple Write and Read, I am able to Start a write the slave address (0x23), the register address (0x05), and then the 4 bytes of data (0xFF, 0x7F, 0x3F, 0x00), followed by a Stop. This works exactly as expected:
However, I should also be able to read back the values from the specified register address, but the example I based this off doesn't seem to handle the sending of an which address to read from. It simply reads a specified number of bytes from a slave address.
I think what I need to do is something like the following:
- Send master start with write to slave device address (0x23)
- Send register address I want to read (0x05)
- Send master restart with read to slave device address (0x23)
- Read data from slave address four times (0xFF, 0x7F, 0x3F, 0x00)
- Send stop
Can anyone explain how to do this using DriverLib? The (simplistic) example is interrupt-driven, so the I2C write of the data is a simple call that starts the write and then waits for the state I2C_MASTER_TX to end. All of the intermediate transitions are handled inside the ISR. It simply performs a loopback of two MSP432 boards, one acting as the master and the other acting as the slave.
Thanks in advance for any guidance - this is driving me crazy, and it just can't be that hard.
surrealist14