The STM32F746G-DISCO discovery board (32F746GDISCOVERY) is a complete demonstration and development platform for STMicroelectronics ARM® Cortex®-M7 core-based STM32F746NGH6 microcontroller.

Data Empty in I2C Communication

27 Dec 2016

Hi, I have some problem about I2C Communication with STM32F746NG-DISCO.

I wrote following programs with mbed library based on DISCO-F746NG_LCDTS_demo.

A I2C device is connected to the I2C1(D14, D15:PB_9, PB_8).

The external pull up resistors are not attached because this disco board has them.

***** (Part of programs )

I2C i2c(I2C_SDA, I2C_SCL);











In this case, the data of i2c_write is empty.


Finally, I found the answer to communicate with the I2C device.

***** (Part of programs )

I2C i2c(I2C_SDA, I2C_SCL);

I2C_HandleTypeDef hi2c1;

static void MX_I2C1_Init(void)


hi2c1.Instance = I2C1;

hi2c1.Init.Timing = 0x2000090E;

hi2c1.Init.OwnAddress1 = 0;

hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;

hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;

hi2c1.Init.OwnAddress2 = 0;

hi2c1.Init.OwnAddress2Masks = I2C_OA2_NOMASK;

hi2c1.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;

hi2c1.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;

HAL_I2C_Init(&hi2c1) ;

HAL_I2CEx_ConfigAnalogFilter(&hi2c1, I2C_ANALOGFILTER_ENABLE) ;



i2c.frequency(100000);In case of only HAL, the speed is 500k. Need re-setting.

HAL_I2C_Mem_Read(&hi2c1,(uint16_t)(0x5A<<1),0x07,I2C_MEMADD_SIZE_8BIT,(uint8_t*) buf,3,3000);

***** /media/uploads/kento621/a2.png

Using HAL Library functions, the communication of i2c is worked well and I can get good data from the device.

Is it a bug of mbed library? Or Is it some interference of I2C port? (the mixed code of mbed and HAL is not elegant... )

Please log in to post a reply.