完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我在一个项目中使用了ADSP-21479 100pin 管教的芯片,在参照手册做了一个板子,现在也没找到关于这个的一些软硬件资料!软件写了个测试的!但每次下载后就自动运行了!也跳不到main 处!并且下载后看不到 setp over F10 !想请问一下!有无参考的例程 !和硬件资料!
以下是我的测试代码!软件环境VDSP5.1 ! 想请专家们帮我看看,是什么问题! 谢谢! debugNWC 其他选项是默认的! 硬件 boot cfg 是spi flash ! clk _cfg 8:1 /***************************************************************************** * 21479 TEST.c *****************************************************************************/ #include #include #include #include "cs4272.h" #define NOP asm volatile("nop;") void initPLL_SDRAM(void); void main() { /* Begin adding your custom code here */ initPLL_SDRAM(); //Init_PLL_SDRAM_AMI(); // printf("hello wordn"); InitCS4272(); for (;;) { asm("nop;"); //asm("idle;"); } } void initPLL_SDRAM(){ /********************************************************************************************/ int i, pmctlsetting; // Set INDIV bit in PMCTL register pmctlsetting = *pPMCTL; pmctlsetting |= INDIV; *pPMCTL= pmctlsetting; // Program PLL multiplier to same value as CLK_CFGx pins/previously programmed value in software厖 *pPMCTL = pmctlsetting; // then place PLL in bypass mode pmctlsetting |= PLLBP; *pPMCTL = pmctlsetting; //Wait for recommended number of cycles for (i=0; i<4096; i++) NOP; // Bring PLL out of bypass mode by clearing PLLBP bit *pPMCTL ^= PLLBP; for (i=0; i<16; i++) NOP; pmctlsetting = *pPMCTL; // Clear the previous PLL multiplier pmctlsetting = ~PLLM63; // Clear the INDIV bit pmctlsetting = ~INDIV; // or set the INDIV bit // *pMCTL |= INDIV; *pPMCTL= pmctlsetting; // CLKIN = 16.625 MHz, PLLM=32, PLLD = 1, INDIV= 1 => fINPUT = 16.625/2 = 8.3125 MHz // CCLK = 2*PLLM*fINPUT/2*PLLD = (2*32*8.3125)/(2*1) = 266 MHz, SDCLK = CCLK/2 = 133 MHz // VCO frequency = 2*fINPUT*PLLM = 2*8.3125*32 = 532 <= fVCOmax (532 MHz) // CLKIN = 12 MHz, PLLM=32, PLLD = 1, INDIV= 1 => fINPUT = 12/2 = 6 MHz // CCLK = 2*PLLM*fINPUT/2*PLLD = (2*32*6)/(2*1) = 192MHz, SDCLK = CCLK/2 = 133 MHz // VCO frequency = 2*fINPUT*PLLM = 2*6*32 = 384<= fVCOmax (532 MHz) pmctlsetting= SDCKR2|PLLM16|INDIV|DIVEN; *pPMCTL= pmctlsetting; pmctlsetting|= PLLBP; //Setting the Bypass bit pmctlsetting^= DIVEN; //Clearing the DIVEN bit *pPMCTL= pmctlsetting; // Putting the PLL into bypass mode //Wait for around 4096 cycles for the pll to lock. for (i=0; i<5000; i++) NOP; pmctlsetting = *pPMCTL; pmctlsetting ^= PLLBP; //Clear Bypass Mode *pPMCTL = pmctlsetting; //Wait for around 15 cycles for the output dividers to stabilize. for (i=0; i<16; i++) NOP; } #include #include #include "cs4272.h" #ifdef CS4272 #define SPIB_MODE (CPHASE | CLKPL) #define CS4272_CS DS0EN //#define AD1939_CS DS1EN #define SELECT_SPI_SLAVE(select) (*pSPIFLG = ~(spiselect<<8)) #define DESELECT_SPI_SLAVE(select) (*pSPIFLG |= (spiselect<<8)) // NOTE: To select ADC/DAC Sample Rate of either 48 kHz, 96 kHz or 192 kHz, choose one // of the following 3 macros to set the sample rate (only one at a time). #define USE_48_KHZ_SAMPLE_RATE //#define USE_96_KHZ_SAMPLE_RATE //#define USE_192_KHZ_SAMPLE_RATE /* Setup the SPI parameters here in a buffer first */ /* Setup the SPI parameters here in a buffer first */ unsigned char ConfigParamCS4272[] = { (CS4272_ADDR), MODE_CONTROL_2, MODE_CONTROL_2_PDN | MODE_CONTROL_2_CPEN, (CS4272_ADDR), MODE_CONTROL_1, MODE_CONTROL_ONE_DEFAULT_PAYLOAD, (CS4272_ADDR), DAC_CONTROL, DAC_CONTROL_DEFAULT_PAYLOAD, (CS4272_ADDR), DAC_VOLUME, DAC_VOLUME_DEFAULT_PAYLOAD, (CS4272_ADDR), DAC_VOLUME_A, 0x00, (CS4272_ADDR), DAC_VOLUME_B, 0x00, (CS4272_ADDR), ADC_CONTROL, ADC_CONTROL_DITHER16, (CS4272_ADDR), MODE_CONTROL_2, MODE_CONTROL_2_CPEN, } ; unsigned char CS4272_Regs_Read[sizeof(ConfigParamCS4272) / 3]; volatile int spiFlag ; int LockCount = 0; unsigned int LockTest; void Delay(int i); /////////////////////////////////////////////////////////////////////////////// // Set up the SPI port to access the ADCS4272 // Call with SPI flag to use /////////////////////////////////////////////////////////////////////////////// void SetupSPICS4272(unsigned int SPI_Flag) { // Configure the SPI Control registers // First clear a few registers *pSPICTL = (TXFLSH | RXFLSH) ; *pSPIFLG = 0; // Setup the baud rate to 1MHz *pSPIBAUD = 100; *pSPIBAUD = 25; // Setup the SPI Flag register using the Flag specified in the call *pSPIFLG = (0xF00|SPI_Flag); // Now setup the SPI Control register *pSPICTL = (SPIEN | SPIMS | WL8 | MSBF | TIMOD1 | CPHASE | CLKPL | SMLS|GM); } // Disable the SPI Port void DisableSPICS4272(void) { *pSPICTL = (TXFLSH | RXFLSH); } // Send a word to the CS4272 via SPI Call with the CS4272 address, register address, register data, and SPI flag to use void ConfigureCS4272Register (unsigned char rwaddr,unsigned char regaddr,unsigned char regdata, unsigned int spiselect) { int i,j; unsigned char val[3]; SELECT_SPI_SLAVE(spiselect); val[0]=WR(rwaddr); val[1]=regaddr; val[2]=regdata; for(i=0;i<3;i++) { j=0; *pTXSPI = val[i] ; // Delay(136); //Wait for the SPI to indicate that it has finished. while ((*pSPISTAT TXS)) {j++;} } j=0; //Wait for the SPI to indicate that it has finished. while (!(*pSPISTAT SPIFE)) {j++;} Delay(10); DESELECT_SPI_SLAVE(spiselect); } /////////////////////////////////////////////////////////////////////////////// // Receive a register setting from the ADCS4272 // Call with the register address, and SPI flag to use; returns register data /////////////////////////////////////////////////////////////////////////////// unsigned char GetCS4272Register (unsigned char regaddr, unsigned int spiselect) { int i,j; unsigned char val[3]; unsigned int tmp; SELECT_SPI_SLAVE(spiselect); val[0]=RD(CS4272_ADDR ); val[1]=regaddr; val[2]=0; for(i=0;i<3;i++) { j=0; *pTXSPI = val[i] ; //Wait for the SPI to indicate that it has finished. while ((*pSPISTAT TXS)) {j++;} } j=0; //Wait for the SPI to indicate that it has finished. while (!(*pSPISTAT SPIF)) {j++;} while (!(*pSPISTAT SPIFE)) {j++;} Delay(10); tmp = *pRXSPI; DESELECT_SPI_SLAVE(spiselect); return tmp; } /////////////////////////////////////////////////////////////////////////////// // Set up all ADCS4272 registers via SPI /////////////////////////////////////////////////////////////////////////////// void InitCS4272(void) { int configSize = sizeof(ConfigParamCS4272); int i,j=0 ; unsigned char tmpA[sizeof(ConfigParamCS4272) / 3]; //Set up ADCS4272 SetupSPICS4272(CS4272_CS); //Write register settings for(i = 0; i < configSize-6; i+=3) { ConfigureCS4272Register(ConfigParamCS4272[i], ConfigParamCS4272[i+1], ConfigParamCS4272[i+2], CS4272_CS); Delay(272); //Read back register settings for debugging CS4272_Regs_Read[j++] = GetCS4272Register(ConfigParamCS4272[i+1], CS4272_CS); Delay(272); } // Make sure the PLL is locked before enabling the CODEC. for(i = configSize-6; i < configSize; i+=3) { ConfigureCS4272Register(ConfigParamCS4272[i], ConfigParamCS4272[i+1], ConfigParamCS4272[i+2], CS4272_CS); Delay(272); //Read back register settings for debugging CS4272_Regs_Read[j++] = GetCS4272Register(ConfigParamCS4272[i+1], CS4272_CS); Delay(272); } DisableSPICS4272(); } #if 0 void enableADCHpf(bool enable) { unsigned char dither16State; if (bridgeADCGainFactor == 0) // if we are going to use bits lower than the 16 MSB, we cannot dither to 16 bits { dither16State = ADC_CONTROL_DITHER16; } else { dither16State = 0; } if (enable) { ConfigureCS4272Register(CS4272_ADDR, ADC_CONTROL, dither16State, CS4272_CS); } else { ConfigureCS4272Register(CS4272_ADDR,ADC_CONTROL, ADC_CONTROL_HPF_DISABLE_B | ADC_CONTROL_HPF_DISABLE_A | dither16State, CS4272_CS); } } #endif //Delay loop void Delay(int i) { for(i ; i > 0; --i) asm("nop;"); } #endif |
|
相关推荐
1个回答
|
|
从您的描述来看,有以下一些可能的解决方案:
1. 检查硬件连接和配置:确保您的硬件连接正确,并且与芯片的引脚分配和配置一致。确保使用正确的时钟和复位源。 2. 检查软件设置:确认您的软件项目正确地设置为使用ADSP-21479芯片,并且与硬件配置一致。您可能需要检查芯片的设备描述文件和仿真器驱动程序。 3. 检查下载和调试设置:确保您的下载和调试设置正确。这可能包括设置调试模式、调试器驱动程序和目标设备的连接方式。 4. 检查编译设置:确认您的代码正确编译,并且生成的可执行文件正确映射到目标硬件的内存地址空间。 5. 检查调试命令和快捷键:确认您正在使用正确的调试命令和快捷键。您可能需要查看相关的文档或手册,以了解如何设置断点和单步调试。 |
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
求助一下关于51系列单片机的Timer0的计时问题,TH0、TL0+1的时间是怎么算的?
195 浏览 0 评论
【RA-Eco-RA4E2-64PIN-V1.0开发板试用】开箱+Keil环境搭建+点灯+点亮OLED
172 浏览 0 评论
【敏矽微ME32G070开发板免费体验】使用coremark测试敏矽微ME32G070 跑分
453 浏览 0 评论
【敏矽微ME32G070开发板免费体验】开箱+点灯+点亮OLED
697 浏览 2 评论
602 浏览 0 评论
【youyeetoo X1 windows 开发板体验】少儿AI智能STEAM积木平台
11983 浏览 31 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-21 03:25 , Processed in 1.030258 second(s), Total 73, Slave 56 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号