Skip to content

STM32: Setting CAN bus speed on constructor doesn't work #13023

@FabianInostroza

Description

@FabianInostroza

Description of defect

Setting CAN bus speed on constructor doesn't work, the speed doesn't change and it is always set to 100kHz. Changing it using the frequency() method works.

Target(s) affected by this defect ?

Any STM32 with can bus

Toolchain(s) (name and version) displaying this defect ?

GCC_ARM. arm-none-eabi version 9.2.1

What version of Mbed-os are you using (tag or sha) ?

release tag mbed-os-5.15.3

What version(s) of tools are you using. List all that apply (E.g. mbed-cli)

mbed-cli version 1.10.2

How is this defect reproduced ?

Instantiate a CAN object on an STM target and specify any speed other than 100kHz in the constructor. The constructor ignores the hz parameter and always set the speed to 100kHz.

The issue is caused by function can_init_freq that ignores the passed hz parameter:

CAN_INIT_FREQ_DIRECT(obj, &static_pinmap, 100000);

and
CAN_INIT_FREQ_DIRECT(obj, &static_pinmap, 100000);

this is already fixed in master branch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions