ghostop14 / gr-grnet

GNURadio TCP/UDP source and sink blocks rewritten in C++/Boost. UDP block has header/crc options available as well.
GNU General Public License v3.0
32 stars 18 forks source link

The UDP source needs additional header type: VITA-49 #16

Open AB4EJ-1 opened 3 years ago

AB4EJ-1 commented 3 years ago

If we have a VITA-49 header type, we will be able to directly process FlexRadio I/Q packets in Gnuradio (as well as several other SDRs that output packets in this format)...

Here is a UDP packet header with VITA-49 header definition:

0x00 – 0x29 - 42 byte packet header 0x2A – 0x2B - 1C5F – VITA header 0x2C- 0x2D - 0408 – total packet length in 4-byte words = 4128 bytes 0x2E – 0x31 - 2000 0000 = stream ID 0x32 – 0x39 - 0000 1C2D 534C 02E4 = class ID 0x3A – 0x3D - 6031 7682 = UNIX time stamp (converts to 2/20/2010 20:52:18Z) 0x3D – 0x45 - 0000 0000 0000 1001 = free-running packet counter (little endian) 0x46 – on - 5050 0947 0000 72C5 etc. : Data payload: these are 32-bit floating point Q/I pairs (reversed); The rest of the packet consists of these Q/I samples. (Data samples use Q/I, rather than I/Q convention, for HPSDR compatibility)

Here is a header which realizes this layout in c-style:

struct flexDataSample { float I_val_int; float Q_val_int; };

typedef struct flexDataBuf { char VITA_hdr1[2]; // rightmost 4 bits is a packet counter int16_t VITA_packetsize; char stream_ID[4]; char class_ID[8]; uint32_t time_stamp; uint64_t fractional_seconds; struct flexDataSample flexDatSample[512]; } FLEXBUF;

For a complete exposition of VITA-49, see: https://www.redrapids.com/images/whitepapers/TWP-000-001-R00.pdf