.


:




:

































 

 

 

 


C28




 

: 28, . , .

 

 

C28x
16 (. 3.1). (RS, NMI). . 14 , .. / / IER (Interrupt Enable Register). IFR (Interrupt Flag Register) . IFR , . , , INTR, IER.

 

C28x (Core)

. 3.1. C28

 

C28x . 3.2, IER IFR . 3.3. , IFR , . INTM ST1, / .

 

. 3.2. C28x

 

: IERBit=1 : IERBit=0

 

: IFRBit=1 : IFRBit=0

. 3.3. IER IFR

 

16 BROM vector (. . 2.2), 22- ( 16 6 ), . 32 , .. 16 DLOGINT, RTOSINT, Illegal ( ), 12 USER1USER12 (Reserved).

( /RS) . , , . , (WDT). WDT /RS, .

C28x ( ), ( ). XMP/MC (. . 2.2). ,
0x3F FFC0 ( XMP/MC=0), ( XMP/MC=1), XMP/MC XINTCNF2, .

Bootloader, GPIOF (GPIOF2, GPIOF3, GPIOF4 GPIOF12) , , , . 3.1 3.4.

ezDSP2812, , H0 SARAM (), (). , , , FLASH, ().

 

 


3.1. Bootloader

 

GPIO
F4 F12 F3 F2
  x x x FLASH- 0x3F 7FF6
        H0 SARAM- 0x3F 8000
        OTP- 0x3D 7800
    x x EEPROM SPI-
        SI-
        GPIO

 

. 3.4. Bootloader

 

96, 16 . INT1INT12 (. 3.5). .. , Peripheral Interrupt Expansion (PIE), . PIE : 96 32- (PIE vector,
0x00 D0000x00 DFFF, . . 2.2 3.9). 8 (. . 3.8). / PIEIERx (x 1 12), PIEIFRx. PIEACK ( 0) CPU . INT1INT12 (. 3.6).

PIEIERx PIEIFRx . 3.7, 8 , .. . PIECTRL 15-1 (PIEVECT) PIE vector, . 1 15 (.. ), , . ENPIE PIE-. ENPIE=1, PIE vector, ENPIE=0, PIE- , CPU- (BROM vector, . . 2.2).

 

 

. 3.3. 28.

 

. 3.5. PIEIFRx, PIEIERx, PIEACKx

 

 

. 3.6. 28

 

 

. 3.7. 28

 

. 3.8.

:

- (ADCINT) INT1.6;

- CPU- 0 (TINT0) INT1.7.

 

. 3.8. PIE

 

. 3.9. ENPIE=1:
0x00 0D00 , 0x00 0D02 0x00 0D1C
0x00 0D400x00 0DFE ; 9 ( ).

 

. 3.10. ENPIE=1: 1 ; 2 PIEIFRx.y = 1; 3 : PIEIERx.y = 1 PIEACKx=0; 3 1 PIEACKx x;
4 INTx (PIEACKx INTx ); 5 IFRx = 1;
6 IERx = 1; 7
INTM = 1, ; 8 PIE Vector Mapping ( 0x00 0D02 0x00 0D1C); 9 PIE Vector Mapping PIEIER PIEIFR ( 0x00 0D40 0x00 0DFE).

28
32- (CPU timers) . . 3.11. TCR.4. 16- () PSCH: PSC, 32- TIMH: TIM. TIMH: TIM /TINT, . 16- TDDRH: TDDR .
PRDH: PRD 32- , . : 22 248.

1 2, , DSP/BIOS, 0 . , (EvA EvB). , .

 

 


. 3.11. C28x ( )

 

, , . 3.12.

- TIMERxPSC - TIMERxTDDR 16- TIMERxTPR (. . 3.13).

, TIMERxPSCH TIMERxTDDRH, 16- TIMERxTPRH.

 

 

. 3.12. C28x

 

. 3.13. - TIMERxTPR (x = 0, 1, 2)

 

TIMERxTCR, . 3.14.

, CPU-, , . 3.15. 0 PIE, 1 2 .

 

 
 

 

 


 

. 3.14. (TIMERxTCR)

 

 
 

 


. 3.15. CPU-

 

 

. . , .

. , 0 . (PIE).

 

1. .

Code Composer Studio Lab3.pjt. Project Name Lab3. Location , E:\DspUser\Lab3.

1.1. 2 Lab2. Lab3.. Lab3. : Project → Add files to Project.

. 3.16.

1.2. , , , ( , , Add files to Project):

 

C:\tidcs\c28\dsp281x\v100\DSP281x_common\cmd\F2812_EzDSP_RAM_lnk.cmd

C:\tidcs\c28\dsp281x\v100\DSP281x_headers\cmd\DSP281x_Headers_nonBIOS.cmd

C:\CCStudio_v3.3\C2000\cgtools\lib\rts2800_ml.lib

C:\tidcs\c28\dsp281x\v100\DSP281x_headers\source\DSP281x_GlobalVariableDefs.c

C:\tidcs\c28\dsp281x\v100\DSP281x_common\source\DSP281x_PieCtrl.c

C:\tidcs\c28\dsp281x\v100\DSP281x_common\source\DSP281x_PieVect.c

C:\tidcs\c28\dsp281x\v100\DSP281x_common\source\DSP281x_DefaultIsr.c

C:\tidcs\c28\dsp281x\v100\DSP281x_common\source\DSP281x_CpuTimers.c

 

2. .

2.1. , Project → Build Options, Compiler Preprocessor Include Search Path (-i) :

C:\tidcs\C28\dsp281x\v100\DSP281x_headers\include;..\include

2.2. .

-:

Project → Build Options → Linker → Libraries → Search Path: C:\CCStudio_v3.3\C2000\cgtools\lib

Project → Build Options → Linker → Libraries → Search Path Linker → Incl. Libraries: rts2800_ml.lib

0400:

Project → Build Options → Linker → Basic → Stack Size (-stack): 0x400


//##################################################################
// : Lab3.c

//

// : 8 ,

// GPIOB0 - GPIOB7, " ".

// -

//#####################################################################

 

#include "DSP281x_Device.h" //

 
 


void delay_loop(long);

void Gpio_select(void);

void InitSystem(void);


void main(void)

{

unsigned int i;

unsigned int LED[8]= {0x0001,0x0002,0x0004,0x0008,

0x0010,0x0020,0x0040,0x0080};

 

InitSystem(); //

Gpio_select(); // /

while(1)

{

for(i=0;i<14;i++)

{

if(i<7) GpioDataRegs.GPBDAT.all = LED[i];

else GpioDataRegs.GPBDAT.all = LED[14-i];

delay_loop(?);

}

}

}

 
 

 

 


//#####################################################################

// : delay_loop

//

// :

//#####################################################################

 

void delay_loop(long end)

{

long i;

for (i = 0; i < end; i++);

EALLOW; //

SysCtrlRegs.WDKEY = 0x?;

SysCtrlRegs.WDKEY = 0x?;

EDIS;

}

 

 

//#####################################################################

// : Gpio_select

//

// : GPIO B15-8 , B7-0

// . A, D, F, E, G

// .

//#####################################################################

 

void Gpio_select(void)

{

EALLOW;

GpioMuxRegs.GPAMUX.all = 0x?; // /

GpioMuxRegs.GPBMUX.all = 0x?; //

GpioMuxRegs.GPDMUX.all = 0x?;

GpioMuxRegs.GPFMUX.all = 0x?;

GpioMuxRegs.GPEMUX.all = 0x?;

GpioMuxRegs.GPGMUX.all = 0x?;

 

GpioMuxRegs.GPADIR.all = 0x?; // , D, E, F, G

GpioMuxRegs.GPBDIR.all = 0x?; // 15-8 ,

GpioMuxRegs.GPDDIR.all = 0x?; // 7-0

GpioMuxRegs.GPEDIR.all = 0x?;

GpioMuxRegs.GPFDIR.all = 0x?;

GpioMuxRegs.GPGDIR.all = 0x?;

 

GpioMuxRegs.GPAQUAL.all = 0x?; //

GpioMuxRegs.GPBQUAL.all = 0x?;

GpioMuxRegs.GPDQUAL.all = 0x?;

GpioMuxRegs.GPEQUAL.all = 0x?;

EDIS;

}

 

//#####################################################################

// : InitSystem

//

// : ,

// = 1.

// . 150 .

//

// 2,

// - 4.

//

//#####################################################################

 
 


void InitSystem(void)

{

EALLOW;

SysCtrlRegs.WDCR= 0x?; // // , = 64

// -

// , = 1

 

SysCtrlRegs.SCSR =?; // WDT

SysCtrlRegs.PLLCR.bit.DIV =?;//

SysCtrlRegs.HISPCP.all = 0x?; // SysCtrlRegs.LOSPCP.all = 0x?; //

 

 

SysCtrlRegs.PCLKCR.bit.EVAENCLK=?; //

SysCtrlRegs.PCLKCR.bit.EVBENCLK=?; //

SysCtrlRegs.PCLKCR.bit.SCIAENCLK=?;

SysCtrlRegs.PCLKCR.bit.SCIBENCLK=?;

SysCtrlRegs.PCLKCR.bit.MCBSPENCLK=?;

SysCtrlRegs.PCLKCR.bit.SPIENCLK=?;

SysCtrlRegs.PCLKCR.bit.ECANENCLK=?;

SysCtrlRegs.PCLKCR.bit.ADCENCLK=?;

EDIS;

}

       
   
 
 

 


. 3.16.

3. .

 

3.1. Lab3.c CPU- 0:

 

interrupt void cpu_timer0_isr(void);

 

1 . 3.16.

:

 

InitPieCtrl();

 

2 . 3.16.

DSP281x_PieCtrl.c, . , . , CCS. , , ( *.c).

 

3.2.
InitPieCtrl(); :

 

InitPieVectTable();

 

PIE . PieVectTableInit(), DSP281x_PieVect.c, PieVectTable, PIE area. ,
InitPieVectTable, DSP281x_DefaultIsr.c, .

 

3.3. CPU- 0 .
InitPieVectTable(); :

 

EALLOW;

PieVectTable.TINT0 = &cpu_timer0_isr;

EDIS;

 

EALLOW EDIS , , cpu_timer0_isr , .

 

3.4. CPU- 0. ( , . 3.3):

 

InitCpuTimers();

 

DSP281x_CpuTimers.c. .

 

3.5. CPU Timer0 50 150 . InitCpuTimers(); :

 

ConfigCpuTimer(&CpuTimer0, 150, 50000);

 

DSP281x_CpuTimers.c.

 

3.6. CPU- 0. .

PIE, PIEIER1 (.. CPU- 0 , . . 3.8):

 

PieCtrlRegs.PIEIER1.bit.INTx7 = 1;

 

1 . IER (. . 3.2 3.3).

 

IER = 1;

 

. , :

 

EINT;

ERTM;

 

, . 3.6.

 

3.7. CPU Timer0:

 

CpuTimer0Regs.TCR.bit.TSS = 0;

 

3.8. ( 3 . 3.16) CPU- 0 cpu_timer0_isr. . . :

 

interrupt void cpu_timer0_isr(void)

{

( )

}

 

:

- CpuTimer0.InterruptCount, ( = 0) DSP281x_CpuTimers.c. 50 ;

- 0 1 PIEACK, . :

 

PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;

 

3.9. . ( //)
delay_loop(?); (. 4 . 3.16). (. 5 . 3.16),
void delay_loop(long end). /* */.

150 , , CpuTimer0.InterruptCount interrupt void cpu_timer0_isr(void) 50 . 4
. 3.16. CpuTimer0.InterruptCount 0.

 

3.10. Watchdog timer (WDT). . 6 . 3.16.

 

3.11. WDT. WDKEY 0x55 0xAA, , 2 (. 7 . 3.16). , EALLOW EDIS CPU- 0 interrupt void cpu_timer0_isr(void).
50 , WDT .

 

4. , .

4.1. : Project → Compile File. , .

4.2. : Project → Build. , .

4.3. : File → Load Program → Debug\ lab3.out ( , , ).

 

 

:

 

, , , , .

 

:

 

1. .

2. .

3. C28x.

4. (PIE) C28x.

5. C28x ENPIE=0 ENPIE=1.

6. ENPIE=1.

7. CPU- C28x.

8. CPU- C28x.

9. , :

- 1,7 ?

- 2,45 ?

10. , :

- 2 ?

- 3 ?

 


 

 
1. eZDSP F2812 Code Composer Studio ..  
2. , / TMS320F2812.    
3. C28 ..  

 





:


: 2017-02-24; !; : 921 |


:

:

- , , .
==> ...

1538 - | 1346 -


© 2015-2024 lektsii.org - -

: 0.206 .