//当VPB时钟为2*11059200Hz时,常用波特率与总线时序器对照表,如果VPB时钟不等,请自己计算出总线时序器的值
//BPS = (SAM << 23)|(TSEG2 << 20)|(TSEG1 << 16)|(SJW << 14)| BRP
#define BPS_5K 0x1c0113UL
#define BPS_10K 0x1c0089UL
#define BPS_20K 0x1c0044UL
#define BPS_50K 0x1c001bUL
#define BPS_100K 0x1c000dUL
#define BPS_125K 0x1c000aUL
//#define BPS_250K 0x1b0005UL
#define BPS_250K 0x1c000aUL
#define BPS_500K 0x1b0002UL
#define BPS_800K 0x1a0001UL
#define BPS_1000K 0x170001UL
| 1147952115
10:07:59
//当VPB时钟为4*11059200Hz时,常用波特率与总线时序器对照表,如果VPB时钟不等,请自己计算出总线时序器的值
//BPS = (SAM << 23)|(TSEG2 << 20)|(TSEG1 << 16)|(SJW << 14)| BRP
#define BPS_5K (1 << 23)|(1 << 20)|(6 << 16)|(0 << 14)| 879
#define BPS_10K (1 << 23)|(1 << 20)|(6 << 16)|(0 << 14)| 439
#define BPS_20K (1 << 23)|(1 << 20)|(6 << 16)|(0 << 14)| 219
#define BPS_40K (1 << 23)|(1 << 20)|(6 << 16)|(0 << 14)| 109
#define BPS_50K (1 << 23)|(1 << 20)|(6 << 16)|(0 << 14)| 87
#define BPS_80K (1 << 23)|(1 << 20)|(4 << 16)|(0 << 14)| 68
#define BPS_100K (1 << 23)|(1 << 20)|(6 << 16)|(0 << 14)| 43
#define BPS_125K (0 << 23)|(1 << 20)|(4 << 16)|(0 << 14)| 43
#define BPS_200K (0 << 23)|(1 << 20)|(6 << 16)|(0 << 14)| 21
#define BPS_250K1 (0 << 23)|(1 << 20)|(4 << 16)|(0 << 14)| 21 //0x110008
#define BPS_400K (0 << 23)|(1 << 20)|(6 << 16)|(0 << 14)| 10
#define BPS_500K (0 << 23)|(1 << 20)|(4 << 16)|(0 << 14)| 10
#define BPS_666K (0 << 23)|(1 << 20)|(2 << 16)|(0 << 14)| 10
#define BPS_800K (0 << 23)|(1 << 20)|(1 << 16)|(0 << 14)| 10
#define BPS_1000K (0 << 23)|(1 << 20)|(1 << 16)|(0 << 14)| 8
|
//当VPB时钟为4*11059200Hz时,常用波特率与总线时序器对照表,如果VPB时钟不等,请自己计算出总线时序器的值
//BPS = (SAM << 23)|(TSEG2 << 20)|(TSEG1 << 16)|(SJW << 14)| BRP
#define BPS_5K (1 << 23)|(1 << 20)|(6 << 16)|(0 << 14)| 879
#define BPS_10K (1 << 23)|(1 << 20)|(6 << 16)|(0 << 14)| 439
#define BPS_20K (1 << 23)|(1 << 20)|(6 << 16)|(0 << 14)| 219
#define BPS_40K (1 << 23)|(1 << 20)|(6 << 16)|(0 << 14)| 109
#define BPS_50K (1 << 23)|(1 << 20)|(6 << 16)|(0 << 14)| 87
#define BPS_80K (1 << 23)|(1 << 20)|(4 << 16)|(0 << 14)| 68
#define BPS_100K (1 << 23)|(1 << 20)|(6 << 16)|(0 << 14)| 43
#define BPS_125K (0 << 23)|(1 << 20)|(4 << 16)|(0 << 14)| 43
#define BPS_200K (0 << 23)|(1 << 20)|(6 << 16)|(0 << 14)| 21
#define BPS_250K1 (0 << 23)|(1 << 20)|(4 << 16)|(0 << 14)| 21 //0x110008
#define BPS_400K (0 << 23)|(1 << 20)|(6 << 16)|(0 << 14)| 10
#define BPS_500K (0 << 23)|(1 << 20)|(4 << 16)|(0 << 14)| 10
#define BPS_666K (0 << 23)|(1 << 20)|(2 << 16)|(0 << 14)| 10
#define BPS_800K (0 << 23)|(1 << 20)|(1 << 16)|(0 << 14)| 10
#define BPS_1000K (0 << 23)|(1 << 20)|(1 << 16)|(0 << 14)| 8
现在问题出来了,我有两块板互相调试,如果两块板得VPB都用4*11.0592M,波特率250K,没问题,通信正常,
或者两块都是2*11.0592M,波特率都设为250K,通信正常
但当我一块BPB时钟用2*11.0592M,波特率250K,另一块4*11.0592M,波特率250K,就通信不上了
这两组都是周立功代码里面的
大家分析下,难道周立功有的错误了 |