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.

MSPM0G3507: 硬件I2C 发送延迟

Part Number: MSPM0G3507

今天使用硬件I2C,打算写一下poll方式的硬件i2c发送,这边发送100个数据,中间有1.7ms的延迟,总耗时为0.2ms 

时钟频率为32mhz iic速度为100khz,如果使用官方例程的话同样也有1.7ms的延迟,希望有官方可以解答一下。

以及如何避免这个问题。

附代码

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
int8_t I2C_Send_Poll(I2C_Regs *i2c,uint32_t targetAddr,uint8_t set_reg,uint8_t *buffer,uint16_t count,int8_t use_reg_flag) //-10
{
//.
int timeout=50000; //
uint32_t gTxCount=7,toolong=0; //fifo
//fifo
if (gTxCount < count) {
toolong=1;
} else {
toolong=0;
}
if (use_reg_flag) { //使reg
DL_I2C_transmitControllerData(i2c, set_reg); //regfifo
}
gTxCount=DL_I2C_fillControllerTXFIFO(i2c, buffer, count); // FIFO
while (!(DL_I2C_getControllerStatus(i2c) & DL_I2C_CONTROLLER_STATUS_IDLE)); // I2C线
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

附图,黄色的点为ACK。

使用官方例程

使用我写的函数

x 出现错误。请重试或与管理员联系。