STM32 and Adafruit-MCP23017-Library not working


platformio shows this library is compatible with the stm32 (STM32F103C8).
I've tried the "toggle" example sketch and it does compile and flash without errors.
However, the MCP23017 doesn't output anything.
It's connected to PB6 (SCL1) and PB7 (SDA1).
Do I have to change pin definitions for this library to work?

It does work on my uno without issues.

Thanks in advance!

Have you tried to run an I2C scanner to see if the MCP shows up on the I2C bus and what its address is?

It's it a "blue pill" board?

Stm32f103 have 2 hardware i2c ports and one of them has a choice of pins, so you may need to give the pin numbers when you call wire.begin().


Thank's for the idea with the i2c scanner!
I've also just ordered a cheap Logic analyzer and both really helped me figure out what's going on.
It might seem obvious but i2c really doesn't seem to like it if you have 2 different voltage levels.
I thought i could just connect both chips eventhough the mcp23017 was at 5v and the stm32 at 3.3 volts since the i2c pins on the stm32 are 5v tolerant.
Doesn't work like that, I guess... oops

You need pull up resistors on the I2C signals. 2K2 is good starting point.

Yeah adding a couple 2.2k resistors helped a lot, now it also works on 5V.
I know these are really stupid beginner mistakes, I should have done more research beforehand.
I'm glad you still helped me, I really appreciate that!