HDLC framer

Hi,
I read in the documentation that HDLC framer takes in PMT binary blobs
and outputs HDLC frames as unpacked bits.I don’t undestand what are the
PMT binary blobs.How can I put in an HDLC frame a “Hello World” message?
ThanksDaniel

Hi Daniel,

PMT is short for “polymorphic type” [1].
GNU Radio uses PMTs for stream tags and, more importantly here, for
asynchronous message ports.
So the idea is that you have a source of messages[2], sending your
data to the HDLC framer, which frames it and generates output items.
If you want some illustrated guide through these concept, I’d
recommend the new guided tutorials on gnuradio.org[3] numbers 1 through
5.

Greetings, and happy hacking,
Marcus

[1] http://gnuradio.org/doc/doxygen/page_pmt.html
[2] http://gnuradio.org/doc/doxygen/page_msg_passing.html
[3] http://gnuradio.org/redmine/projects/gnuradio/wiki/Guided_Tutorials

Thank you Marcus,
I try the following:
MessageStrobe(“Hello World”) ----> HDCL framer ---->HDLC deframer ---->
Message Debug
and I get the following error message:thread[thread-per-block[2]: <block
hdlc_framer_pb (1)>]: pmt_car: wrong_type : Hello World!
What did I do wrong?
Daniel

 On Wednesday, December 3, 2014 10:55 AM, Marcus Müller 

[email protected] wrote:

Hi Daniel,

PMT is short for “polymorphic type” [1].
GNU Radio uses PMTs for stream tags and, more importantly here, for
asynchronous message ports.
So the idea is that you have a source of messages[2], sending your
data to the HDLC framer, which frames it and generates output items.
If you want some illustrated guide through these concept, I’d
recommend the new guided tutorials on gnuradio.org[3] numbers 1 through
5.

Greetings, and happy hacking,
Marcus

[1] http://gnuradio.org/doc/doxygen/page_pmt.html
[2] http://gnuradio.org/doc/doxygen/page_msg_passing.html
[3] http://gnuradio.org/redmine/projects/gnuradio/wiki/Guided_Tutorials

I wrote the HDLC framer to use PMT blobs (specifically, PMT pairs with a
length field and a blob) because it seemed that was the convention we
were
settling upon in GR to handle binary messages. I’m unaware if there was
any
formal specification or agreement to this format.

To clarify, the missing feature is just dealing with blobs that aren’t a
multiple of 8 bits in length. To do so would probably require changing
the
length field to represent nbits instead of nbytes, and using a padding
convention (msbit or lsbit) to determine which bits in the last byte of
the
blob should be included.

I haven’t seen too many (len%8) HDLC frames out there so I never got
down
to putting that in there. The deframer would also have to be modified,
specifically crc_ccitt().

–n

On Thu, Dec 4, 2014 at 8:25 AM, Marcus Müller [email protected]

Hi Daniel,
the HDLC framer can only deal with messages containing PMTs that are
“blobs”, ie. u8vectors.
In fact, that’s a missing feature:
pmt::pmt_t len(pmt::car(msg)); //TODO for non-mult-8 nbits
pmt::pmt_t blob(pmt::cdr(msg));
if(!pmt::is_blob(blob))
throw std::runtime_error(“HDLC framer: PMT must be blob”);

Instead of making a pmt.intern(“String”), you will need to have a
u8vector. It’s a bit ugly to generate that in single line:

pmt.pmt_to_python.numpy_to_uvector(numpy.array([ord© for c in “Hello
World”], numpy.uint8))

you might need to add an “import block” that does an “import numpy”.

Greetings,
Marcus

Thank you, Nick, for clarification!
Yes, I was kind of messing that up.

I’ve done little PMT work – is there a convenient way to “reinterpret”
the payload of any PMT as u8v/blob?

Greetings,
Marcus