补充波特率的表格:
typedef const struct {
int BAUD_RATE;
unsigned char SJW;
unsigned char BS1;
unsigned char BS2;
unsigned short PreScale;
} s_CAN_BaudRate;
/*
Used for Hardware (CLK=36MHz):
1. ViewTool Ginkgo USB-CAN Bus Adapter: VTG202A
2. ViewTool Ginkgo USB-CAN Interface: VTG203B
*/
/* BAUD_RATE SJW BS1 BS2 PreScale; */
s_CAN_BaudRate Ginkgo2CAN_BaudRateInitTab[]= {
{1000,1,2,1,9}, // 1M (1000K)
{900,1,5,2,5}, // 900K
{800,1,10,4,3}, // 800K
{666,1,7,1,6}, // 666K
{600,1,3,1,12}, // 600K
{500,1,4,1,12}, // 500K
{400,1,7,1,10}, // 400K
{300,1,6,1,15}, // 300K
{250,1,6,1,18}, // 250K
{225,1,6,1,20}, // 225K
{200,1,15,2,10}, // 200K
{160,1,12,2,15}, // 160K
{150,1,6,1,30}, // 150K
{144,1,3,1,50}, // 144K
{125,1,6,1,36}, // 125K
{120,1,12,2,20}, // 120K
{100,1,6,1,45}, // 100K
{90,1,6,1,50}, // 90K
{80,1,4,1,75}, // 80K
{75,1,6,1,60}, // 75K
{60,1,6,1,75}, // 60K
{50,1,6,1,90}, // 50K
{40,1,7,1,100}, // 40K
{30,1,6,1,150}, // 30K
{20,1,6,1,225}, // 20K
};
/*
Used for Hardware (CLK=42MHz):
1. ViewTool Ginkgo USB-CAN Bus Adapter: VTG300A
2. ViewTool Ginkgo USB-CAN Interface: VTG301A
*/
s_CAN_BaudRate Ginkgo3CAN_BaudRateInitTab[]= {
{1000,1,2,4,6}, // 1M (1000K)
{900,1,16,6,2}, // 900K
{800,1,5,7,4}, // 800K
{666,1,12,8,3}, // 666K
{600,1,5,4,7}, // 600K
{500,1,7,6,6}, // 500K
{400,1,7,7,7}, // 400K
{300,1,8,5,10}, // 300K
{250,1,8,5,12}, // 250K
{225,1,13,3,11}, // 225K
{200,1,5,8,15}, // 200K
{160,1,9,1,24}, // 160K
{150,1,6,3,28}, // 150K
{144,1,7,2,29}, // 144K
{125,1,4,3,42}, // 125K
{120,1,3,3,50}, // 120K
{100,1,6,5,35}, // 100K
{90,1,4,7,39}, // 90K
{80,1,16,4,25}, // 80K
{75,1,8,1,56}, // 75K
{60,1,5,1,100}, // 60K
{50,1,6,1,105}, // 50K
{40,1,7,2,105}, // 40K
{30,1,11,2,100}, // 30K
{20,1,9,2,175}, // 20K
}; |