Capture FULL contents being transmitted over-the-air? #1117
-
Any guidance appreciated on how to do what I'll explain below; searching online has not been productive - probably because I'm not asking the question very well. This pertains to any protocol, not just LoRa or LoRaWAN. With a TON of help from people like the contributors to RadioLib, I have had great success now transmitting w/ various RF modules either attached to or built into a decent variety of microcontrollers. Depending on the context, I use commands such as node.uplink, node.sendReceive, or radio.transmit. Here is what I seek, please: As you all know, depending on the protocol, "more" is transmitted over-the-air than just my small payload. A 2-byte payload might result in 15, 18, 20 or more bytes actually transmitted depending on headers, To/From addresses, CRC, etc. To date, I have ALWAYS used a separate receiver to confirm what I was actually transmitting over-the-air. Only then do you really know if you are transmitting what you 'think' you are transmitting. What I really need, though, is a way to capture the FULL transmit contents locally on the microcontroller doing the transmitting. I'd like to save ALL of the outgoing bytes to an array, etc., at the same time (or INSTEAD OF) having those bytes sent on to the RF section to be transmitted. Can anyone please share if there is a place in RadioLib or typical microcontroller (C++ ?) code where the FULL outgoing series of bytes can be captured in this way? Many thanks! -Scott, K4KDR |
Beta Was this translation helpful? Give feedback.
Replies: 12 comments 13 replies
-
In generic terms (regardless of the library or radio being used), there is no way to get the entire packet this way, and the reason is pretty simple - under normal circumstances, some parts of the packet will be added automatically by the radio module. Things like preamble, packet length or checksum are not usually programmed directly by the user, but calculated and then added by the radio module. So the best you can get is the payload data, but not the additional stuff, unless the radio module has a function like a "dry run", sending the constructed packet to the host MCU instead of transmitting, which I haven't seen yet. Of course, the radio isn't magical - it contructs the packet based on the user inputs and configuration, so you can re-construct the packet by reading all the releveant configuration, but I don't think that's what you're after. Getting the payload data will of course depend on the library, RadioLib dumps it when SPI debug is enabled (as it's just another SPI transaction). |
Beta Was this translation helpful? Give feedback.
-
Thanks for the reply! After posting my question, I kept searching and when I saw the following, I did remember that when debug is enabled, you see the entire 'as-transmitted' packet in the serial output: ... at least, I 'think' that is the section of code that accomplishes that -- but I for sure recall seeing the ultimate over-the-air hex bytes in the debug output. Is there any way to access that same content in the code so that those bytes can be saved to an array? Thanks! |
Beta Was this translation helpful? Give feedback.
-
Thanks so much - I'll give it a try!! |
Beta Was this translation helpful? Give feedback.
-
Wanted to follow-up and confirm with huge thanks that your recommendation worked perfectly for me! It may be worth noting that the code added to LoRaWAN.h, regardless of the exact line number, needs to be ABOVE this section:
... the line numbers in my working file were slightly different, so the suggested "line 869" put that code below the 'RADIOLIB_GODMODE' section and therefore caused a 'private' error when compiling. But otherwise, as you can see below from an over-the-air test, I now have local access (on the transmitting device) to the full transmitted payload! |
Beta Was this translation helpful? Give feedback.
-
... I'll also take the liberty of posting the 'print' code that I added. In contrast w/ the screen shot above, I've also included an extra 'zero' to be printed in front of those single-digit bytes so that the output looks more like proper HEX bytes
... and the new result: |
Beta Was this translation helpful? Give feedback.
-
I'm nowhere near 'done' (are you REALLY ever 'done'?), but wanted to share what I was trying to accomplish. Using the long-standing LoRaWAN capabilities in RadioLib, of course it's no problem to assemble and transmit a valid, encrypted LoRaWAN packet using credentials setup on TTN, etc. But now that I am able to access the raw hex bytes generated by a command like (... I can't account for that 'Time Out While Transmitting' error - as you can see on the waterfall it DID transmit) ... of course, the painful part is that I don't have any way to DECODE the LR-FHSS to confirm that it's valid. But it's a start and I'm please to have gotten this far. Thanks again! |
Beta Was this translation helpful? Give feedback.
-
Great! Funny you should mention, because I did my initial setup for this 're-transmit LR-FHSS' scheme on the Pi-Pico/sx1262 combo until I realized that there WAS no LR-FHSS on the sx126x modules yet! Thanks!! |
Beta Was this translation helpful? Give feedback.
-
Please say if you'd prefer for me to open a separate ISSUE or DISCUSSION item for this related question, but despite searching all through RadioLib, I was not able to understand how to increase (or disable) the TX Time-Out value. LR-FHSS takes several seconds, depending on settings & payload length... much longer than most single LoRa packets. By chance could I throw in the towel and ask for direction on where I might be able to adjust that to eliminate the TX Time-Out error? Thanks! |
Beta Was this translation helpful? Give feedback.
-
No problem! Last night I did find: ... but did not know how to use it. |
Beta Was this translation helpful? Give feedback.
-
Related question on the topic of LR-FHSS, if you can put up with ONE MORE.... Do you know the baud rate & framing that these LR-FHSS GMSK packets utilize? Absent any existing code (or affordable hardware) to decode these signals, I'd like to invest some time in trying to decode even a PORTION of the packets now that transmitting them from the LR1110 is working so well. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Thanks - I'll dig into it!! I guess I was really (poorly) asking what modulation & framing RadioLib was using to transmit these LR-FHSS packets. |
Beta Was this translation helpful? Give feedback.
-
Ahh,, very good - thank you! I didn't know how much 'hands-on' manual manipulation you used to create LR-FHSS capability in RadioLib. Just wanted to have as much info to work with as possible - thanks! |
Beta Was this translation helpful? Give feedback.
Easiest solution is to add the following in
LoRaWAN.h
e.g. at line 869:And in
LoRaWAN.cpp
at line 1118:Then after an uplink you can retrieve it from your code: