DSP其实本质上讲和ARM差不多,只不过乘法运算能力和浮点运算能力强,
在相同的主频下,有很高的MIPS(每秒百万指令集)运算能力,得益于
DSP的哈佛架构和设计上的优化处理,特别适合做数学运算。
但是DSP的 外设不太友好,调试复杂尤其是TI的DSP芯片手册不适合新手入门,
且GPIO口特别少。
以TMSC5509A开始介绍,初始化程序如下:
#include
#include
#include
#include
#include "stdio.h"
#include "IncDMA.h"
#include "IncI2C.h"
#include "IncGlobe.h"
#include "IncDAC.h"
#include "IncDDS.h"
#include "IncTimer0.h"
/*锁相环的设置*/
PLL_Config myPLLCfg =
{
0, //IAI: the PLL locks using the same process that was underway
//before the idle mode was entered 采用上一次的锁相配置,按照例子此位应为1
1, //IOB: If the PLL indicates a break in the phase lock,
//it switches to its bypass mode and restarts the PLL phase-locking
//sequence 重启锁相环
16, //PLL multiply value; multiply 16 times 16倍频 25M*16=200M
1 //Divide by 2 PLL divide value; it can be either PLL divide value
//(when PLL is enabled), or Bypass-mode divide value 2分频
//(PLL in bypass mode, if PLL multiply value is set to 1)
};
void delay(Uint32 k)
{
while(k--);
}
int old_intm;
extern void VECSTART(void);
extern TIMER_Handle mhTimer1;
int main()
{
int old_intm,i,j;
int tmp_data;
long int tmp;
static unsigned char a[19]={0};
CSL_init();
//设置系统的运行速度为200MHz
PLL_config(&myPLLCfg);
CHIP_FSET(SYSR,CLKDIV,4); //CLKOUT = 200M/8 = 25M
IRQ_setVecs((Uint32)(&VECSTART));
old_intm = IRQ_globalDisable(); //temporarily disable interrupts and clear any peding
//初始化DMA
IniDMA_CH0(); //ADC MAX121
// IniDMA_CH1(); //AUDIO DAC8830
// IniDMA_CH2();
IniDMAPara();
//初始化McBSP
IniADC();
IniAudioDAC();
IniDAC8164D();
SendToDAC8164(DAC_PORTA,AGC.curoutdata);
IRQ_globalEnable(); //Enable all maskable interrupts
//IRQ_globalRestore(old_intm); //Restore status of global interrupt enable flag
IniGlobeValue(); //初始化全局变量
IniTimer0(); //初始化定时器0,为ADC的CONST提供采样间隔时钟
ad9854_int();
AD9854_SetSine_double(455000,4095);
dds_flag = 1;
while (1)
{
// a[0] = AD9854_RD_Byte(CTRL1_ADDRESS);
// a[1] = AD9854_RD_Byte(CTRL2_ADDRESS);
// a[2] = AD9854_RD_Byte(CTRL3_ADDRESS);
// a[3] = AD9854_RD_Byte(CTRL4_ADDRESS);
// a[4] = AD9854_RD_Byte(OSK_I1_ADDRESS );
// a[5] = AD9854_RD_Byte(OSK_I2_ADDRESS );
// a[6] = AD9854_RD_Byte(OSK_Q1_ADDRESS );
// a[7] = AD9854_RD_Byte(OSK_Q2_ADDRESS );
// a[8] = AD9854_RD_Byte(FTW1_ADDRESS);
// a[9] = AD9854_RD_Byte(FTW2_ADDRESS);
// a[10] = AD9854_RD_Byte(FTW3_ADDRESS);
// a[11] = AD9854_RD_Byte(FTW4_ADDRESS);
// a[12] = AD9854_RD_Byte(FTW5_ADDRESS);
// a[13] = AD9854_RD_Byte(FTW6_ADDRESS);
// a[14] = AD9854_RD_Byte(UNCLOCK1_ADDRESS );
// a[15] = AD9854_RD_Byte(UNCLOCK2_ADDRESS );
// a[16] = AD9854_RD_Byte(UNCLOCK3_ADDRESS );
// a[17] = AD9854_RD_Byte(UNCLOCK4_ADDRESS );
// a[18] = AD9854_RD_Byte(OSK_RAMP_DATE_ADDRESS);
}
}