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

Projects
None yet
6 participants
@mbedNoobNinja
Contributor

mbedNoobNinja commented Sep 8, 2017

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

This comment has been minimized.

Member

0xc0170 commented Sep 8, 2017

@mbedNoobNinja

This comment has been minimized.

Contributor

mbedNoobNinja commented Sep 11, 2017

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

targets/TARGET_RENESAS/TARGET_VK_RZ_A1H/can_api.c Outdated
@@ -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) {

This comment has been minimized.

@mbedNoobNinja

mbedNoobNinja Sep 11, 2017

Contributor

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 ?

This comment has been minimized.

@TomoYamanaka

TomoYamanaka Sep 11, 2017

Contributor

@mbedNoobNinja

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

@TomoYamanaka

This comment has been minimized.

Contributor

TomoYamanaka commented Sep 11, 2017

@mbedNoobNinja

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

cc @0xc0170

@TomoYamanaka

This comment has been minimized.

Contributor

TomoYamanaka commented Sep 11, 2017

@mbedNoobNinja

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

@mbedNoobNinja

This comment has been minimized.

Contributor

mbedNoobNinja commented Sep 11, 2017

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 0xc0170 added needs: work and removed needs: review labels Sep 19, 2017

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Sep 19, 2017

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

@mbedNoobNinja mbedNoobNinja force-pushed the mbedNoobNinja:master branch to 610c8c8 Sep 19, 2017

@mbedNoobNinja

This comment has been minimized.

Contributor

mbedNoobNinja commented Sep 19, 2017

How about now?

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Sep 19, 2017

LGTM

@0xc0170 0xc0170 added needs: CI and removed needs: work labels Sep 26, 2017

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Sep 27, 2017

/morph test

1 similar comment
@studavekar

This comment has been minimized.

Collaborator

studavekar commented Sep 28, 2017

/morph test

@mbed-bot

This comment has been minimized.

mbed-bot commented Sep 28, 2017

Result: SUCCESS

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

/morph test

Output

mbed Build Number: 1416

All builds and test passed!

@0xc0170 0xc0170 added ready for merge and removed needs: CI labels Sep 28, 2017

@theotherjimmy theotherjimmy changed the title from Extended CAN fix to [VK_RZ_A1H] Correct CAN Message ID's and recetption rate in extended mode Sep 28, 2017

@theotherjimmy theotherjimmy changed the title from [VK_RZ_A1H] Correct CAN Message ID's and recetption rate in extended mode to [RZ_A1H] Correct CAN Message ID's and recetption rate in extended mode Sep 28, 2017

@theotherjimmy theotherjimmy changed the title from [RZ_A1H] Correct CAN Message ID's and recetption rate in extended mode to [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

4 checks passed

Cam-CI uvisor Build & Test Success
Details
ci/morph-test Job has completed
Details
continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@theotherjimmy theotherjimmy changed the title from [RZ_A1H] Correct CAN Message ID and recetption rate in extended mode to 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