Unmarshal phypayload error

hi everyone:
When I set up the LoRaserver, it looks like the connection is normal, but the frames I received are parsed incorrectly, please let me know what the problem is.
This is the print information,I’ll give you more information you want to know.Thanks。

16:23:16 black-virtual-machine loraserver[1284]: time=“2018-06-22T16:23:16+08:00” level=error msg=“backend/gateway: unmarshal phypayload error: lorawan: at least 7 bytes needed to decode FHDR” data_base64=“eyJyeEluZm8iOnsibWFjIjoiMDAxNDk3ZmZmZjE1YzM4NiIsInRpbWVzdGFtcCI6MzE1NDc3NTcyMCwiZnJlcXVlbmN5Ijo0NzAwMDAwMDAsImNoYW5uZWwiOjAsInJmQ2hhaW4iOjAsImNyY1N0YXR1cyI6MSwiY29kZVJhdGUiOiI0LzYiLCJyc3NpIjotMjgsImxvUmFTTlIiOi0yOSwic2l6ZSI6MTEsImRhdGFSYXRlIjp7Im1vZHVsYXRpb24iOiJMT1JBIiwic3ByZWFkRmFjdG9yIjoxMCwiYmFuZHdpZHRoIjo1MDB9LCJib2FyZCI6MCwiYW50ZW5uYSI6MH0sInBoeVBheWxvYWQiOiJhR1ZzYkc4c2JHOXlZU0U9In0=”
6月 22 16:23:19 black-virtual-machine loraserver[1284]: time=“2018-06-22T16:23:19+08:00” level=info msg=“backend/gateway: rx packet received”
6月 22 16:23:19 black-virtual-machine loraserver[1284]: time=“2018-06-22T16:23:19+08:00” level=error msg=“backend/gateway: unmarshal phypayload error: lorawan: at least 7 bytes needed to decode FHDR” data_base64=“eyJyeEluZm8iOnsibWFjIjoiMDAxNDk3ZmZmZjE1YzM4NiIsInRpbWVzdGFtcCI6MzE1Nzc3NTI1MSwiZnJlcXVlbmN5Ijo0NzAwMDAwMDAsImNoYW5uZWwiOjAsInJmQ2hhaW4iOjAsImNyY1N0YXR1cyI6MSwiY29kZVJhdGUiOiI0LzYiLCJyc3NpIjotMjgsImxvUmFTTlIiOi0yOCwic2l6ZSI6MTEsImRhdGFSYXRlIjp7Im1vZHVsYXRpb24iOiJMT1JBIiwic3ByZWFkRmFjdG9yIjoxMCwiYmFuZHdpZHRoIjo1MDB9LCJib2FyZCI6MCwiYW50ZW5uYSI6MH0sInBoeVBheWxvYWQiOiJhR1ZzYkc4c2JHOXlZU0U9In0=”
6月 22 16:23:22 black-virtual-machine loraserver[1284]: time=“2018-06-22T16:23:22+08:00” level=info msg=“backend/gateway: rx packet received”
6月 22 16:23:22 black-virtual-machine loraserver[1284]: time=“2018-06-22T16:23:22+08:00” level=error msg=“backend/gateway: unmarshal phypayload error: lorawan: at least 7 bytes needed to decode FHDR” data_base64=“eyJyeEluZm8iOnsibWFjIjoiMDAxNDk3ZmZmZjE1YzM4NiIsInRpbWVzdGFtcCI6MzE2MDc2NTE0MCwiZnJlcXVlbmN5Ijo0NzAwMDAwMDAsImNoYW5uZWwiOjAsInJmQ2hhaW4iOjAsImNyY1N0YXR1cyI6MSwiY29kZVJhdGUiOiI0LzYiLCJyc3NpIjotMjgsImxvUmFTTlIiOi0yOCwic2l6ZSI6MTEsImRhdGFSYXRlIjp7Im1vZHVsYXRpb24iOiJMT1JBIiwic3ByZWFkRmFjdG9yIjoxMCwiYmFuZHdpZHRoIjo1MDB9LCJib2FyZCI6MCwiYW50ZW5uYSI6MH0sInBoeVBheWxvYWQiOiJhR1ZzYkc4c2JHOXlZU0U9In0=”
6月 22 16:23:25 black-virtual-machine loraserver[1284]: time=“2018-06-22T16:23:25+08:00” level=info msg=“backend/gateway: rx packet received”
6月 22 16:23:25 black-virtual-machine loraserver[1284]: time=“2018-06-22T16:23:25+08:00” level=error msg=“backend/gateway: unmarshal phypayload error: lorawan: at least 7 bytes needed to decode FHDR” data_base64=“eyJyeEluZm8iOnsibWFjIjoiMDAxNDk3ZmZmZjE1YzM4NiIsInRpbWVzdGFtcCI6MzE2Mzc2MzI2MCwiZnJlcXVlbmN5Ijo0NzAwMDAwMDAsImNoYW5uZWwiOjAsInJmQ2hhaW4iOjAsImNyY1N0YXR1cyI6MSwiY29kZVJhdGUiOiI0LzYiLCJyc3NpIjotMjcsImxvUmFTTlIiOi0yOCwic2l6ZSI6MTEsImRhdGFSYXRlIjp7Im1vZHVsYXRpb24iOiJMT1JBIiwic3ByZWFkRmFjdG9yIjoxMCwiYmFuZHdpZHRoIjo1MDB9LCJib2FyZCI6MCwiYW50ZW5uYSI6MH0sInBoeVBheWxvYWQiOiJhR1ZzYkc4c2JHOXlZU0U9In0=”
btw,This is my data frame decoded by base64。
{
“rxInfo”:
{
“mac”:“001497ffff15c386”,
“timestamp”:2462401308,
“frequency”:470000000,
“channel”:0,
“rfChain”:0,
“crcStatus”:1,
“codeRate”:“4/6”,
“rssi”:-38,
“loRaSNR”:-38,
“size”:11,
“dataRate”:
{
“modulation”:“LORA”,
“spreadFactor”:10,
“bandwidth”:500
},
“board”:0,
“antenna”:0
},
“phyPayload”:“aGVsbG8sbG9yYSE=”
}
The format of the frame looks like OK? I think?

You would have to dive into the content of aGVsbG8sbG9yYSE=, I can’t tell if the frame looks correct. You have to go byte by byte and compare this with the LoRaWAN specification.

Given that it raises an error, there is probably something wrong with your frame, or there is a bug in the https://github.com/brocaar/lorawan library.

hey,brocaar,Surprise and Thanks to see your reply again:grin:,In fact, my pyload is “hello,lora!” after decoding base64。actually,I want to know why I need at least 7 bytes to decode FHDR ,btw,What is FHDR? ,thank you for your reply again!

FHDR is the frame Header (see section 4.3.1 LoRaWAN spec v1.0.2) it contains several information about ADR, Frame counter, mac command. And in your case, you should take a look to its size which is 7 to 22 bytes (if option or not) --> there is 7 mandatory fields in FHDR.

My God, I noticed when viewing the file about LoRaWAN . This is my mistake. I think I need to review it again,Thank you so much! I know how to modify my software.