Search code examples
arduinostm32i2ccortex-m

How to scan I2C slave address on STM32?


I'm trying to communicate with an mpu9250 with STM32 via I2C, but I can't determine the slave address. (I am using a usb bootloader.)


Solution

  • According to the datasheet (https://www.invensense.com/wp-content/uploads/2015/02/PS-MPU-9250A-01-v1.1.pdf) page 12,

    the default I²C slave address of the MPU9250 is 0b1101000(=0x68=104) or 0b1101001(=0x69=105) depending on the value of pin AD0.

    If you use two MPU9250, you can differentiate them by using one with the first address and the other one with the other address by putting a logic LOW on the AD0 pin of the first MPU and a logic HIGH on the AD0 pin of the second MPU.