CAN words

Report here problems in any of ChibiOS components. This forum is NOT for support.
steved
Posts: 823
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 135 times

CAN words

Postby steved » Fri Nov 17, 2017 7:27 pm

Minor points:

1. All the CAN test projects for different processors use the same setup values (with one exception - 32L4, IIRC), yet the processors have varying clock speeds. So the comment as to '500kHz baud rate' can't always be correct
2. Probably impossible to implement sensibly, but the CAN setup values should ideally be calculated using the actual clock tree configuration (although I wonder how much people change things from the settings in the demo they picked as a starting point). Perhaps just a note to say that the config needs updating dependent on configured clock dividers, and maybe give the settings the current values assume.
3. There's a lot of use of canTransmit() and canReceive(), which I understand to be deprecated in favour of canTransmitTimeout() and canReceiveTimeout().

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: CAN words

Postby Giovanni » Mon Dec 31, 2018 11:14 am

bump

faisal
Posts: 374
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 44 times
Been thanked: 60 times

Re: CAN words

Postby faisal » Mon Dec 31, 2018 7:23 pm

The configuration should be in portab.c/.h .

I usually declare the PeriphalConfig struct in the application code, along with the platform independent fields. Then use a macro in portab.h which defines the platform dependent fields.

Code: Select all

CANConfig can1cfg
{
     /* platform independent fields (none for CAN) */
     PORTAB_CAN1_CONFIG, /* platform dependent fields defined in portab.h */
}


I like doing it this way instead of declaring the peripheral structures entirely in portab.c and exporting them via a global. Less code to duplicate, fewer globals, and leverages the platform independent layer of the HAL.

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: CAN words

Postby Giovanni » Sun Nov 10, 2019 10:19 am

bump


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 18 guests