Hi,
I am working on LAUNCHXL-F28027 C2000 Piccolo LaunchPad.
I need a serial port running only on one wire. I started with Example_2802xSci_Echoback.c.
TxD and RxD are connected by a diode: ( TxD -|<|- RxD )
In idle oparation I have RXENA enabled and TXENA disabled.
I switch them when transmit is needed and transmit after the transmit is complete.
The communication works as expected when the RxD and TxD are separated. (no reception when transmitting).
However when I connect the pins, I receive the last sent byte anyway.
Here's the source code:
// Transmit a character from the SCI
void scia_xmit(int a)
{
SciaRegs.SCITXBUF=a;
while (SciaRegs.SCIFFTX.bit.TXFFST != 0) {}
}
void scia_msg(char * msg)
{
SciaRegs.SCICTL1.all =0x0022;
int i;
i = 0;
while(msg[i] != '\0')
{
scia_xmit(msg[i]);
i++;
}
while (SciaRegs.SCICTL2.bit.TXEMPTY == 0){}
SciaRegs.SCICTL1.all =0x0021;
}
Uint32 j = 0;
for(;;)
{
msg = "\r\nEnter a character:\0";
scia_msg(msg);
// Wait for inc character
j = 0;
while(SciaRegs.SCIFFRX.bit.RXFFST <1) { j++;} // wait for XRDY =1 for empty state
// Get character
ReceivedChar = SciaRegs.SCIRXBUF.all;
// Echo character back
msg = " You sent: \0";
msg[11] = ReceivedChar;
scia_msg(msg);
}