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

fix bit timing register values #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Michael-Low
Copy link

From the datasheet section 22.7.7 linked below, the number of clock cycles for a single bit is 1 + (TS1[3:0] + 1) + (TS2[2:0] + 1). Using the previous values of 12 and 3 for TS1 and TS2 respectively, this lead to a bit length of 18 clock cycles. With a BRP value of 15 for a prescaler of 16 to achieve a bitrate of 125kbit/s, the bit length would be 1/32 us * (18) * (16), leading to a bit length of 9 us instead of the targeted 8 us. With the values of 11 and 2 for TS1 and TS2 instead, the bit length is 1/32 us * 16 * 16 which corresponds with the correct bit length of 8us, while still having an 80% sample point.

https://www.keil.com/dd/docs/datashts/st/stm32f10xxx.pdf

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.

1 participant