I always get:
>>> lora.join(activation=LoRa.ABP, auth=auth, timeout=0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: overflow converting long int to machine word
wether I use 0x9A662B6B or 2590387051
I always get:
>>> lora.join(activation=LoRa.ABP, auth=auth, timeout=0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: overflow converting long int to machine word
wether I use 0x9A662B6B or 2590387051
What does your auth tuple look like? And what firmware version are you using?
Note that Pycom posted an example for ABP on their website
Here’s my code:
# main.py -- put your code here!
from network import LoRa
import socket
# Initialize LoRa in LORAWAN mode.
lora = LoRa(mode=LoRa.LORAWAN, sf=7, tx_power=14)
lora.BW_125KHZ
lora.CODING_4_5
# create an ABP authentication tuple (NwkSKey, AppSKey, DevAddr)
auth = (bytes([0x58, 0xB9, 0x47, 0x74, 0xAF, 0x6F, 0x97, 0x43, 0xEA, 0x0C, 0x58, 0xC5, 0x12, 0xA1, 0xDE, 0x68]), bytes([0x32, 0x83, 0xB1, 0xD7, 0x99, 0x05, 0x83, 0x29, 0x8F, 0xE5, 0xE4, 0xE8, 0x1A, 0xE7, 0x0E, 0xD6]), 0x9A662B6B)
# join a network using ABP (Activation By Personalization)
lora.join(activation=LoRa.ABP, auth=auth, timeout=0)
while not lora.has_joined():
print('Trying to join LoRa network')
sleep(1)
pass
print('Joined LoRa Network')
pycom.rgbled(GREEN)
s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
s.setblocking(False)
while True:
print('Sending Packet')
s.send('Hello from the LoPy')
print('Done sending')
sleep(2)
In their example they use 0x01 as DevAddr… that won’t work i guess?
Thanks!
until they fixed the API’s sending more the n1 packet still fails … no further updates from pycom so no idea when a fix is provided
no, ofc not you will needto add the DevAddr assign to you by TTN. Adding the HEX to valid int works for me … IF you run the latest firmware, older firmwares will not work.
But if I convert the DevAddr assigned by TTN to INT it results in 2590387051 and this also gives an error:
>>> # create an ABP authentication tuple (NwkSKey, AppSKey, DevAddr)
>>> auth = (bytes([0x58, 0xB9, 0x47, 0x74, 0xAF, 0x6F, 0x97, 0x43, 0xEA, 0x0C, 0x58, 0xC5, 0x12, 0xA1, 0xDE, 0x68]), bytes([0x32, 0x83, 0xB1, 0xD7, 0x99, 0x05, 0x83, 0x29, 0x8F, 0xE5, 0xE4, 0xE8, 0x1A, 0xE7, 0x0E, 0xD6]), 2590387051)
>>>
>>> # join a network using ABP (Activation By Personalization)
>>> lora.join(activation=LoRa.ABP, auth=auth, timeout=0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: overflow converting long int to machine word
Just experimented a little: Values up to 0x7FFFFFFF are OK but 0x80000000 and higher raise an overflow
My guess is that a signed type was used instead of an unsigned type to represent the dev-addr
You can work around this by choosing a dev-addr that is below 0x80000000
But As @kruisdraad mentions ABP isn’t working yet, only the first package arrivés, but if that feels like an achievement, just go ahead
A few things seem to be missing from the code?
import pycom
setting of GREEN to 0x00FF00
Thanks for your tips…
Indeed the code was missing some lines
But one more question: in ABP I cannot choose my own dev-addr as far a I know? So how should I choose one below 0x7FFFFFFF ?
Use the ttnctl command like mentioned here by @arjanvanb
And please change your keys because now they are known to the world
Thank you so much…finally I got my first message through!!!
Now time for my sodaq
(and yes, I will change those keys
Yes I hope so, I reported the problem on the Pycom forum. But at least there is a workaround by choosing your device address when using the ttnctl command as mentioned above. So it’s not as blocking as the 1 packet issue.
I probably don’t need it if I don’t know what it is–but I’m curious and can’t help asking. What’s ABP?
This topic is probably a good starter for your question.
For more information please refer to this nice starting point:
Hi all, Daniel Campora is working on a guide for using TTN with LoPy. You can find the current draft at:
https://www.thethingsnetwork.org/docs/draft/lopy/
If you have corrections or suggestions, just use the edit button to do a quick PR!
as long as stuff aint working, i am not spending another minute on the LoPy
That includes building docs
think there has been an update !
think its still not working, not even the new examples
Cant get the wifi working wither to be able to upload files to the LoPy with the new firmware. When I setup wifi to be a station it crashes
posted a working example using a Lopy with the latest firmware using OTAA and a Pi3 gateway in this topic: