RHF76-052 and decrypting payloads


(Toddkrein) #1

I’m still working on getting the RHF76-052 to work consistently with TTN, and while the upgrade to 2.1.18 has helped a lot, there are still issues. While the device will now join, it will only ever send one packet. After that, all requests to send another packet say they complete but do nothing.

I recompiled the packet forwarder on my RAK831 so it would show the packets, and here is what I have:

##### 2018-05-31 07:34:06 GMT #####
### [UPSTREAM] ###
# RF packets received by concentrator: 0
# CRC_OK: 0.00%, CRC_FAIL: 0.00%, NO_CRC: 0.00%
# RF packets forwarded: 0 (0 bytes)
# PUSH_DATA datagrams sent: 1 (153 bytes)
# PUSH_DATA acknowledged: 100.00%
### [DOWNSTREAM] ###
# PULL_DATA sent: 3 (100.00% acknowledged)
# PULL_RESP(onse) datagrams received: 0 (0 bytes)
# RF packets sent to concentrator: 0 (0 bytes)
# TX errors: 0
### [GPS] ###
# GPS sync is disabled
##### END #####

JSON up: {"stat":{"time":"2018-05-31 07:34:06 GMT","rxnb":0,"rxok":0,"rxfw":0,"ackr":100.0,"dwnb":0,"txnb":0,"pfrm":"IMST + Rpi","mail":"","desc":""}}
INFO: [up] PUSH_ACK for server bridge.us-west.thethings.network received in 25 ms

JSON up: {"rxpk":[{"tmst":572679724,"time":"2018-05-31T07:34:07.253499Z","chan":4,"rfch":1,"freq":903.100000,"stat":1,"modu":"LORA","datr":"SF10BW125","codr":"4/5","lsnr":9.0,"rssi":-53,"size":23,"data":"AJ3xANB+1bNwQgBTAGmyeEdwDJelFvY="}]}
INFO: [up] PUSH_ACK for server bridge.us-west.thethings.network received in 25 ms
INFO: [down] for server bridge.us-west.thethings.network serv_addr[ic]PULL_RESP received :)

JSON down: {"txpk":{"imme":false,"tmst":577679724,"freq":925.7,"rfch":0,"powe":20,"modu":"LORA","datr":"SF10BW500","codr":"4/5","ipol":true,"size":17,"ncrc":true,"data":"IF7F4ewcSjYAja66+UFyNAI="}}
INFO: [down] a packet will be sent on timestamp value 577679724

JSON up: {"rxpk":[{"tmst":578214676,"time":"2018-05-31T07:34:12.789147Z","chan":1,"rfch":0,"freq":902.500000,"stat":1,"modu":"LORA","datr":"SF10BW125","codr":"4/5","lsnr":12.2,"rssi":-54,"size":17,"data":"QAAkAiaAAQAI98gnQBDg3Vw="}]}
INFO: [up] PUSH_ACK for server bridge.us-west.thethings.network received in 25 ms
INFO: [down] for server bridge.us-west.thethings.network PULL_ACK received in 24 ms
INFO: [down] for server bridge.us-west.thethings.network serv_addr[ic]PULL_RESP received :)

JSON down: {"txpk":{"imme":false,"tmst":580214676,"freq":923.3,"rfch":0,"powe":20,"modu":"LORA","datr":"SF12BW500","codr":"4/5","ipol":true,"size":22,"ncrc":true,"data":"YAAkAiaKAAADQAIAcQM1AP8BKBjJCg=="}}
INFO: [down] a packet will be sent on timestamp value 580214676
INFO: [down] for server bridge.us-west.thethings.network PULL_ACK received in 24 ms
INFO: [down] for server bridge.us-west.thethings.network PULL_ACK received in 24 ms

I’d like to better understand what is flying back and forth, which leads me to my question: How can I decrypt the payload data so that I can parse it?

Thanks!


(Arjan) #4

This can be decoded using an online LoRaWAN packet decoder:

Message Type = Join Request
  PHYPayload = 009DF100D0756CDC108014C01A6C9E11DC0325E945BD

( PHYPayload = MHDR[1] | MACPayload[..] | MIC[4] )
        MHDR = 00
  MACPayload = 9DF100D0756CDC108014C01A6C9E11DC03
         MIC = 25E945BD

( MACPayload = AppEUI[8] | DevEUI[8] | DevNonce[2] )
      AppEUI = 10DC6C75D000F19D
      DevEUI = DC119E6C1AC01480
    DevNonce = 2503

Likewise:

Message Type = Data
  PHYPayload = 400024022680010008F7C8274010E0DD5C

( PHYPayload = MHDR[1] | MACPayload[..] | MIC[4] )
        MHDR = 40
  MACPayload = 0024022680010008F7C82740
         MIC = 10E0DD5C

( MACPayload = FHDR | FPort | FRMPayload )
        FHDR = 00240226800100
       FPort = 08
  FRMPayload = F7C82740

      ( FHDR = DevAddr[4] | FCtrl[1] | FCnt[2] | FOpts[0..15] )
     DevAddr = 26022400 (Big Endian)
       FCtrl = 80
        FCnt = 0001 (Big Endian)
       FOpts = 

Message Type = Unconfirmed Data Up
   Direction = up
        FCnt = 1
   FCtrl.ACK = false
   FCtrl.ADR = true

If you have the secrets, the decoder can also decrypt the payload (F7C82740 in the example above) for you.


#6