This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software:
Hi team,
My customer would like to confirm the following.
When they read access to the target device with I2C, it is necessary to output in a format that corresponds to "repeated Start condition".
Could you tell us how to set it?
Thank you in advance.
Best regards,
Kenley
Hello Kenley,
About the description about the "repeated start condition" of I2C, you can refer to the chapter 18.2.3.5 Repeated Start in the Series G User guide:
MSPM0 G-Series 80-MHz Microcontrollers Technical Reference Manual (Rev. A) (ti.com)
And my colleague has written a segment of demo code about the repeated start condition, you can refer to its logic at the same time.
//i2c for drv8234 with mspm0 uint8_t i2c_read(uint8_t reg_address){ uint8_t write,read; write = reg_address; /************************************************************************************* * Fill the FIFO * The FIFO is 8-bytes deep, and this function will return number of bytes written to FIFO */ DL_I2C_flushControllerRXFIFO(I2C_INST); DL_I2C_flushControllerTXFIFO(I2C_INST); DL_I2C_fillControllerTXFIFO(I2C_INST, &write, 1); /* Send the packet to the controller. * This function will send Start + Stop automatically. */ /* Wait for I2C to be Idle */ while (!(DL_I2C_getControllerStatus(I2C_INST) & DL_I2C_CONTROLLER_STATUS_IDLE)); DL_I2C_startControllerTransferAdvanced(I2C_INST, DRIVE_8234_SLAVE_ADDR, DL_I2C_CONTROLLER_DIRECTION_TX, 1, DL_I2C_CONTROLLER_START_ENABLE, DL_I2C_CONTROLLER_STOP_DISABLE, DL_I2C_CONTROLLER_ACK_DISABLE); /* Poll until the Controller writes all bytes */ // Helic: Change bus busy to controller status busy while (DL_I2C_getControllerStatus(I2C_INST) & DL_I2C_CONTROLLER_STATUS_BUSY); /* Trap if there was an error */ if (DL_I2C_getControllerStatus(I2C_INST) & DL_I2C_CONTROLLER_STATUS_ERROR) { /* LED will remain high if there is an error */ __BKPT(0); } /* Send a read request to Target */ DL_I2C_startControllerTransfer(I2C_INST, DRIVE_8234_SLAVE_ADDR, DL_I2C_CONTROLLER_DIRECTION_RX, 1); while(DL_I2C_isControllerRXFIFOEmpty(I2C_INST)); read = DL_I2C_receiveControllerData(I2C_INST); delay_cycles(3000); return read; }
Best Regards,
Janz Bai