cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with copying hex data

hospodar
Associate III
Posted on October 28, 2015 at 13:28

Hello,

I have following problem with copying hex data.

for

(i = 0; i < 6; i++) {
printf

(

''%02x''

, packet[i]);

// copy packet to FIFO

}

Printf copy data from packet[] to FIFO. Everything is ok if copying data like these on first screenshot bellow (0xAA,0xBB,0xCC,0xDD). But if copiyng different values (but with some data type - 0x01, 0x03, 0x00, 0x05) things going wrong. In the destination FIFO is 0x30, 0x30, 0x00, 0x00,... which is bad.

https://www.dropbox.com/s/oib1gsgpdvs8ttk/OK.PNG?dl=0

https://www.dropbox.com/s/rhgh6orot3ypswh/NOK.PNG?dl=0

It is weird for me. Where can be a problem? Thank you.
2 REPLIES 2
Posted on October 28, 2015 at 14:16

The protocol is not very robust to character loss, might want a space, or synchronization byte to that the digits don't slip.

If there is an issue over the wire, look at the bit timings, and intersymbol spacing (ie increase stop bits)

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
hospodar
Associate III
Posted on October 28, 2015 at 21:13