用的DSP是TMS320C6745,是SPI1的接收程序。运行时,无法进入SPI接收中断程序,总是停在主程序中的while(1)这里,进不了中断。
附上程序。
#include "Initial.h"
extern CSL_SpiRegsOvly spiRegs;
extern void intcVectorTable(void);
Uint16 Data[256] = {0};
CSL_IntcRegsOvly intcRegs = (CSL_IntcRegsOvly)CSL_INTC_0_REGS;
Uint8 flag = 0;
Uint16 Rdata = 0;
void main(void)
{
SystemTargetInit();
intcRegs->INTMUX1 = 43;
ISTP = (unsigned int)intcVectorTable;
ICR = 0xFFF0;// 清中断标志
IER |= 0x12;//使能中断IE4
CSR |=0x1; //使能所有的可屏蔽中断
while(1)
{
if(flag == 0)
{
flag = 1;
// CSL_FINS(spiRegs->SPIDAT1,SPI_SPIDAT1_TXDATA,0xffff);
//spiRegs->SPIDAT0 = 0x11;
}
}
}
interrupt void SPI_Interrupt(void)
{
static Uint8 i = 0;
ICR = 0xFFF0; //写1清中断标志
spiRegs->SPIFLG |= 0x00000100;//清SPI标志
asm(" NOP 1 ");
//while((spiRegs->SPIBUF & 0x80000000) != 0x80000000)
Rdata = spiRegs->SPIBUF;
Data
= Rdata;
i++;
// Rdata++;
flag = 0;
asm(" NOP 1 ");
}
此帖出自小平头技术问答
一周热门 更多>