今天做了一上午发现SCI的中断程序怎么也进不去,最后解决是重新翻看了TI的SCI模块手册,发现自己有一个使能位没有做,导致无法识别。
在此记下,也许有人会跟我一样傻
RXFFIENA Receive FIFO interrupt enable
0 RX FIFO interrupt based on RXFFIVL match (less than or equal to) will be disabled
1 RX FIFO interrupt based on RXFFIVL match (less than or equal to) will be enabled.
问 SCI_ECHOBACK的例子,
void scia_fifo_init()
{
SciaRegs.SCIFFTX.all=0xE040;
SciaRegs.SCIFFRX.all=0x204F
SciaRegs.SCIFFCT.all=0x0;
}
SCIFFRX是否错了?我觉得应该是202F,如上所说没有使能FIFO-SCI中断?
看你想要干嘛用了。我后来设了0x206F就可以了。你可以自己改了试试啊
晕,还没进去啊。哪天把你的源程序发给我,帮你看看。
sci-ehoback
void main(void)
{
Uint16 ReceivedChar;
char *msg;
InitSysCtrl();
InitSciaGpio();
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
LoopCount = 0;
ErrorCount = 0;
scia_fifo_init(); // Initialize the SCI FIFO
scia_echoback_init(); // Initalize SCI for echoback
msg = "\r\n\n\nHello World!\0";
scia_msg(msg);
msg = "\r\nYou will enter a character, and the DSP will echo it back! \n\0";
scia_msg(msg);
for(;;)
{
msg = "\r\nEnter a character: \0";
scia_msg(msg);
while(SciaRegs.SCIFFRX.bit.RXFFST !=1) { } // Get character
ReceivedChar = SciaRegs.SCIRXBUF.all;
msg = " You sent: \0";
scia_msg(msg);
scia_xmit(ReceivedChar);
LoopCount++;
}
}
// Test 1,SCIA DLB, 8-bit word, baud rate 0x000F, default, 1 STOP bit, no parity
void scia_echoback_init()
{
// Note: Clocks were turned on to the SCIA peripheral
// in the InitSysCtrl() function
SciaRegs.SCICCR.all =0x0007; // 1 stop bit, No loopback
// No parity,8 char bits,
// async mode, idle-line protocol
SciaRegs.SCICTL1.all =0x0003; // enable TX, RX, internal SCICLK,
// Disable RX ERR, SLEEP, TXWAKE
SciaRegs.SCICTL2.all =0x0003;
SciaRegs.SCICTL2.bit.TXINTENA =1;
SciaRegs.SCICTL2.bit.RXBKINTENA =1;
#if (CPU_FRQ_150MHZ)
SciaRegs.SCIHBAUD =0x0001; // 9600 baud @LSPCLK = 37.5MHz.
SciaRegs.SCILBAUD =0x00E7;
#endif
#if (CPU_FRQ_100MHZ)
SciaRegs.SCIHBAUD =0x0001; // 9600 baud @LSPCLK = 20MHz.
SciaRegs.SCILBAUD =0x0044;
#endif
SciaRegs.SCICTL1.all =0x0023; // Relinquish SCI from Reset
}
// Transmit a character from the SCI
void scia_xmit(int a)
{
while (SciaRegs.SCIFFTX.bit.TXFFST != 0) {}
SciaRegs.SCITXBUF=a;
}
void scia_msg(char * msg)
{
int i;
i = 0;
while(msg != '\0')
{
scia_xmit(msg);
i++;
}
}
// Initalize the SCI FIFO
void scia_fifo_init()
{
SciaRegs.SCIFFTX.all=0xE040;
SciaRegs.SCIFFRX.all=0x206f;
SciaRegs.SCIFFCT.all=0x0;
}
发现F28335的硬件图上有个ISO7221东东,
连接SCI-RX有个SW1,但真正板子上没有这个SW
于是根本无法做28335与PC通信的debug。
也就是说SCI-A-RX压根就没连接上PC.
坑爹啊。鼓捣了半个月。
回复 7楼 collean 的帖子
不知道你的板子上是否有做SCI通讯的接口,找找板子上是否类似max232 这样的芯片,如有自己连几根线用计算机串口做是一样的。不一定非要通过你的USB接口。
今天用一个DB9的头,自己焊了3跟跳线,跟ISO-TX RX GND连接,用带RS232的USB连接线接PC。
总算是实现了PC-MCU通信。
这算是TI的Bug么?
28335上的MAX232根本不起作用,GPIO28/29引脚不能使用,
只能用ISO-RX TX代替,跟PC连接用外接的MAX232.