Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enter init mode in builder fn #49

Merged
merged 1 commit into from
Nov 15, 2021

Conversation

systec-ms
Copy link
Contributor

Good day,

I am a little surprised that no one ran into it, so the following may be absolute nonsense.

I have tried both the example of the stm32f7xx-hal (STM32F767 example adapted to bxcan v0.6) and the stm32f4xx-hal (STM32F407). With both the bxcan::CanBuilder::set_bit_timing function and probably also the other implemented functions, which access the CAN_BTR register, has no functionality. This is caused by the fact that the CAN is not in initialization mode.

Page 1561 RM0410 Rev 4:

This register can only be accessed by the software when the CAN hardware is in
initialization mode.

bxcan_1_BTR_wrong

With the function can.modify_config().set_bit_timing(0x001c_0018).enable(); it works, but this sets the initialization mode before.

bxcan_2_BTR_ok

My customization also does this in the bxcan::Can::builder function, after the customization, it works as I would expect it to.

bxcan_3_after_modification

Signed-off-by: Moritz Scheuren <[email protected]>
@jonas-schievink
Copy link
Contributor

Oh, nice catch! I agree with the solution, entering init mode in Can::builder seems like the right way to do this.

bors r+

@bors
Copy link
Contributor

bors bot commented Nov 15, 2021

Build succeeded:

@bors bors bot merged commit d3570b7 into stm32-rs:master Nov 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants