LoRa Implicit Modes for UKHAS / LoRa-gateway

162 views
Skip to first unread message

Kev Walton

unread,
Oct 8, 2022, 10:47:37 AM10/8/22
to UKHAS

Hi

I have been trying to get the Implicit Header modes [1] working on a new LoRa Transmitter with lora-gateway, and it took me a while to figure it out (a lot of talking to a rubber duck!).  I also couldn't find much written about it, other than others also having problems, so I thought I would document my findings.

In summary, Implicit mode packets (for reception by lora-gateway etc) need to be 255 bytes long, they need to include a LoRa CRC, and they can't be used for UKHAS ASCII Telemetry.

I am using https://github.com/jgromes/RadioLib to talk to my SX1278 module, so for any of the implicit modes I need:

  • radio.begin(LORA_FREQUENCY, LORA_BW, LORA_SPREADFACTOR, LORA_CODERATE, LORA_SYNCWORD, LORA_POWER, LORA_PREAMBLELENGTH, LORA_GAIN);
  • radio.implicitHeader(255);
  • radio.forceLDRO(0);
  • radio.setCRC(true);

And then when I transmit my string, I make sure it is a full 255 character string.

  • radio.transmit(TxLine);

Doing that gets me a valid reception in lora-gateway (Packet SNR etc gets set, rx gets logged to packets.txt), but no packet is displayed as the ProcessTelemetryMessage function rules out any sentences longer than 249 characters.

Also worthy of documenting whilst I am here, is the different message types (based on first character) that lora-gateway accepts - I never realised it had so much functionality built in (Thanks Dave and all):

  • ! = Message for uploading
  • ^ = Calling mode
  • $ = Telemetry string
  • %= repeated telemetry string
  • > = Flight controller message
  • < = Local data
  • * = Uplink Command message
  • + = Telnet Uplink message
  • - = Telnet message
  • . = Sync message
  • \0 = Null message

As well as binary markers for SSDV and HABpack message

Hope that is useful to someone one day and saves them some frustration :)

[1] https://github.com/PiInTheSky/pits/blob/master/tracker/lora.c#L61

Cheers

Kev

David Akerman

unread,
Oct 8, 2022, 11:39:03 AM10/8/22
to uk...@googlegroups.com
Kev,

"In summary, Implicit mode packets (for reception by lora-gateway etc) need to be 255 bytes long"

Yes, the reason for using implicit packet details - length etc - is to remove the header information that would normally include that data.  Removing the header shortens the packets and thus increases throughput.  The downside is that both transmitter and receiver have to use the same settings, e.g. 255 byte packets.  There's little point in using implicit mode with sub 255 byte packets since the idea is to get the highest throughput and using less than 255 bytes would work against that.

255 bytes is 1 short of the SSDV packet size, however SSDV uses 2 fixed bytes at the start, so for SSDV we simply remove the first of those before transmission then put it back in at the receiver.

"they need to include a LoRa CRC"

Without the CRC there would be a lot of bad packets coming through.

"and they can't be used for UKHAS ASCII Telemetry"

That's not true.  In fact the usual transmission for PITS is mode 1 which is implicit, 255 byte packets.

Dave

--
You received this message because you are subscribed to the Google Groups "UKHAS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ukhas+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ukhas/982e2a89-24b1-48f5-996d-331ae7848957n%40googlegroups.com.

Kev Walton

unread,
Oct 8, 2022, 1:42:30 PM10/8/22
to UKHAS
Hi Dave

""and they can't be used for UKHAS ASCII Telemetry"

That's not true.  In fact the usual transmission for PITS is mode 1 which is implicit, 255 byte packets."

Mmm, of course, because otherwise we couldn't mix SSDV and Telemetry packets, but it didnt work for me, and this bit of code in lora-gateway persuaded me I knew why:

"int ProcessTelemetryMessage(int Channel, received_t *Received)
{
   int Repeated = 0;
if (strlen(Received->UKHASstring) < 250)"


My packets.txt shows the reception of my 255 byte UKHAS strings:

2022-10-08 10:11:14 - Ch 0, SNR 6, RSSI -82, Freq 434566.0, FreqErr -0.1, BW 20.80, EC 4:5, SF 6, LDRO 0, Impl 1, Bytes 255, Type 24h

and an extra debug message in DIO0_Interupt() was showing the UKHAS string I transmitted correctly:

            "else if ((Received.Message[0] == '$') || (Received.Message[0] == '%'))
            {
                                int Repeated;
                                //KW LogMessage( "Ch%d: KW %s\n", Channel, Received.Message);"

So I am not sure how messages from PITS get through, when my messages were not, any pointers appretiated.

Cheers
Kev

David Akerman

unread,
Oct 8, 2022, 1:44:23 PM10/8/22
to UKHAS
Missing terminating \n and/or null?

Kev Walton

unread,
Oct 8, 2022, 2:06:37 PM10/8/22
to UKHAS
Sorted, thank you, the UKHAS Telemetry string needs a \n\0, and *does* have to be less than 250 bytes, but it is contained inside a LoRa packet that has to be 255 bytes.  I was putting the \0 as the 255th byte, rather than directly at the end of the  UKHAS Telemetry string.

Cheers
Kev

gw7...@gmail.com

unread,
Oct 9, 2022, 10:51:54 AM10/9/22
to UKHAS
If SSDV mode uses spreading factor 6, then on SX127x modules you can only use implicit packet mode,  so fixed length packets only. 
Reply all
Reply to author
Forward
0 new messages