stm32-rs / bxcan

bxCAN peripheral driver for STM32 chips
Apache License 2.0
32 stars 22 forks source link

Wait for SLAK and INAK bits when changing mode #8

Closed timokroeger closed 3 years ago

timokroeger commented 3 years ago

fixes #7

@xoviat can you please test if this fixes the problems you observed on stm32f4xx?

mdrobnak commented 3 years ago

I have tested this out today, using https://github.com/mdrobnak/stm32f4xx-hal/blob/bxcan/examples/can-send.rs and it was producing 2000 frames a second. Looks good.

xoviat commented 3 years ago

@mdrobnak I'm going to test this tomorrow, but how did you find the the correct pin setting was alternate_af9?

mdrobnak commented 3 years ago

@mdrobnak I'm going to test this tomorrow, but how did you find the the correct pin setting was alternate_af9?

In the microcontroller docs there's a pin mapping to Alternate Function guide. https://www.st.com/resource/en/datasheet/dm00037051.pdf Table 9.

-Matt

xoviat commented 3 years ago

@timokroeger There may be some clock issues somewhere in the stack (at least it seems to me at this point), but this seems to work for me as a good first step. I'm happy with the API, and I can submit further non-breaking changes to fix the clock issues if I find them. Please go ahead and merge this.

jonas-schievink commented 3 years ago

bxcan does no clock configuration besides writing the raw user-provided value to the bit timing register

mdrobnak commented 3 years ago

This already works better than the previous driver I was using so anything moving forward is good. Thanks!

xoviat commented 3 years ago

@jonas-schievink I mean 'somewhere in the stack'. I haven't looked into the issue yet, so there's nothing for me to submit at this point.