TI中文支持网
TI专业的中文技术问题搜集分享网站

TMS320F28035: SCI写入FLASH后不能进入接收中断问题

Part Number:TMS320F28035

28035调试SCI程序时,28035的时钟源用的时内部时钟1,同一控制板,通过串口助手发送接收数据,发送和接收数据都用中断完成,串口助手发送一帧数据,控制板收到数据后发送一帧数据给串口助手。收不到则不发送。当通过CCS仿真时,可以正常收发数据,当将程序写入FLASH后,重新上电,进不了接收中断(在中断里反转一个IO口观察)。请问时什么原因导致的。

void InitSciaGpio(void)
{
EALLOW;
SysCtrlRegs.PCLKCR0.bit.SCIAENCLK = 1; // SCI-A
/* Enable internal pull-up for the selected pins */
// Pull-ups can be enabled or disabled disabled by the user.
// This will enable the pullups for the specified pins.

GpioCtrlRegs.GPAPUD.bit.GPIO28 = 0; // Enable pull-up for GPIO28 (SCIRXDA)
// GpioCtrlRegs.GPAPUD.bit.GPIO7 = 0; // Enable pull-up for GPIO7 (SCIRXDA)

GpioCtrlRegs.GPAPUD.bit.GPIO29 = 0; // Enable pull-up for GPIO29 (SCITXDA)
// GpioCtrlRegs.GPAPUD.bit.GPIO12 = 0; // Enable pull-up for GPIO12 (SCITXDA)

/* Set qualification for selected pins to asynch only */
// Inputs are synchronized to SYSCLKOUT by default.
// This will select asynch (no qualification) for the selected pins.

GpioCtrlRegs.GPAQSEL2.bit.GPIO28 = 3; // Asynch input GPIO28 (SCIRXDA)
// GpioCtrlRegs.GPAQSEL1.bit.GPIO7 = 3; // Asynch input GPIO7 (SCIRXDA)

/* Configure SCI-A pins using GPIO regs*/
// This specifies which of the possible GPIO pins will be SCI functional pins.

GpioCtrlRegs.GPAMUX2.bit.GPIO28 = 1; // Configure GPIO28 for SCIRXDA operation
// GpioCtrlRegs.GPAMUX1.bit.GPIO7 = 2; // Configure GPIO7 for SCIRXDA operation

GpioCtrlRegs.GPAMUX2.bit.GPIO29 = 1; // Configure GPIO29 for SCITXDA operation
// GpioCtrlRegs.GPAMUX1.bit.GPIO12 = 2; // Configure GPIO12 for SCITXDA operation

EDIS;
}

void scia_fifo_init(void)
{
// Initialize SCI-A:
EALLOW;

SciaRegs.SCICTL1.bit.SWRESET = 0;
SciaRegs.SCICCR.all =0x00A7; // 2 stop bit, No loopback
// ODD,,8 char bits,
// async mode, idle-line protocol
SciaRegs.SCICTL1.all =0x0003; // enable TX, RX, internal SCICLK,
// Disable RX ERR, SLEEP, TXWAKE
SciaRegs.SCICTL2.bit.TXINTENA =1;
SciaRegs.SCICTL2.bit.RXBKINTENA =1;

if(UartBaud==0x00)
{
SCIBAUD =(LSPCLK_FREQ/(SCI_FREQ*8))-1;
}
else
{
SCIBAUD =(LSPCLK_FREQ/UartBaud/100/8)-1;
}

SciaRegs.SCIHBAUD = (SCIBAUD>>8);
SciaRegs.SCILBAUD = (SCIBAUD&0xFF);
// SCIBAUD=SCI_PRD;
// SciaRegs.SCIHBAUD = SCIBAUD>>8;
// SciaRegs.SCILBAUD = SCI_PRD;

SciaRegs.SCICCR.bit.LOOPBKENA =0; // Enable loop back
// SciaRegs.SCIFFTX.all=0xC002; //
// SciaRegs.SCIFFRX.all=0x0002; // 0x0022
SciaRegs.SCIFFCT.all=0x00;

SciaRegs.SCICTL1.all =0x0023; // Relinquish SCI from Reset 使能SCI
SciaRegs.SCIFFTX.bit.TXFIFOXRESET=1;
SciaRegs.SCIFFRX.bit.RXFIFORESET=1;
// SciaRegs.SCIFFTX.bit.TXFFINTCLR=1; // Clear SCI Interrupt flag
// SciaRegs.SCIFFRX.bit.RXFFOVRCLR=1; // Clear Overflow flag
// SciaRegs.SCIFFRX.bit.RXFFINTCLR=1; // Clear Interrupt flag
PieCtrlRegs.PIEACK.all|=0x100;

SciaRegs.SCICTL1.bit.SWRESET = 1;

EDIS;
}

Ben Qin:

你好,你有做将关键函数搬运到ram中运行的工作吗?如果在ram中调试没问题的话,说明程序本身是良好的。

,

mytieric:

感谢您的回复,有搬运到RAM区运行的代码,在有485电路的控制器中用写入FLASH的程序也可以进入中断,但直接连接到SCI端口,则不能进入中断,现在在考虑是否硬件存在问题(比如共地)等,是否有其他的建议?

,

Ben Qin:

确实有可能是存在硬件问题,可以使用示波器观察下SCI端口的电平情况

赞(0)
未经允许不得转载:TI中文支持网 » TMS320F28035: SCI写入FLASH后不能进入接收中断问题
分享到: 更多 (0)