-
Notifications
You must be signed in to change notification settings - Fork 5
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 gte errors #43
Fix gte errors #43
Conversation
3b0e81e
to
89e30fa
Compare
Looks good to me |
89e30fa
to
d87b467
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice find, thanks for the addition! 😃
Some code seems to have been brought over from #41 which was just merged.
Please rebase and remove the duplicate code =)
Also, add a reference to this PR in the changelog.
This change fixes some issues where watermark sizes were interpreted the wrong way. Before this commit, watermarks for Rx FIFOs and Tx Event FIFO were clamped to the maximum permissible watermark. But the behavior according to the users manual is that watermark sizes over the maximum permissible will disable the corresponding interrupt. P.31 and p.34 of the M_CAN users manual v330 states that Rx FIFO Watermarks, FnWM, can take values 1-64 inclusive. Any value greater than 64 is interpreted as "Watermark interrupt disabled". P.44 of the M_CAN users manual v330 states that the Tx Event FIFO Watermark, EFWM, can take values 1-32 inclusive, Any value greater than 32 is interpreted as "Watermark interrupt disabled". This change makes the implementation consistent with the users manual on those specifics. A value greater than the maximum will be changed to zero for consistency. The bit ranges are 6 bits wide for the Tx Event and 7 bits wide for the Rx configs but the u8 datatype is used in the software interface. That u8 will be masked and shifted so that f.ex. writing 129 to either bit range will actually set the value to 1, not consistent with the user manual. Clamping to any value over the maximum seems arbitrary, and for that reason values larger than the maximum permissible are set to zero, which also disables the interrupt.
d87b467
to
679d891
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice find! LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing the issues.
Approved 👍
- Added - Add `Can::aux::initialization_mode` (GrepitAB#41) - Changed - Fix some issues with watermark sizes for Rx FIFOs and Tx Event FIFO (GrepitAB#43) - Adhere to `filter_map_bool_then` clippy lint (GrepitAB#42)
- Added - Add `Can::aux::initialization_mode` (GrepitAB#41) - Changed - Fix some issues with watermark sizes for Rx FIFOs and Tx Event FIFO (GrepitAB#43) - Adhere to `filter_map_bool_then` clippy lint (GrepitAB#42)
This change fixes some issues where watermark maximum sizes were interpreted the wrong way. Leading to watermarks clamping to the maximum value instead of disabling interrupts on overflow, as per the spec.
Thank you!
Thank you for your contribution.
Please make sure that your submission includes the following:
Must
errors
orwarnings
.cargo +stable fmt
was run.cargo +stable clippy
yields nowarnings
.CHANGELOG.md
in the proper section.newly added features and code.