Skip to content

SetConfig does not work on STM32 I2C #3914

@agrif

Description

@agrif

I'm using the I2cDeviceWithConfig struct in embassy-embedded-hal, but it does not appear to be actually changing the I2C bus frequency. I'm using the bus with the ssd1306 crate to draw to a small display on an STM32F072CB microcontroller.

If I use a plain I2cDevice with the underlying I2C bus configured to 100kHz, it takes about 120ms to write to the device. If I configure the underlying I2C bus to 200kHz, it takes about 60ms (as expected).

However, if I use an I2cDeviceWithConfig set to 200kHz on top of an underlying I2C bus configured for 100kHz, the flush takes 120ms still. It looks like the configuration override isn't happening at all.

I'm using embassy-embedded-hal 0.3.0 and embassy-stm32 0.2.0. It looks like the implementation of this trait has not changed between 0.2.0 and the latest git.

The embassy docs link to v2 of the I2C peripheral for my MCU, but I must admit I don't know if the STM32F072CB uses v1 or v2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions