DSP28335中文资料

TMS320F28335 TechV_28335

目录

1 DSP的PWM信号 .................................................................................................................. 1

1.1简介 ................................................................................................................................. 1 1.2端口对应关系 ................................................................................................................. 2 1.3初始化程序注释 ............................................................................................................. 2 2 DSP的CAN通信 ................................................................................................................... 4

2.1CAN2.0B协议简述 ....................................................................................................... 4 2.2CAN总线电平 ............................................................................................................... 5 2.3CAN总线上的120欧电阻 .......................................................................................... 6 2.4DSP的CAN时钟模块 ................................................................................................. 6 2.5邮箱初始化例程注解 ..................................................................................................... 7 2.6消息发送和接收 ............................................................................................................. 8 2.7CAN的适配器存在的一些问题 ................................................................................... 9 3 DSP的32位浮点运算测试 .................................................................................................. 10 4 DSP定时器中断 ..................................................................................................................... 11

4.1 DSP28335的定时器 .................................................................................................. 11 4.2定时器分频 ................................................................................................................... 11 4.3 计数器计数 .................................................................................................................. 12 4.4定时器时钟周期 ........................................................................................................... 12 5 DSP看门狗复位 ..................................................................................................................... 12

5.1看门狗时钟 ................................................................................................................... 12 5.2看门狗系统控制和状态寄存器(SCSR) ...................................................................... 13 5.3看门狗计数寄存器(WDCNTR) ........................................................................... 13 5.4看门狗重启管理器(WDKEY) .............................................................................. 14 5.5看门狗控制寄存器(WDCR) ....................................................................................... 14 6 软件报错与处理 ...................................................................................................................... 15

6.1CCS Setup中仿真器的配置 ....................................................................................... 15 6.2Connect报错——1145——换仿真器解决 ............................................................... 17 6.3CAN口测试A发B收,数据发不出去 ................................................................... 19 6.4编译Pwm测试文件出错............................................................................................ 19 6.5could not open source file \DSP2833x_Device.h ................................................. 20 7 备注与注意事项 ...................................................................................................................... 22 8 附录 C源程序 ...................................................................................................................... 22

8.1PWM初始化及脉冲产生函数 .................................................................................... 22 8.2邮箱初始化函数 ........................................................................................................... 33 8.3浮点运算测试函数 ....................................................................................................... 36 8.4定时器中断初始化函数 ............................................................................................... 38 8.5采用定时器的延时函数 ............................................................................................... 39 8.6看门狗初始化函数 ....................................................................................................... 40

DSP28335测试总结

1 DSP的PWM信号

1.1简介

DSP28335共12路16位的ePWM,能进行频率和占空比控制。 ePWM的时钟TBCLK=SYSCLKOUT/(HSPCLKDIV×CLKDIV):

PWM信号频率由时基周期寄存器TBPDR和时基计数器的计数模式决定。初始化程序采用的计数模式为递增计数模式。在递增计数模式下,时基计数器从零开始增加,直到达到周期寄存器值(TBPDR)。然后时基计数器复位到零,再次开始增加。

1

DSP28335测试总结

PWM信号周期与频率的计算如下:

1.2端口对应关系

通道 1 2 3 4 5 6 7 8 9 10 11 12

相应PWM的A/B ePWM1A ePWM1B ePWM2A ePWM2B ePWM3A ePWM3B ePWM4A ePWM4B ePWM5A ePWM5B ePWM6A ePWM6B 对应JP0B端口号 9 10 11 12 13 14 15 16 17 18 19 20 说明:JP0B的端口号按“Z”字形顺序数。

1.3初始化程序注释 void InitPwm1AB(float32 f) {

Uint16 T= 2343750/f-1.0;//系统时钟SYSCLKOUT=150MHz,TBCLK=6.6666667ns,在连续增计数模式下,f=150000000/(TBPDR+1) EALLOW;

//先初始化通用输入输出口//

GpioCtrlRegs.GPAPUD.bit.GPIO0 = 0; GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 1; GpioCtrlRegs.GPAPUD.bit.GPIO1 = 0; GpioCtrlRegs.GPAMUX1.bit.GPIO1 = 1;

EPwm1Regs.TBPHS.half.TBPHS = 0; // 在相位寄存器中设置计数器的起始计数位置

2

联系客服:779662525#qq.com(#替换为@)