Skip to content

[STM32] CAN write() return value #3464

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

Closed
szechyjs opened this issue Dec 16, 2016 · 6 comments
Closed

[STM32] CAN write() return value #3464

szechyjs opened this issue Dec 16, 2016 · 6 comments

Comments

@szechyjs
Copy link
Contributor

szechyjs commented Dec 16, 2016

Description

According to the CAN.h header file the write() method is only supposed to return 1 if send was successful. All of the STM32 implementations in can_api.c are hard coded to return 1;.

The NXP targets implement this correctly, can_api.c


Bug

Target
STM32

Expected behavior
Only return 1 if write was successful.

Actual behavior
Returns 1 regardless if write was successful.

Steps to reproduce

if (can1.write(CANMessage(1337, &data, sizeof(data)))
{
    // This will always print
    printf("tx\n");
}
@0xc0170
Copy link
Contributor

0xc0170 commented Dec 19, 2016

@adustm
Copy link
Member

adustm commented Dec 19, 2016

Hello @0xc0170 @szechyjs
It is not obvious to me that the can_write function is supposed to do some polling as long as the msg is not written.
We are just preparing the sending of the the system and setting the interruptions to be notified when the msg is sent.

Cheers

@adustm
Copy link
Member

adustm commented May 5, 2017

Hello
What do we do with this issue ? Is it sure that we are supposed to wait ?
I've seen that @Nodraak has created a PR for the read part. Would you be interested into creating a PR for the write part also ?

Cheers

@Nodraak
Copy link
Contributor

Nodraak commented Jul 6, 2017

Hi !

What is the status here ? It seems that the issue has been fixed by commit 1c4e0d7, as can_write() can sometimes return 0.

@adustm
Copy link
Member

adustm commented Aug 1, 2017

Hi,

It seems that the issue has been fixed by commit 1c4e0d7, as can_write() can sometimes return 0.

I think you are right.
@szechyjs could you please check if it fits your need and maybe clode the issue ?

Kind regards

@0xc0170
Copy link
Contributor

0xc0170 commented Aug 2, 2017

I'll close this . Please reopen if any new update

@0xc0170 0xc0170 closed this as completed Aug 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants