HI ALL
I have an F28335 controlCard with docking station. The card has a UART connected to SCIA.
for the hardware:
I connect uart-to-usb to PC, set band at 9600/8/0/1 and check com port right.
and for the docking station I connect the U2' J9 pin to make the 28335 SCI-A-RX work.
for the source code:
DSP28_DIVSEL 2
DSP28_PLLCR 10
CPU_RATE 6.667L
CPU_FRQ_150MHZ
then start the example sci_echoback
my trouble is pc hyperterminal could receive data from 28335; but if 28335 RX can't receive from PC' hyperterminal.
ererytime stop at while(SciaRegs.SCIFFRX.bit.RXFFST != 1)
and sci_echoback code is:
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);
// Wait for inc character
while(SciaRegs.SCIFFRX.bit.RXFFST !=1) { } // wait for XRDY =1 for empty state
// Get character
ReceivedChar = SciaRegs.SCIRXBUF.all;
// Echo character back
msg = " You sent: \0";
scia_msg(msg);
scia_xmit(ReceivedChar);
LoopCount++;
}
}
SciaRegs.SCICCR.all =0x0007; // 1 stop bit, No loopback void scia_xmit(int a) } void scia_msg(char * msg) void scia_fifo_init() }
void scia_echoback_init()
{
// Note: Clocks were turned on to the SCIA peripheral
// in the InitSysCtrl() function
// 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
}
{
while (SciaRegs.SCIFFTX.bit.TXFFST != 0) {}
SciaRegs.SCITXBUF=a;
{
int i;
i = 0;
while(msg[i] != '\0')
{
scia_xmit(msg[i]);
i++;
}
}
{
SciaRegs.SCIFFTX.all=0xE040;
SciaRegs.SCIFFRX.all=0x204f;
SciaRegs.SCIFFCT.all=0x0;
look for your reply 3q