I spent about an hour trying to figure out why CAN2 was not working. Reading the reference manual revealed that CAN2 accesses RAM through CAN1, so CAN1 must be started in order to use CAN2, even if CAN1 is not used to send/receive messages.
I think it would be reasonable to start CAN1 in the CAN2 init function if it hasn't been already. What are everyone's thoughts on this?
Erick
[DONE]Automatically starting CAN1 when CAN2 is started
Moderator: RoccoMarco
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Automatically starting CAN1 when CAN2 is started
Hi,
I am undecided on this. I don't like a driver changing the state of another driver in an hidden way. I would be more oriented to add an assertion to catch the invalid case.
Giovanni
I am undecided on this. I don't like a driver changing the state of another driver in an hidden way. I would be more oriented to add an assertion to catch the invalid case.
Giovanni
Re: Automatically starting CAN1 when CAN2 is started
That seems fair. Having any sort of error checking or assertion would be an improvement.
Erick
Erick
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: [DONE]Automatically starting CAN1 when CAN2 is started
Hi,
I committed the CAN driver with the extra checks, it should be OK now.
Giovanni
I committed the CAN driver with the extra checks, it should be OK now.
Giovanni
Re: [DONE]Automatically starting CAN1 when CAN2 is started
Thanks Giovanni,
I'll take a look tomorrow.
Erick
I'll take a look tomorrow.
Erick