-
Notifications
You must be signed in to change notification settings - Fork 3k
Changes required in STM CAN read API #14677
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
Changes required in STM CAN read API #14677
Conversation
@MubeenHCLite, thank you for your changes. |
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.
otherwise LGTM
targets/TARGET_STM/can_api.c
Outdated
@@ -956,8 +958,10 @@ int can_write(can_t *obj, CAN_Message msg, int cc) | |||
|
|||
int can_read(can_t *obj, CAN_Message *msg, int handle) | |||
{ | |||
|
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.
this empty space is not needed?
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.
@MubeenHCLite ping :-)
@MubeenHCLite Please fill in the sections in the pull request template (PR type, how was it tested) |
@MubeenHCLite could you please fill in the PR template header correctly as per the guidelines provided. |
This pull request has automatically been marked as stale because it has had no recent activity. , please complete review of the changes to move the PR forward. Thank you for your contributions. |
This PR cannot be merged due to conflicts. Please rebase to resolve them. |
Please rebase instead of merging (clean linear history). Commit b6cab7 should not be in the pull request |
Can this be rebased and we can proceed? |
I have rebased the branch to current master head |
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.
Comment from @cindyli-13 not fully addressed.
Seems that multiple filter configuration can be supported
@cindyli-13 has already confirmed it is working fine |
So maybe comments like |
6b6cab7
to
4c47d15
Compare
This PR cannot be merged due to conflicts. Please rebase to resolve them. |
Sorry if I wasn't clear earlier. I tested using a different Mbed patch and can confirm that I am able to configure multiple CAN filters. However I think that this PR will prevent the ability to configure multiple CAN filters because the |
I will complete the implementation shortly and submit the PR |
Added working code to accept filter IDs for both bxCAN and FDCAN. Tested the patch on multiple can instances and results are as desired. Note : Currently there is no way we can configure the number of standard/extended IDs to be filtered in FDCAN (List size Standard, list Size extended, refer RM), hence they are by default set to maximum possible values. |
I can confirm that it works and fixes the handle addressing Here is a test code, only #include <mbed.h>
CAN can(PB_8, PB_9);
DigitalOut can_sleep(PB_7, 0);
#define ID 0xFF0080
#define ID2 0xFF0580
#define MASK 0xFFFFFF
int main() {
can.frequency(250000);
can.mode(CAN::Normal);
can.filter(ID, MASK, CANExtended, 0);
can.filter(ID2, MASK, CANExtended, 1);
CANMessage msg;
printf("start\n");
while (1) {
if (can.read(msg)) {
printf("Message received ID: %X\n", msg.id);
}
}
} It would be nice if following warnings could be fixed as well
|
@pilotak We will take up resolving all the warnings in a separate issue. |
ST_INTERNAL_REF 109607 |
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.
Just one style nit
targets/TARGET_STM/can_api.c
Outdated
@@ -1130,6 +1135,8 @@ int can_filter(can_t *obj, uint32_t id, uint32_t mask, CANFormat format, int32_t | |||
{ | |||
success = 1; | |||
} | |||
} else if (format == CANAny) { | |||
success = 0; // filter for CANAny is not supported by STM32, return a failure |
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.
aligned to 4 spaces (it's just 2?)
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.
Corrected the alignment
CI started |
Jenkins CI Test : ✔️ SUCCESSBuild Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & ArtifactsCLICK for Detailed Summary
|
Summary of changes
Added working functionality for both bxCAN and FDCAN where the CAN can accept filter IDs and work as desired.
FIFO selection in case of can_read is not supported as the can_filter sets FIFO0 as default FIFO, and the same is updated.
Impact of changes
Migration actions required
Documentation
Pull request type
Test results
Tests were carried out on both FDCAN and bxCAN, where multiple IDs were updated to be filtered on multiple CAN instances.
Results were verified that the filtering is as required.
Reviewers