cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Observer
Observer
5,969 Views
Registered: ‎11-14-2009

UART does not send zeroes

Jump to solution

Hi,

 

     I have a UART IP set to 115200 baud and connected  to the pc using a usb-serial cable. I am using Tera Term as well as own code in VC# to monitor the serial port. I am trying to send the following 17 byte array using  the XUartLite_SendByte(u32 BaseAddress, u8 data).

 

testbuff[0] = 0x55;//0;
    testbuff[1] = 0x55;//0;
    testbuff[2] = 0xff;
    testbuff[3] = 0xff;
    testbuff[4] = 0xff;
    testbuff[5] = 0xff;
    testbuff[6] = 0x55;
    testbuff[7] = 0x55;
    testbuff[8] = 0xff;
    testbuff[9] = 0;
    testbuff[10] = 0;
    testbuff[11] = 0;
    testbuff[12] = 0xff;
    testbuff[13] = 0;
    testbuff[14] = 0;
    testbuff[15] = 0x55;
    testbuff[16] = 0x55;

 

 

uart_send(&testbuff, 17);

 

 

void uart_send(u8 *DataBufferPtr, unsigned int NumBytes)
{
    int i;
   
    for (i=0; i<NumBytes; i++)
    {
        XUartLite_SendByte(XPAR_UARTLITE_0_BASEADDR, *(DataBufferPtr+i));
     }
}

 

 

 

     But the UART omits the 0's and outputs "UU    UU  UU"  (12bytes). Exactly like this   UU<4 space chars>UU<2space chars>UU. Looks like the UART is omitting the 0's. Is there something I am doing wrong? Please help.

 

 

Regards,

 

Karthik

 

 

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Professor
Professor
7,291 Views
Registered: ‎08-14-2007

Re: UART does not send zeroes

Jump to solution

Did you actually scope out the signal and see that the zeroes were missing?

The standard behavior of most buffering software on a PC is to ignore zeroes

in an input data stream (at least for ASCII mode).  So they could actually be

transmitting but the other end drops them.

-- Gabor

View solution in original post

4 Replies
Highlighted
5,966 Views
Registered: ‎08-21-2008

Re: UART does not send zeroes

Jump to solution

Hello.

In order to see zeros you have to send "0x30" instead of "0".

Like

testbuff[9] = 0x30;

Best of luck.
--
Unlimited in my Limits.
0 Kudos
Highlighted
Observer
Observer
5,953 Views
Registered: ‎11-14-2009

Re: UART does not send zeroes

Jump to solution

Prateek,

 

             Thanks for replying. I need to send hex values. I need to see 0x00 in my application. By trail and error, I found out that Visual C# gets interrupted when I send 0x14 (unreliably) or higher value. I am guessing sending zeroes over high speed is inherently unreliable. I am currently testing at 9600. If it doesnt work, I'll probably have to go for some encoding scheme. But that'd probably render it unusable since I am sending about 75K of image data.

 

 

 

0 Kudos
Highlighted
Professor
Professor
7,292 Views
Registered: ‎08-14-2007

Re: UART does not send zeroes

Jump to solution

Did you actually scope out the signal and see that the zeroes were missing?

The standard behavior of most buffering software on a PC is to ignore zeroes

in an input data stream (at least for ASCII mode).  So they could actually be

transmitting but the other end drops them.

-- Gabor

View solution in original post

Highlighted
Observer
Observer
5,912 Views
Registered: ‎11-14-2009

Re: UART does not send zeroes

Jump to solution

@ : That did it! I set SerialPort.DiscardNull = False and I was able to see all the hex values.

 

Thank you!

0 Kudos