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

NUVOTON: CAN: Fix Rx interrupt and filter mask #15509

Merged
merged 4 commits into from
Apr 23, 2024

Conversation

ccli8
Copy link
Contributor

@ccli8 ccli8 commented Apr 18, 2024

Summary of changes

This PR fixes Nuvoton targets which support CAN (not CAN-FD) IP:

  1. Fix Rx interrupt isn't correctly handled.
  2. Fix Tx and filter 0 collide on Message Object 0. Now reserve Message Object 31 for Tx.
  3. Fix filter mask=0 to "any match" from "exact match".
  4. Fix filter mask value doesn't pass to BSP CAN driver correctly.

Pull request type

[X] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

NOTE: This fix only targets CAN (M453/M487), not CAN-FD (M467).
NOTE: NUC472 CAN doesn't support filter.
Major modifications:
1. Handle Rx interrupt based on Message Object interrupt (CAN_IIDR=0x0001~0x0020) instead of CAN_STATUS.RxOK
2. Also handle Tx interrupt following above for consistency

Other related modifications:
1. Fix signature type error in CAN_CLR_INT_PENDING_BIT()
2. Add CAN_CLR_INT_PENDING_ONLY_BIT() which doesn't clear NewDat flag so that user can fetch received message in thread context

NOTE: This fix only targets CAN (NUC472/M453/M487), not CAN-FD (M467).
…interrupt

1.  The same Message Object number cannot use for both Tx and Rx simultaneously.
    For Tx, Message Object number 31 is reserved instead of 0.
    For Rx, Message Object numbers 0~30 are used and for filters.
2.  NewDat bit (CAN_IsNewDataReceived()) isn't exclusive to Rx.
    Recognize Rx interrupt by Message Object number other than 31.

NOTE: This fix only targets CAN (NUC472/M453/M487), not CAN-FD (M467).
Copy link

mergify bot commented Apr 18, 2024

⚠️ The sha of the head commit of this PR conflicts with #15508. Mergify cannot evaluate rules on this PR. ⚠️

On mask being zero, it means any match, not exact match.

NOTE: This fix only targets CAN (M453/M487), not CAN-FD (M467).
NOTE: NUC472 CAN doesn't support filter.
@ccli8 ccli8 force-pushed the nuvoton_fix_can_interrupt branch from e4a55c8 to c1c9550 Compare April 18, 2024 05:30
@0xc0170
Copy link
Contributor

0xc0170 commented Apr 23, 2024

CI started

@0xc0170 0xc0170 added needs: CI release-type: patch Indentifies a PR as containing just a patch labels Apr 23, 2024
@mbed-ci
Copy link

mbed-ci commented Apr 23, 2024

Jenkins CI Test : ❌ FAILED

Build Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_greentea-test

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 23, 2024

Looks fine, there's one device not available. I have to check how to restart it.

@0xc0170 0xc0170 merged commit 8502c74 into ARMmbed:master Apr 23, 2024
18 of 20 checks passed
@mergify mergify bot removed the ready for merge label Apr 23, 2024
@ccli8 ccli8 deleted the nuvoton_fix_can_interrupt branch April 24, 2024 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-type: patch Indentifies a PR as containing just a patch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants