Refined CAN Settings Logic in the Code#37
Open
MaRuolang wants to merge 1 commit intoOpenNuvoton:masterfrom
Open
Refined CAN Settings Logic in the Code#37MaRuolang wants to merge 1 commit intoOpenNuvoton:masterfrom
MaRuolang wants to merge 1 commit intoOpenNuvoton:masterfrom
Conversation
1. Remove incorrect UMask bit setting in CAN_IFn_MCON within CAN_SetRxMsgObj. 2. Align CAN_IFn_MASK setting logic with CAN_IFn_ARB in CAN_SetRxMsgObjAndMsk.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request improves the logic related to CAN configuration, specifically correcting the misuse of mask settings and simplifying the setup for message objects. The changes include:
Modification 1: The
CAN_SetRxMsgObjfunction no longer incorrectly sets theUMASKbit in theCAN_IFn_MCONregister, aligning with the chip manual's guidance.Modification 2: The
CAN_SetRxMsgObjAndMskfunction has been updated for clarity, making the setup for standard and extended frame IDs more intuitive.Before and After:
Standard ID Setup:
CAN_SetRxMsgObjAndMsk(tCAN, MSG(0), CAN_STD_ID, 0x003, (0x00F << 2) << 16, TRUE);CAN_SetRxMsgObjAndMsk(tCAN, MSG(0), CAN_STD_ID, 0x003, 0x00F, TRUE);Extended ID Setup:
CAN_SetRxMsgObjAndMsk(tCAN, MSG(0), CAN_EXT_ID, 0x00000003, CAN_IF_MASK2_MXTD_Msk | 0x0000000F, TRUE);CAN_SetRxMsgObjAndMsk(tCAN, MSG(0), CAN_EXT_ID. 0x00000003, 0x0000000F, TRUE);These updates ensure the CAN configuration is both correct and user-friendly, adhering closely to the intended design and documentation.