I’m using the LoRa-E5 module with AT commands sending data to Everynet (I’ve already done this with other modules). When sending the command “AT+CMSG=ABCDEFGHIJK” the value “DC0CShwot+Up1YM=” is received in base64 which when decoded is showing “[12, 45, 2, 74, 28, 40, 183, 229, 41, 213 , 131]” and not what was sent.
What is going wrong? What type of encode is being used?
Complete log:
TRACE src\network\loraWAN.cpp:240 LORA Response: [+AT: OK]
TRACE src\network\loraWAN.cpp:214 Send command: AT+ID=DevAddr,562a672d size: 23
TRACE src\network\loraWAN.cpp:215 Wait module response…
TRACE src\network\loraWAN.cpp:240 LORA Response: [+ID: DevAddr, 56:2A:67:2D]
TRACE src\network\loraWAN.cpp:214 Send command: AT+KEY=APPKEY,1c4a9f1c69bf1f5e4cdcc976306bb2c0 size: 47
TRACE src\network\loraWAN.cpp:215 Wait module response…
TRACE src\network\loraWAN.cpp:240 LORA Response: [+KEY: APPKEY 1C4A9F1C69BF1F5E4CDCC976306BB2C0]
TRACE src\network\loraWAN.cpp:214 Send command: AT+KEY=NWKSKEY,79a95efc6e4cbec72ba69492086341df size: 48
TRACE src\network\loraWAN.cpp:215 Wait module response…
TRACE src\network\loraWAN.cpp:240 LORA Response: [+KEY: NWKSKEY 79A95EFC6E4CBEC72BA69492086341DF]
TRACE src\network\loraWAN.cpp:214 Send command: AT+DR=AU915 size: 12
TRACE src\network\loraWAN.cpp:215 Wait module response…
TRACE src\network\loraWAN.cpp:240 LORA Response: [+DR: AU915]
TRACE src\network\loraWAN.cpp:214 Send command: AT+LW=VER,V102B size: 16
TRACE src\network\loraWAN.cpp:215 Wait module response…
TRACE src\network\loraWAN.cpp:240 LORA Response: [+LW: VER, V102B]
TRACE src\network\loraWAN.cpp:214 Send command: AT+MODE=LWABP size: 14
TRACE src\network\loraWAN.cpp:215 Wait module response…
TRACE src\network\loraWAN.cpp:240 LORA Response: [+MODE: LWABP]
TRACE src\network\loraWAN.cpp:214 Send command: AT+PORT=7 size: 10
TRACE src\network\loraWAN.cpp:215 Wait module response…
TRACE src\network\loraWAN.cpp:240 LORA Response: [+PORT: 7]
TRACE src\network\loraWAN.cpp:214 Send command: AT+CLASS=A size: 12
TRACE src\network\loraWAN.cpp:215 Wait module response…
TRACE src\network\loraWAN.cpp:240 LORA Response: [+CLASS: A]
TRACE src\network\loraWAN.cpp:214 Send command: AT+CH=NUM,0-7 size: 14
TRACE src\network\loraWAN.cpp:215 Wait module response…
TRACE src\network\loraWAN.cpp:240 LORA Response: [+CH: NUM, 0-7]
TRACE src\network\loraWAN.cpp:214 Send command: AT+RETRY=15 size: 13
TRACE src\network\loraWAN.cpp:215 Wait module response…
TRACE src\network\loraWAN.cpp:240 LORA Response: [+RETRY: 15]
TRACE src\network\loraWAN.cpp:214 Send command: AT+CMSG=ABCDEFGHIJK size: 21
TRACE src\network\loraWAN.cpp:215 Wait module response…
TRACE src\network\loraWAN.cpp:240 LORA Response: [+CMSG: Start]
Are you still dealing with that problem?
Yes, my project still problems
My project still not running!
Hi there,
I think the Command is incorrect , try This…
“AT+CMSGHEX”
Hth
GL PJ
“AT+CMSGHEX=ABCDEFGHIJK”
There are several sending modes, including “string”, “hex” mode with confirmation and without confirmation according to the AT command documentation. I can send the problem is that the data is “encoded” in a strange way.
When I receive the data from everynet they are in base64 and even after decoding the data they do not correspond to what was sent. I’ve used big and little endian and changed the byte orders and it never works. I requested support from everynet and after the engineer analyzed it, he said it was a problem with the LoRa module encoder.
Below is a python code trying to decode:
import base64
import json
import struct
#AT+CMSGHEX=“000A0014” size: 23
base64_string = “TWVBGg==”
content = base64.b64decode(base64_string)
print(content)
asd = list(content)
def bytes2HexString(arrBytes):
str_hex = ‘’
for num in arrBytes:
if num < 0:
tmp = format(255 + num + 1, ‘x’)
else:
tmp = format(num, ‘x’)
if len(tmp) == 1:
tmp = ‘0’ + tmp
str_hex += tmp
return str_hex
def decoder(bytes_data):
decoded = {}
decoded['temp'] = (bytes_data[0] << 8) | bytes_data[1]
decoded['humi'] = (bytes_data[2] << 8) | bytes_data[3]
return decoded
bytes_hex = bytes2HexString(content)
print(bytes_hex)
asd2 = bytes2HexString(asd)
print(asd2)
decoded = decoder(content)
print(decoded)
Hi there,
Ah’ I see now, Some encoding going on or maybes “two compliment”
Curious to know what happens if you;
AT+SEND=<Address>,<Payload Length>,<Data>
<Address>0~65535, When the <Address> is 0,
it will send data to all address (From 0 to
65535.)
<Payload Length> Maximum 240bytes
<Data>ASCII Format
Example : Send HELLO string to the Address 50,
AT+SEND=50,5,HELLO
+OK
Search last transmit data,
AT+SEND?
+SEND=50,5,HELLO
does it work?
GL PJ
I couldn’t find that command “AT+CMSG” in the Lora e5 Reference?
Can you get the factory settings, echo’d ?
AT+FACTORY
The at commands are described in the following document and I receive the data but it is in the incorrect format
Hi there,
Cool Thanks, I see the first thing , my lack of functional knowledge of LoRa in general.
could the " " be helpfull?
NOTE: You could use quote sign < " > to force input parameter with space, such as <AT+MSGHEX=“AA BB CC DDEE”>, then “AA BB CC DD EE” is treated as one parameter. But if you input command <AT+MSGHEX=AA BB CC DDEE>, “AABBCC DD EE” will treated as 5 parameters, AT+MSGHEX returns error.
also if it’s a STRING , why not ;
4.9 PMSG
Use to send string format LoRaWAN proprietary frames. Format:
AT+PMSG=" Data to send" eg: AT+PMSG=" This is a string" Return: +PMSG: Start +PMSG: Done
Gl PJ
I’ll read up and get one or two of those Units to test with.