Read from I2C - STM32F767
Helo friends.
Problem with write on I2C bus I solved.
If anyone wanted to, I would provide a solution
.Now I have problem with reading.
I have got 1 stop bit more.
Here is good communication packet.

I receive:
S-Address-W-A-Command-A-
P
-S-Address-R-A-Data-nA-Puint8_t I2C_read_brekeke(I2C_TypeDef *I2Cx, unsigned char Address, uint8_t reg, int nBytes, unsigned char *data)
{
LL_I2C_SetSlaveAddr(I2Cx, (Address<<1)); /* Prepare Address to send */
LL_I2C_SetMasterAddressingMode(I2Cx, LL_I2C_ADDRSLAVE_7BIT);
LL_I2C_SetTransferRequest(I2Cx, LL_I2C_REQUEST_WRITE); /* Reguest write */
LL_I2C_EnableAutoEndMode(I2Cx); /* Enable autoend mode*/
LL_I2C_SetTransferSize(I2Cx, 1); /* Set transfer size register */
while(LL_I2C_IsActiveFlag_BUSY(I2Cx)){} /* check I2C bussy */
LL_I2C_GenerateStartCondition(I2Cx); /* generate I2C Start address and send address*/
while(!LL_I2C_IsActiveFlag_STOP(I2Cx)) /* check STOP bit */
{
if(LL_I2C_IsActiveFlag_TXE(I2Cx))
{
LL_I2C_TransmitData8(I2Cx, reg); /* send data out */
}
}
LL_I2C_ClearFlag_STOP(I2Cx); /* Clear STOP flag */
LL_I2C_ClearFlag_TXE(I2Cx); /* Clear Transmit data register empty flag */
LL_I2C_SetSlaveAddr(I2Cx, (Address<<1)); /* Prepare Address to send */
LL_I2C_SetMasterAddressingMode(I2Cx, LL_I2C_ADDRSLAVE_7BIT);
LL_I2C_SetTransferRequest(I2Cx, LL_I2C_REQUEST_READ); /* Reguest write */
LL_I2C_EnableAutoEndMode(I2Cx); /* Enable autoend mode*/
LL_I2C_SetTransferSize(I2Cx, nBytes); /* Set transfer size register */
while(LL_I2C_IsActiveFlag_BUSY(I2Cx)){} /* check I2C bussy */
LL_I2C_GenerateStartCondition(I2Cx); /* generate I2C Start address and send address*/
while(!LL_I2C_IsActiveFlag_STOP(I2Cx)) /* check STOP bit */
{
if(LL_I2C_IsActiveFlag_RXNE(I2Cx))
{
*data++ = LL_I2C_ReceiveData8(I2Cx); /* send data out */
}
}
return 0;
}
My call function:
uint8_t ltc[] = {0, 0, 0, 0};
I2C_read_brekeke(I2C4, 0x6F, 0x14, 2, ltc); //address 0x6F; Reg 0x14, receive to ltcIn position 6 I have stop bit. It is wrong.

Any idea, what is wrong?
=================================================================
I found this function: LL_I2C_EnableAuto10BitRead()
Where is wrote:
/**
* @brief Enable automatic RESTART Read request condition for 10bit address header (master mode). * @note The master sends the complete 10bit slave address read sequence : * Start + 2 bytes 10bit address in Write direction + Restart + first 7 bits of 10bit address in Read direction. * @rmtoll CR2 HEAD10R LL_I2C_EnableAuto10BitRead * @param I2Cx I2C Instance. * @retval None */And I try use it, but it doesn't work.
#stm32f767 #read-i2c #nucleo-f767zi