error CAN settings in HAL example

Report here problems in any of ChibiOS components. This forum is NOT for support.
Alexte
Posts: 27
Joined: Sun Jul 01, 2012 1:24 pm

error CAN settings in HAL example

Postby Alexte » Tue Mar 01, 2016 8:44 pm

testhal\STM32\STM32F1xx\CAN\main.c

Code: Select all

/*
 * Internal loopback mode, 500KBaud, automatic wakeup, automatic recover
 * from abort mode.
 * See section 22.7.7 on the STM32 reference manual.
 */
static const CANConfig cancfg = {
  CAN_MCR_ABOM | CAN_MCR_AWUM | CAN_MCR_TXFP,
  CAN_BTR_LBKM | CAN_BTR_SJW(0) | CAN_BTR_TS2(1) |
  CAN_BTR_TS1(8) | CAN_BTR_BRP(6)
};


with these settings speed CAN bus ~ 428 kBaud
CAN_BTR_BRP=5 speed 500 kBaud
Attachments
can.PNG

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

Re: error CAN settings in HAL example

Postby Giovanni » Wed Mar 02, 2016 10:44 pm

I will fix it.

BTW, this calculator can be used: http://www.bittiming.can-wiki.info/

Giovanni

Alexte
Posts: 27
Joined: Sun Jul 01, 2012 1:24 pm

Re: error CAN settings in HAL example

Postby Alexte » Thu Mar 03, 2016 11:03 am

I just started with this calculator, it is the same error :)
I am attaching the file correct calculation...
Attachments
STM32_CAN_speed_calc.zip
(33.49 KiB) Downloaded 251 times

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

Re: error CAN settings in HAL example

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

bump

bitto
Posts: 16
Joined: Thu Jan 30, 2014 9:45 am

Re: error CAN settings in HAL example

Postby bitto » Wed Mar 27, 2019 5:01 pm

Hello.
Just to see I'm doing it right: this configuration yields 1 Mbit/s on my STM32-H107 Olimex board?

Code: Select all

static const CANConfig cancfg_1MBit = {
                                       CAN_MCR_ABOM | CAN_MCR_AWUM | CAN_MCR_TXFP,
                                       CAN_BTR_SJW(0) | CAN_BTR_TS2(2) |
                                       CAN_BTR_TS1(13) | CAN_BTR_BRP(1)
};


Thanks in advance.
Alberto

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

Re: error CAN settings in HAL example

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

Hi,

If you used the calculator and if your clock settings are right (mcuconf.h) then yes. A real confirmation would require a test.

Giovanni


Last bumped by Giovanni on Sun Nov 10, 2019 10:22 am.


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 34 guests