[DONE]Automatically starting CAN1 when CAN2 is started

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
efuentes
Posts: 35
Joined: Wed Jul 25, 2012 6:16 am

[DONE]Automatically starting CAN1 when CAN2 is started

Post by efuentes »

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
User avatar
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

Post by Giovanni »

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
efuentes
Posts: 35
Joined: Wed Jul 25, 2012 6:16 am

Re: Automatically starting CAN1 when CAN2 is started

Post by efuentes »

That seems fair. Having any sort of error checking or assertion would be an improvement.

Erick
User avatar
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

Post by Giovanni »

Hi,

I committed the CAN driver with the extra checks, it should be OK now.

Giovanni
efuentes
Posts: 35
Joined: Wed Jul 25, 2012 6:16 am

Re: [DONE]Automatically starting CAN1 when CAN2 is started

Post by efuentes »

Thanks Giovanni,

I'll take a look tomorrow.

Erick
Post Reply