STM32F4: I2C with re-starts
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2015-02-27 2:58 AM
Posted on February 27, 2015 at 11:58
Just wondering if it's possible to send/receive I2C data using re-starts instead of Stop/Start.
So I transmit data with:if( HAL_I2C_Master_Transmit(&hi2c2, ADDR_DS, i2c_data, 5, 1000) == HAL_OK )
{
if( HAL_I2C_Master_Receive(&hi2c2, ADDR_DS, i2c_readbuf, 1, 1000) == HAL_OK )
{
// do something
}
}
This will transmit in write mode, STOP, then START in receive mode. Stopping releases the bus so another device could access so I'd rather Transmit (no-stop) then RE-START in receive mode.
Is this possible with current HAL drivers. I guess the function would look something like this: HAL_I2C_Master_Transmit_Receive(&hi2c2, ADDR_DS, i2c_data, 5, i2c_readbuf, 1, 1000) I have tested functionHAL_I2C_Mem_Read and can accomplish re-starts if only transmitting 1 byte, which is probably the most common use anyway.
This discussion is locked. Please start a new topic to ask your question.
0 REPLIES 0
