- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi.
Now I'm writing I2C master program referring to the following.
FM_PDL_2.0.1/example/mfs/i2c/i2c_polling/i2c_master_polling/main.c
To read some data from slave to master, the sample program is using I2c_Read().
And this function is calling Mfs_I2c_ConfigAck() to send ACK or NACK to slave.
But the description of Mfs_I2c_ConfigAck() says "Configure ACK signal sent to master", "This function is only meaningful when I2C is in slave mode". (mfs.c L.3527~)
Can I use Mfs_I2c_ConfigAck() in master program?
Why I ask this, my I2C master program (on FM0+ S6E1C) has stop in Mfs_I2c_GetStatus() loop (main.c L.272~) after reading first byte. So I doubt that NACK has not been transmitted properly.
The 1 byte looks like correct, but can't read any more.
thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry, this discussion will be my answer.
I'm using same (ARM) environment.
I will try a modified Mfs_I2c_ConfigAck() on the next business day.
en_result_t Mfs_I2c_ConfigAck(volatile stc_mfsn_i2c_t* pstcI2c, en_i2c_ack_t enAck)
{
stc_mfs_i2c_ibcr_field_t stcIbcr;
if (NULL != pstcI2c)
{
return ErrorInvalidParameter;
}
stcIbcr = pstcI2c->IBCR_f;
stcIbcr.ACKE = (I2cAck == enAck) ? 1u : 0u;
stcIbcr.ACT_SCC = 0u; /* Set SCC = 0 to avoid generating a restart */
pstcI2c->IBCR = *((uint8_t *)(&stcIbcr));
return Ok;
}