0
votes

I can understand that you can use first frame option for first frame and next frame options for others, but since you can use them as FIRS_FRAME_LAST_FRAME, what is the advantage of other? and when we must use them?

Findings: A code use wile to continuously transmit two number and get a callback to see if module has accepted that, if this happen correctly the led must blink.

In this simple code I've tested every xferoption of sequential transmission, every options worked except: I2C_LAST_FRAME_NO_STOP and I2C_FIRST_FRAME. Code:

while (1)
  {
      value=300;
      *(uint16_t*) buffer=(value<<8)|(value>>8);//Data prepared for DAC module
      HAL_I2C_Master_Seq_Transmit_IT (&hi2c1, (MCP4725A0_ADDR_A00<<1), buffer, 2,I2C_LAST_FRAME_NO_STOP);
      HAL_Delay(1);
      HAL_I2C_Master_Receive(&hi2c1, (MCP4725A0_ADDR_A00<<1), rxbuffer, 3, 1000);
      if( (uint16_t)(((uint16_t)rxbuffer[1])<<8|((uint16_t)rxbuffer[2]))>>4 == value ){
          HAL_GPIO_WritePin(LED_GPIO_Port,LED_Pin,GPIO_PIN_SET);}

      HAL_Delay(50);

      value=4000;
      *(uint16_t*) buffer=(value<<8)|(value>>8);
      HAL_I2C_Master_Seq_Transmit_IT (&hi2c1, (MCP4725A0_ADDR_A00<<1), buffer, 2,I2C_LAST_FRAME_NO_STOP);
      HAL_Delay(1);
      HAL_I2C_Master_Receive(&hi2c1, (MCP4725A0_ADDR_A00<<1), rxbuffer, 3, 1000);
      if( (uint16_t)(((uint16_t)rxbuffer[1])<<8|((uint16_t)rxbuffer[2]))>>4 == value ){
          HAL_GPIO_WritePin(LED_GPIO_Port,LED_Pin,GPIO_PIN_RESET);}

      HAL_Delay(50);
}
You need to specify which stm32 part you are using (eg: stm32f407) because the I2C peripherals are very different between the older and newer stm32 parts (the older ones are rubbish!).Tom V
@TomV STM32f746ngmohammadsdtmnd
There is a lot of documentation in the comments in file stm32f7xx_hal_i2c.c, but also read the definition of these mode constants in stm32f7xx_hal_i2c.h. Several of them have the exact same definition, so obviously they are don't do anything different.Tom V
@TomV Yes, I know their behavior according to their *.c file description. But I want to know their application. when using sequential functions are important.mohammadsdtmnd