打印
[DSP编程]

具体怎么实现ADC与McBSP之间的连接呢?

[复制链接]
2386|10
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
yangmm11|  楼主 | 2014-10-11 09:35 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
ADC例程中程序如下:
   
This is a test that tests the ADC functions for Amadeus
\*This is a test that tests the ADC functions for Amadeus */

\*adc_apiTest.c*/

#include <csl_adc.h>
#include <stdio.h>
Uint16 samplestorage[100]={0};
int i=7,j=15,k=1,counter=0,index=0;
ADC_Config *testconfig;

int channel=1,samplenumber=100;
int sysclkdiv = 2, convratediv = 0, sampletimediv = 79;

main()
{

#if (_ADC_SUPPORT)   

    ADC_setFreq(sysclkdiv,convratediv,sampletimediv);
    while(1)  
    {         
        ADC_read(channel,samplestorage,samplenumber);
            index=0;
                   for (counter=0;counter<samplenumber;counter++) {   /* mask lower 2 bits */
            samplestorage[index] = (samplestorage[index]&0x0FFC);
            index++;
            }
        }   
#endif
}

\* End of ADC_apiTest.c*/

\*adc_read.c*/
\*****************************************************************************/
#define _ADC_MOD_

#include <csl_adc.h>

#if (_ADC_SUPPORT)

#pragma CODE_SECTION(ADC_read,".text:ADC_read")

void ADC_read(int channelnumber,Uint16 *data,int length) {

  int old_intm,i;
  
  old_intm = IRQ_globalDisable();
  ADC_FSET(ADCCTL,CHSELECT,channelnumber);  /* set channel number */
  
  for (i=0;i<length;i++) {
  
  ADC_FSET(ADCCTL,ADCSTART,1);   /* start conversion */
  while (ADC_FGET(ADCDATA,ADCBUSY)) {  /* loop until not busy */
    asm(" NOP");
  }
  
  *data++ = (ADC_FGET(ADCDATA,ADCDATA)&0x0FFE);  /* mask LSB (due to noise) */
  
  }  /* end of main loop */
  
  IRQ_globalRestore(old_intm);
  
  
}
#endif //_ADC_SUPPORT

\*adc_setFreq.c*/
/******************************************************************************
#define _ADC_MOD_

#include <csl_adc.h>

#if (_ADC_SUPPORT)

#pragma CODE_SECTION(ADC_setFreq,".text:ADC_setFreq")

void ADC_setFreq(int sysclkdiv, int convratediv, int sampletimediv) {

int old_intm;

  old_intm = IRQ_globalDisable();  
  ADC_FSET(ADCCLKCTL,CPUCLKDIV,sysclkdiv);
  ADC_FSET(ADCCLKDIV,CONVRATEDIV,convratediv);
  ADC_FSET(ADCCLKDIV,SAMPTIMEDIV,sampletimediv);
  IRQ_globalRestore(old_intm);   


}

#endif //_ADC_SUPPORT


\*ADC_test.cmd*/

/**********************************************************/
/*                                                        */
/*         LINKER command file for LEAD3 memory map       */
/*                                                        */
/**********************************************************/

MEMORY
{
    PAGE 0:

        MMR     : origin = 0000000h, length = 00000c0h
        SPRAM   : origin = 00000c0h, length = 0000040
        DARAM0  : origin = 0000100h, length = 0003F00h
        DARAM1  : origin = 0004000h, length = 0004000h
        DARAM2  : origin = 0008000h, length = 0004000h
        DARAM3  : origin = 000c000h, length = 0004000h

        SARAM0  : origin = 0010000h, length = 0004000h
        SARAM1  : origin = 0014000h, length = 0004000h
        SARAM2  : origin = 0018000h, length = 0004000h
        SARAM3  : origin = 001c000h, length = 0004000h
        SARAM4  : origin = 0020000h, length = 0004000h
        SARAM5  : origin = 0024000h, length = 0004000h
        SARAM6  : origin = 0028000h, length = 0004000h
        SARAM7  : origin = 002c000h, length = 0004000h
        SARAM8  : origin = 0030000h, length = 0004000h
        SARAM9  : origin = 0034000h, length = 0004000h
        SARAM10 : origin = 0038000h, length = 0004000h
        SARAM11 : origin = 003c000h, length = 0004000h
        SARAM12 : origin = 0040000h, length = 0004000h
        SARAM13 : origin = 0044000h, length = 0004000h
        SARAM14 : origin = 0048000h, length = 0004000h
        SARAM15 : origin = 004c000h, length = 0004000h

        CE0     : origin = 0050000h, length = 03b0000h
        CE1     : origin = 0400000h, length = 0400000h
        CE2     : origin = 0800000h, length = 0400000h
        CE3     : origin = 0c00000h, length = 03f8000h

        PDROM   : origin = 0ff8000h, length = 07f00h
        VECS    : origin = 0ffff00h, length = 00100h  /* reset vector */
}       


SECTIONS
{
        vectors  : {} > VECS   PAGE 0         /* interrupt vector table */
        .cinit   : {} > SARAM0 PAGE 0
        .text    : {} > SARAM1 PAGE 0
        isrs     : {} > SARAM2 PAGE 0

        .stack   : {} > DARAM0 PAGE 0
        .sysstack: {} > DARAM0 PAGE 0
        .sysmem  : {} > DARAM1 PAGE 0
        .data    : {} > DARAM1 PAGE 0
        .bss     : {} > DARAM1 PAGE 0
        .const   : {} > DARAM1 PAGE 0
  

}




相关帖子

沙发
yangmm11|  楼主 | 2014-10-11 09:35 | 只看该作者
下面是McBSP例程中的程序:

/*uart.c*/


#include <csl.h>
#include <csl_pll.h>
#include <csl_mcbsp.h>
#include <csl_irq.h>
#include <csl_timer.h>
#include <stdio.h>

//设置McBSP的PCR寄存器指针,用于读写其I/O端口
ioport unsigned int *PCR_1=(unsigned int *)0x2c12;
#define REG_PCR1 (*PCR_1)

/*锁相环的设置*/
PLL_Config  myConfig      = {
  0,    //IAI: the PLL locks using the same process that was underway
                //before the idle mode was entered
  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
  12,    //PLL multiply value; multiply 12 times
  0             //Divide by 1 PLL divide value; it can be either PLL divide value
                //(when PLL is enabled), or Bypass-mode divide value
                //(PLL in bypass mode, if PLL multiply value is set to 1)
};


/****************************设置Timer********************************/
/* 参考: TMS320VC5509 DSP Timers Reference Guide
         TMS320C55x Chip Support Library API Reference Guide (Rev. J)
                 HX-5509A 开发板使用手册                                     */
//---------Global data definition---------//
#define TIMER_CTRL    TIMER_TCR_RMK(\
                      TIMER_TCR_IDLEEN_DEFAULT,    /* IDLEEN == 0 */ \
                      TIMER_TCR_FUNC_OF(0),        /* FUNC   == 0 */ \
                      TIMER_TCR_TLB_RESET,         /* TLB    == 1 */ \
                      TIMER_TCR_SOFT_BRKPTNOW,     /* SOFT   == 0 */ \
                      TIMER_TCR_FREE_WITHSOFT,     /* FREE   == 0 */ \
                      TIMER_TCR_PWID_OF(0),        /* PWID   == 0 */ \
                      TIMER_TCR_ARB_RESET,         /* ARB    == 1 */ \
                      TIMER_TCR_TSS_START,         /* TSS    == 0 */ \
                      TIMER_TCR_CP_PULSE,          /* CP     == 0 */ \
                      TIMER_TCR_POLAR_LOW,         /* POLAR  == 0 */ \
                      TIMER_TCR_DATOUT_0           /* DATOUT == 0 */ \
)  

/* Create a TIMER configuration structure that can be passed */
/* to TIMER_config CSL function for initialization of Timer  */
/* control registers.                                        */
//产生1ms中断
TIMER_Config timCfg0 = {
   TIMER_CTRL,               /* TCR0 */
   749,                     /* PRD0 */
   0x0000                   /* PRSC */
};

/* Create a TIMER_Handle object for use with TIMER_open */
TIMER_Handle mhTimer0;

Uint16 eventId0;
Uint16 timer0_cnt = 0;
int old_intm;
Uint16 tim_val;

//---------Function prototypes---------
/* Reference start of interrupt vector table   */
/* This symbol is defined in file, vectors_timer1.s55 */
extern void VECSTART(void);

/* Function/ISR prototypes */
interrupt void timer0Isr(void);
/***********************************************************************/


/**************************McBSP1设置成GPIO*****************************/
/* 参考: TMS320C55x DSP Multichannel Buffered Serial Port (McBSP) Reference Guide
         HX-5509A 开发板使用手册                                       
                 TMS320C55x Chip Support Library API Reference Guide (Rev. J)  */
MCBSP_Config Mcbsptest;

MCBSP_Config Mcbsp1Config = {
  MCBSP_SPCR1_RMK(
    MCBSP_SPCR1_DLB_OFF,                   /* DLB    = 0,禁止自闭环方式 */
    MCBSP_SPCR1_RJUST_LZF,                 /* RJUST  = 2 */
    MCBSP_SPCR1_CLKSTP_DISABLE,            /* CLKSTP = 0 */
    MCBSP_SPCR1_DXENA_ON,                  /* DXENA  = 1 */
    0,                                     /* ABIS   = 0 */
    MCBSP_SPCR1_RINTM_RRDY,                /* RINTM  = 0 */
    0,                                     /* RSYNCER = 0 */
    MCBSP_SPCR1_RRST_DISABLE               /* RRST   = 0 */
   ),
    MCBSP_SPCR2_RMK(
    MCBSP_SPCR2_FREE_NO,                   /* FREE   = 0 */
    MCBSP_SPCR2_SOFT_NO,                   /* SOFT   = 0 */
    MCBSP_SPCR2_FRST_FSG,                  /* FRST   = 0 */
    MCBSP_SPCR2_GRST_CLKG,                 /* GRST   = 0 */
    MCBSP_SPCR2_XINTM_XRDY,                /* XINTM  = 0 */
    0,                                     /* XSYNCER = N/A */           
    MCBSP_SPCR2_XRST_DISABLE               /* XRST   = 0 */
   ),
   /*单数据相,接受数据长度为16位,每相2个数据*/
  MCBSP_RCR1_RMK(
          MCBSP_RCR1_RFRLEN1_OF(1),              /* RFRLEN1 = 1 */
          MCBSP_RCR1_RWDLEN1_16BIT               /* RWDLEN1 = 2 */
  ),
  MCBSP_RCR2_RMK(   
    MCBSP_RCR2_RPHASE_SINGLE,              /* RPHASE  = 0 */
    MCBSP_RCR2_RFRLEN2_OF(0),              /* RFRLEN2 = 0 */
    MCBSP_RCR2_RWDLEN2_8BIT,               /* RWDLEN2 = 0 */
    MCBSP_RCR2_RCOMPAND_MSB,               /* RCOMPAND = 0 */
    MCBSP_RCR2_RFIG_YES,                   /* RFIG    = 0 */
    MCBSP_RCR2_RDATDLY_1BIT                /* RDATDLY = 1 */
    ),  
   MCBSP_XCR1_RMK(   
    MCBSP_XCR1_XFRLEN1_OF(1),              /* XFRLEN1 = 1 */
    MCBSP_XCR1_XWDLEN1_16BIT               /* XWDLEN1 = 2 */
   
),   
MCBSP_XCR2_RMK(   
    MCBSP_XCR2_XPHASE_SINGLE,              /* XPHASE  = 0 */
    MCBSP_XCR2_XFRLEN2_OF(0),              /* XFRLEN2 = 0 */
    MCBSP_XCR2_XWDLEN2_8BIT,               /* XWDLEN2 = 0 */
    MCBSP_XCR2_XCOMPAND_MSB,               /* XCOMPAND = 0 */
    MCBSP_XCR2_XFIG_YES,                   /* XFIG    = 0 */
    MCBSP_XCR2_XDATDLY_1BIT                /* XDATDLY = 1 */
  ),            
MCBSP_SRGR1_DEFAULT,
MCBSP_SRGR2_DEFAULT,  
MCBSP_MCR1_DEFAULT,
MCBSP_MCR2_DEFAULT,
MCBSP_PCR_RMK(
   MCBSP_PCR_IDLEEN_RESET,                 /* IDLEEN   = 0   */
   MCBSP_PCR_XIOEN_GPIO,                   /* XIOEN    = 1   */
   MCBSP_PCR_RIOEN_GPIO,                   /* RIOEN    = 1   */
   MCBSP_PCR_FSXM_EXTERNAL,                /* FSXM     = 0   */
   MCBSP_PCR_FSRM_EXTERNAL,                /* FSRM     = 0   */
   MCBSP_PCR_CLKXM_INPUT,                  /* CLKXM    = 0   */
   MCBSP_PCR_CLKRM_INPUT,                  /* CLKRM    = 0   */
   MCBSP_PCR_SCLKME_NO,                    /* SCLKME   = 0   */
   MCBSP_PCR_DXSTAT_1,                     /* DXSTAT   = 1   */
   MCBSP_PCR_FSXP_ACTIVEHIGH,              /* FSXP     = 0   */
   MCBSP_PCR_FSRP_ACTIVEHIGH,              /* FSRP     = 1   */
   MCBSP_PCR_CLKXP_FALLING,                /* CLKXP    = 1   */
   MCBSP_PCR_CLKRP_RISING                  /* CLKRP    = 1   */
),
MCBSP_RCERA_DEFAULT,
MCBSP_RCERB_DEFAULT,
MCBSP_RCERC_DEFAULT,
MCBSP_RCERD_DEFAULT,
MCBSP_RCERE_DEFAULT,
MCBSP_RCERF_DEFAULT,
MCBSP_RCERG_DEFAULT,
MCBSP_RCERH_DEFAULT,
MCBSP_XCERA_DEFAULT,
MCBSP_XCERB_DEFAULT,
MCBSP_XCERC_DEFAULT,
MCBSP_XCERD_DEFAULT,  
MCBSP_XCERE_DEFAULT,
MCBSP_XCERF_DEFAULT,  
MCBSP_XCERG_DEFAULT,
MCBSP_XCERH_DEFAULT
};     

MCBSP_Handle hMcbsp;
/***********************************************************************/


Uint16 i,temp;

unsigned char timer0_cnten;
unsigned char uart_rec, uart_send, uart_recflag, uart_sendflag;
unsigned char uart_bitscan, uart_bitcnt, uart_recstart, uart_sendbitcnt;
unsigned char uart_bitsend, uart_bitsendcnt, uart_sendcnten, uart_sendend;

void delay(Uint32 k)
{
   while(k--);
}

void settimer(void)
{
        /* Set IVPH/IVPD to start of interrupt vector table */
        /*修改寄存器IVPH,IVPD,重新定义中断向量表*/
        IRQ_setVecs((Uint32)(&VECSTART));
                
        /* Temporarily disable all maskable interrupts */
    old_intm = IRQ_globalDisable();   

    /* Open Timer 0, set registers to power on defaults */
    mhTimer0 = TIMER_open(TIMER_DEV0, TIMER_OPEN_RESET);

    /* Get Event Id associated with Timer 0, for use with */
    /* CSL interrupt enable functions.                    */         
    eventId0 = TIMER_getEventId(mhTimer0);

    /* Clear any pending Timer interrupts */
    IRQ_clear(eventId0);
   
    /* Place interrupt service routine address at */
    /* associated vector location */
    IRQ_plug(eventId0,&timer0Isr);              

    /* Write configuration structure values to Timer control regs */
    TIMER_config(mhTimer0, &timCfg0);  

    /* Enable Timer interrupt */
    IRQ_enable(eventId0);            
   
    /* Enable all maskable interrupts */
    IRQ_globalEnable();   
   
    timer0_cnten = 0;
    uart_bitscan = 0;
    uart_bitcnt = 0;  
        uart_recstart = 0;
        uart_recflag = 0;
        uart_sendflag = 0;

    /* Start Timer */
    TIMER_start(mhTimer0);
}


void main(void)
{
    /* Initialize CSL library - This is REQUIRED !!! */
    /*初始化CSL库*/
    CSL_init();
       
        /*设置系统的运行速度为144MHz*/
    PLL_config(&myConfig);
   
        /*初始化McBSP1*/
        hMcbsp = MCBSP_open(MCBSP_PORT1,MCBSP_OPEN_RESET);
        /*设置McBSP1*/
        MCBSP_config(hMcbsp,&Mcbsp1Config);

    MCBSP_getConfig(hMcbsp,&Mcbsptest);

        settimer();
                      
/*************************以下程序实现软件Uart************************/
/* 参考:HX-5509A 开发板使用手册                                     */
        while(TRUE)
        {
                if(uart_recflag==1)
                {
                        uart_recflag = 0;
                        if(uart_sendflag==0)
                        {
                                uart_bitsendcnt = 0;
                                uart_sendend = 0;
                                uart_sendcnten = 0;
                                uart_bitsend = 0;
                                uart_send = uart_rec;
                                uart_sendflag = 1;
                                uart_sendbitcnt = 0;
                        }
                }
        };                                                                            
}


interrupt void timer0Isr(void)
{
        temp = REG_PCR1;

        //Send
        if(uart_sendflag==1)
        {
                if(uart_sendcnten==0)
                {
                        REG_PCR1 &= 0xffdf;
                        uart_bitsend = 1;
                        uart_sendcnten = 1;
                }
                if(uart_sendcnten==1)
                {
                        uart_bitsendcnt++;
                        if(uart_bitsendcnt==10)
                        {
                                uart_sendbitcnt++;
                                if(uart_sendend==1)
                                {
                                        uart_sendflag = 0;
                                }
                                else
                                {
                                        if(uart_sendbitcnt<9)
                                        {
                                                if((uart_send & uart_bitsend)==0)
                                                {
                                                        REG_PCR1 &= 0xffdf;
                                                }
                                                else
                                                {
                                                        REG_PCR1 |= 0x0020;
                                                }
                                                uart_bitsend <<= 1;
                                        }
                                        else
                                        {
                                                REG_PCR1 |= 0x0020;
                        uart_sendflag = 0;
                                        }
                                }
                                uart_bitsendcnt = 0;
                        }
                }
        }
       
        //Receive
        if((uart_bitcnt==0)&&(uart_recstart==0))
        {
                if((temp&0x0010)==0)
                {
                        timer0_cnt = 0;
                        timer0_cnten = 1;
                        uart_bitscan = 0;
                        uart_rec = 0;
                        uart_recstart = 1;
                }
        }
        if(timer0_cnten==1)
        {
                timer0_cnt++;
                if((temp&0x0010)!=0)
                {
                        uart_bitscan++;
                }
                if(timer0_cnt==10)
                {
                        timer0_cnt = 0;
                        if(uart_bitscan>5)
                        {
                                switch(uart_bitcnt)
                                {
                                        case 0:  uart_rec = 0;
                                                 timer0_cnten = 0;
                                                         uart_recstart = 0;
                                                         break;
                                        case 1:  uart_bitcnt++;
                                                         uart_rec |= 0x01;
                                                         break;
                                        case 2:  uart_bitcnt++;
                                                         uart_rec |= 0x02;
                                                         break;
                                        case 3:  uart_bitcnt++;
                                                         uart_rec |= 0x04;
                                                         break;
                                        case 4:  uart_bitcnt++;
                                                         uart_rec |= 0x08;
                                                         break;
                                        case 5:  uart_bitcnt++;
                                                         uart_rec |= 0x10;
                                                         break;
                                        case 6:  uart_bitcnt++;
                                                         uart_rec |= 0x20;
                                                         break;
                                        case 7:  uart_bitcnt++;
                                                         uart_rec |= 0x40;
                                                         break;
                                        case 8:  uart_bitcnt++;
                                                         uart_rec |= 0x80;
                                                         break;
                                        case 9:  uart_bitcnt = 0;
                                                         timer0_cnten = 0;
                                                         uart_recflag = 1;
                                                         uart_recstart = 0;
                                                         break;
                                        default: break;
                                }
                        }
                        else
                        {
                            uart_bitcnt++;
                                if(uart_bitcnt>9)
                                {
                                        uart_bitcnt = 0;
                                        timer0_cnten = 0;
                                }
                        }
                        uart_bitscan = 0;
                }               
        }

}

/******************************************************************************\
* End of uart.c
\******************************************************************************/



*vectors_timer1.s55
* Copyright (C) 2003 Texas Instruments Incorporated
* All Rights Reserved
*
*
*---------vectors_dma2.s55---------
*
* Assembly file to set up interrupt vector table
*

        .sect ".vectors"

*------------------------------------------------------------------------------
* Global symbols defined here and exported out of this file
*------------------------------------------------------------------------------

        .global _VECSTART

*------------------------------------------------------------------------------
* Global symbols referenced in this file but defined somewhere else.
* Remember that your interrupt service routines need to be referenced here.
*------------------------------------------------------------------------------
        .ref _c_int00

      .def nmi, int0, int1, int2, int3, int4, int5, int6
      .def int7, int8, int9, int10, int11, int12, int13
      .def int14, int15, int16, int17, int18, int19, int20
      .def int21, int22, int23, int24, int25, int26, int27
      .def int28, int29

_VECSTART:
        .ivec _c_int00,c54x_stk
nmi     .ivec no_isr
        nop_16
int0    .ivec no_isr
        nop_16
int1    .ivec no_isr
        nop_16
int2    .ivec no_isr
        nop_16
int3    .ivec no_isr
        nop_16
int4    .ivec no_isr
        nop_16
int5    .ivec no_isr
        nop_16
int6    .ivec no_isr
        nop_16
int7    .ivec no_isr
        nop_16
int8    .ivec no_isr
        nop_16
int9    .ivec no_isr
        nop_16
int10   .ivec no_isr
        nop_16
int11   .ivec no_isr
        nop_16
int12   .ivec no_isr
        nop_16
int13 .ivec no_isr
        nop_16
int14   .ivec no_isr
        nop_16
int15   .ivec no_isr
        nop_16
int16   .ivec no_isr
        nop_16
int17   .ivec no_isr
        nop_16
int18   .ivec no_isr
        nop_16
int19   .ivec no_isr
        nop_16
int20   .ivec no_isr
        nop_16
int21   .ivec no_isr
        nop_16
int22   .ivec no_isr
        nop_16
int23   .ivec no_isr
        nop_16
int24   .ivec no_isr
        nop_16
int25   .ivec no_isr
        nop_16
int26   .ivec no_isr
        nop_16
int27   .ivec no_isr
        nop_16
int28   .ivec no_isr
        nop_16
int29   .ivec no_isr
        nop_16

*------------------------------------------------------------------------------
* This is a dummy interrupt service routine used to initialize the IST.
*------------------------------------------------------------------------------
        .text
        .def no_isr
no_isr:
        b #no_isr
*------------------------------------------------------------------------------




/**********************************************************/
/*                                                        */
/*         LINKER command file for LEAD3 memory map       */
/*                                                        */
/**********************************************************/
  


MEMORY
{
    PAGE 0:

        MMR     : origin = 0000000h, length = 00000c0h
        SPRAM   : origin = 00000c0h, length = 0000040h
        VECS    : origin = 0000100h, length = 0000100h
        DARAM0  : origin = 0000200h, length = 0003E00h
        DARAM1  : origin = 0004000h, length = 0004000h
        DARAM2  : origin = 0008000h, length = 0004000h
        DARAM3  : origin = 000c000h, length = 0004000h

        SARAM0  : origin = 0010000h, length = 0004000h
        SARAM1  : origin = 0014000h, length = 0005000h
        SARAM2  : origin = 0019000h, length = 0003000h
        SARAM3  : origin = 001c000h, length = 0004000h
        SARAM4  : origin = 0020000h, length = 0004000h
        SARAM5  : origin = 0024000h, length = 0004000h
        SARAM6  : origin = 0028000h, length = 0004000h
        SARAM7  : origin = 002c000h, length = 0004000h
        SARAM8  : origin = 0030000h, length = 0004000h
        SARAM9  : origin = 0034000h, length = 0004000h
        SARAM10 : origin = 0038000h, length = 0004000h
        SARAM11 : origin = 003c000h, length = 0004000h
        SARAM12 : origin = 0040000h, length = 0004000h
        SARAM13 : origin = 0044000h, length = 0004000h
        SARAM14 : origin = 0048000h, length = 0004000h
        SARAM15 : origin = 004c000h, length = 0004000h

        CE0     : origin = 0050000h, length = 03b0000h
        CE1     : origin = 0400000h, length = 0400000h
        CE2     : origin = 0800000h, length = 0400000h
        CE3     : origin = 0c00000h, length = 03f8000h

        PDROM   : origin = 0ff8000h, length = 07f00h
   /*   VECS    : origin = 0ffff00h, length = 00100h */ /* reset vector */
}      


SECTIONS
{
        vectors  : {} > VECS   PAGE 0         /* interrupt vector table */
        .cinit   : {} > SARAM0 PAGE 0
        .text    : {} > SARAM1 PAGE 0
        isrs     : {} > SARAM2 PAGE 0

        .stack   : {} > DARAM0 PAGE 0
        .sysstack: {} > DARAM0 PAGE 0
        .sysmem  : {} > DARAM1 PAGE 0
        .data    : {} > DARAM1 PAGE 0
        .bss     : {} > DARAM1 PAGE 0
        .const   : {} > DARAM1 PAGE 0

        .cio     : {} > DARAM1 PAGE 0
        .csldata:  {} > DARAM0   PAGE 0
  

}


   

使用特权

评论回复
板凳
yangmm11|  楼主 | 2014-10-11 09:36 | 只看该作者
对于上述程序主要有以下几个方面的疑惑:
1、ADC_test.cmd中:
MEMORY中的 VECS    : origin = 0ffff00h, length = 00100h  /* reset vector */
SECTION中的  vectors  : {} > VECS   PAGE 0         /* interrupt vector table */
编译程序是未提示错误,但下载程序时提示:
Data verification failed at address 0xFFFF00  Please verify target memory and memory map
按照网上的说法,更改SECTION中的vector,使它定义在片上DARAM或SARAM,编译与下载都能顺利进行。
uart.cmd中:  
MEMORY中的 /*   VECS    : origin = 0ffff00h, length = 00100h */ /* reset vector */
SECTION中的  vectors  : {} > VECS   PAGE 0         /* interrupt vector table */
注释掉MEMORY中的VECS之后,编译与下载都能顺利进行,为什么?
按照这个步骤,把ADC_test中的VECS也注释掉,但结果提示错误,为什么?
2、对于中断向量表vectors_timer1.s55
    no_isr:
        b #no_isr
其中,b的含义是什么?
3、uart.c程序中,下半部分程序是什么意思?(以下程序实现软件Uart之后的程序)
4、ADC转换之后的结果按照程序是存在了samplestorage中,uart程序配置完McBSP,怎么把samplestorage中的数据通过McBSP发送到PC机,二者之间的程序如何编写?
   
    由于是刚开始接触DSP,且对于单片机方面了解的比较少,所以按照例程进行学习时,好多地方都是一知半解,只能慢慢来学习了。

使用特权

评论回复
地板
yangmm11|  楼主 | 2014-11-3 15:26 | 只看该作者

McBSP的配置成GPIO之后,运行程序时,能否查看图中各寄存器中值的变化情况?

使用特权

评论回复
5
zhangmangui| | 2014-11-4 22:31 | 只看该作者
yangmm11 发表于 2014-10-11 09:36
对于上述程序主要有以下几个方面的疑惑:
1、ADC_test.cmd中:
MEMORY中的 VECS    : origin = 0ffff00h, l ...

VECS这个注释掉包不报错   要看看section中有没有用它  用的话肯定不能注册
b(B)应该是汇编指令跳转

使用特权

评论回复
6
zhangmangui| | 2014-11-4 22:32 | 只看该作者
yangmm11 发表于 2014-11-3 15:26
McBSP的配置成GPIO之后,运行程序时,能否查看图中各寄存器中值的变化情况? ...

McBSP用于GPIO     寄存器是可以配置和读取的

使用特权

评论回复
7
zhangmangui| | 2014-11-4 22:33 | 只看该作者
yangmm11 发表于 2014-11-3 15:26
McBSP的配置成GPIO之后,运行程序时,能否查看图中各寄存器中值的变化情况? ...

不过需要注意的是想时钟引脚   配置为GPIO时只能用于输出引脚

使用特权

评论回复
8
yangmm11|  楼主 | 2014-11-5 09:13 | 只看该作者
zhangmangui 发表于 2014-11-4 22:32
McBSP用于GPIO     寄存器是可以配置和读取的

对于数据传输的过程,我始终弄不明白,在DSP发送数据到PC机时,数据应该是一位一位的进行传输吧?
那对于需要传输的每位数据,一开始是经过DR引脚放在了寄存器RSR中,然后到RBR,再到DRR,最后发送到PC机?那上图中的RSR、RBR、DRR或者是XSR、DXR中寄存器中的值是每位需传输的数据中的值?
看手册是,一直不明白整个流程是怎么一回事。。。

使用特权

评论回复
9
yangmm11|  楼主 | 2014-11-5 15:19 | 只看该作者
zhangmangui 发表于 2014-11-4 22:33
不过需要注意的是想时钟引脚   配置为GPIO时只能用于输出引脚

今天又看了一下MCBSP的中文手册,从手册中理解引脚控制寄存器PCR中域DXSTAT及DRSTAT的值的变化,就是DR/DX引脚上的值的变化,通过关键字ioport能够设置McBSP的PCR寄存器指针,用于读写其I/O端口。那么问题如下:
1、通过PCR中的DXSTAT与DRSTAT能够一位一位的读取引脚上的值,这些值应该是寄存器DRR与DXR中的值,那寄存器DRR与DXR中的值与PCR寄存器有何关系?
2、



图中说DRR为I/O映射寄存器,可以通过访问I/O空间访问该寄存器。那么
ioport unsigned int *PCR_1=(unsigned int *)0x2c12;访问的是寄存器PCR,如何访问DRR寄存器?


使用特权

评论回复
10
zhangmangui| | 2014-11-5 21:05 | 只看该作者
yangmm11 发表于 2014-11-5 15:19
今天又看了一下MCBSP的中文手册,从手册中理解引脚控制寄存器PCR中域DXSTAT及DRSTAT的值的变化,就是DR/D ...

我以前写过类似代码    现在找不到了    记得有一篇关于5509的二次boot**里面讲的很详细
你找找

使用特权

评论回复
11
yangmm11|  楼主 | 2014-11-6 08:59 | 只看该作者
zhangmangui 发表于 2014-11-5 21:05
我以前写过类似代码    现在找不到了    记得有一篇关于5509的二次boot**里面讲的很详细
你找找

这个图我知道是DX引脚与DXSTAT之间的对应关系,及DR引脚与DRSTAT之间的对应关系;但是从程序中如何看出DRR或DXR寄存器中的值与PCR寄存器联系在一起,就不理解了。。。我是刚开始学DSP,看的就是一些例程相关的东西,对于二次boot没啥概念。。。网上查了一下,也没看明白。。。
不过还是谢谢啦,我在找找相关资料。

使用特权

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

本版积分规则

10

主题

67

帖子

0

粉丝