打印
[CAN-bus/DeviceNet]

LPC2119波特率问题,周立功那边的,谢谢大家,分析下

[复制链接]
2354|3
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
yoxi123123|  楼主 | 2011-7-16 10:18 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
//当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,就通信不上了


这两组都是周立功代码里面的

大家分析下,难道周立功有的错误了

相关帖子

沙发
yoxi123123|  楼主 | 2011-7-16 10:20 | 只看该作者
//当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*11.0592M,波特率250K,没问题,通信正常,
或者两块都是2*11.0592M,波特率都设为250K,通信正常

但当我一块BPB时钟用2*11.0592M,波特率250K,另一块4*11.0592M,波特率250K,就通信不上了

这两组都是周立功代码里面的

大家分析下,难道周立功有的错误了

使用特权

评论回复
板凳
tbytm| | 2011-8-12 22:21 | 只看该作者
楼主
#define BPS_1000K (0 << 23)|(1 << 20)|(1 << 16)|(0 << 14)| 8
这个对应的是1M么?根据(0 << 23)|(1 << 20)|(1 << 16)|(0 << 14)| 8怎么计算出来的啊

使用特权

评论回复
地板
qin552011373| | 2011-8-27 13:55 | 只看该作者
学习一下

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

0

主题

17

帖子

1

粉丝