Blue Flower

× STM32-Projektbesprecheungen

STM32 CAN , STM32 Bootloader

STM32F105 - bxCAN - Baudrate Settings

More
3 years 8 months ago - 3 years 8 months ago #174 by geier99
Hallo ,

in meinem STM32-CAN Interface verwende ich folgende bxCAN Einstellungen für die unterschiedlichen Baudraten:

typedef enum bitrate_ty {
    _500_kbit       
,   _250_kbit
,   _125_kbit
,   _100_kbit
,    _95_kbit
,    _83_kbit
,    _50_kbit
,    _33_kbit
,    _20_kbit
,    _10_kbit

,    COUNT_BITRATE
} enBitrate_t;


typedef struct Bitrate_t {    
    unsigned int Prescaler;
    unsigned char BS1;
    unsigned char BS2;
} Bitrate_st ;


const Bitrate_st stBitrate[COUNT_BITRATE]= {  // use the same order from  enum enBitrate_t
//    PRESCal     BS1           BS2		  // This values are valid for: system clock = 72MHz (PCLK1 = 36 MHz)
     { 6     , CAN_BS1_8tq, CAN_BS2_3tq}    // 500kbit  
,    { 12    , CAN_BS1_8tq, CAN_BS2_3tq}    // 250kbit                               
,    { 24    , CAN_BS1_8tq, CAN_BS2_3tq}    // 125kbit                               
,    { 30    , CAN_BS1_8tq, CAN_BS2_3tq}    // 100kbit                               
,    { 42    , CAN_BS1_6tq, CAN_BS2_2tq}    // 95kbit                               
,    { 36    , CAN_BS1_8tq, CAN_BS2_3tq}    // 83kbit                               
,    { 60    , CAN_BS1_8tq, CAN_BS2_3tq}    // 50kbit                               
,    { 90    , CAN_BS1_8tq, CAN_BS2_3tq}    // 33kbit                               
,    { 150   , CAN_BS1_8tq, CAN_BS2_3tq}    // 20kbit   
,    { 300   , CAN_BS1_8tq, CAN_BS2_3tq}    // 10kbit                            
};

Und die Werte für die nicht unterstützten Baudraten 1 MBit und 800 kBit würde ich folgende verwenden:
     { 2    , CAN_BS1_12tq, CAN_BS2_5tq}   // 1 MBit  
,    { 3    , CAN_BS1_10tq, CAN_BS2_4tq}   // 800 kBit      
Last edit: 3 years 8 months ago by geier99.

Please Anmelden or Create an account to join the conversation.

Time to create page: 0.085 seconds
Powered by Kunena Forum