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

RZ_A1H: Correct CAN Message ID and recetption rate in extended mode #5050

Merged
merged 1 commit into from
Sep 28, 2017

Conversation

mbedNoobNinja
Copy link
Contributor

Notes:

  • Bug fix.

Description

  • The CAN module produce a substantially different message ID, when using Extended mode.
  • The CAN module hardly receives external messages from the bus (produced from nods other than VK_RZ_A1H platforms), so I tweaked the SJW field to be more tolerant to the incoming message's frequency (bitrate).

Steps to test or reproduce

Just use the CAN in extended mode and try to receive a message from node which is clocked exactly at 500 kbps.

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 8, 2017

cc @TomoYamanaka

@mbedNoobNinja
Copy link
Contributor Author

Also a normal Data message is read as Remote when using Extended mode.

@@ -703,14 +703,14 @@ int can_read(can_t *obj, CAN_Message *msg, int handle) {
/* send/receive FIFO buffer isn't empty */
dmy_cfsts = CFSTS_TBL[obj->ch][CAN_RECV];
while ((*dmy_cfsts & 0x01) != 0x01) {
/* get format, frame type and send/receive FIFO buffer ID(b10-0 or b28-11) */
/* get format, frame type and send/receive FIFO buffer ID(b10-0 or b28-0) */
dmy_cfid = CFID_TBL[obj->ch][CAN_RECV];
msg->format = (CANFormat)(*dmy_cfid >> 31);
msg->type = (CANType)(*dmy_cfid >> 30);
if (msg->format == CANStandard) {
Copy link
Contributor Author

@mbedNoobNinja mbedNoobNinja Sep 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this causes the problem:
msg->format = (CANFormat)(*dmy_cfid >> 31);
msg->type = (CANType)(*dmy_cfid >> 30);
which should be:
msg->format = (CANFormat)(*dmy_cfid >> 31);
msg->type = (CANType)((*dmy_cfid >> 30) & 0x1);

Should I fix it ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mbedNoobNinja

Thank you for your advice. It seems that is right.

@TomoYamanaka
Copy link
Contributor

@mbedNoobNinja

I think that there is no problem for your change.
Thank you.

cc @0xc0170

@TomoYamanaka
Copy link
Contributor

@mbedNoobNinja

I appreciate if you reflect your all changes that you mentioned in this thread to can_api.c for RZ_A1H too ?

@mbedNoobNinja
Copy link
Contributor Author

You are done.
It would be nice, if there was a function which can set the sample point of the can receiver to something different from 66,7%, but that's just a idea. The user can always change the source code to what he need.

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 19, 2017

@mbedNoobNinja Can you please rebase instead of merge (remove the second merge commit) ?

@mbedNoobNinja
Copy link
Contributor Author

How about now?

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 19, 2017

LGTM

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 27, 2017

/morph test

1 similar comment
@studavekar
Copy link
Contributor

/morph test

@mbed-bot
Copy link

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 1416

All builds and test passed!

@theotherjimmy theotherjimmy changed the title Extended CAN fix [VK_RZ_A1H] Correct CAN Message ID's and recetption rate in extended mode Sep 28, 2017
@theotherjimmy theotherjimmy changed the title [VK_RZ_A1H] Correct CAN Message ID's and recetption rate in extended mode [RZ_A1H] Correct CAN Message ID's and recetption rate in extended mode Sep 28, 2017
@theotherjimmy theotherjimmy changed the title [RZ_A1H] Correct CAN Message ID's and recetption rate in extended mode [RZ_A1H] Correct CAN Message ID and recetption rate in extended mode Sep 28, 2017
@theotherjimmy theotherjimmy merged commit 323dc93 into ARMmbed:master Sep 28, 2017
@theotherjimmy theotherjimmy changed the title [RZ_A1H] Correct CAN Message ID and recetption rate in extended mode RZ_A1H: Correct CAN Message ID and recetption rate in extended mode Sep 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants