Giter VIP home page Giter VIP logo

pycom-libraries's Introduction

Pycom Libraries and Examples

Introduction

This repository contains libraries and out of the box examples for Pycom devices, including the Shields: Pysense, Pytrack, and Pyscan.

Table of Contents

Links

pycom-libraries's People

Contributors

aditya18jain avatar ajmansfield avatar bucknalla avatar catalinio avatar cuca94 avatar danspndl avatar doniks avatar eflorent2020 avatar ep1cman avatar esp32de avatar fusspawn avatar gijsio avatar jcaron23 avatar livius2 avatar ljmerza avatar lukanite avatar oligauc avatar peter-pycom avatar pywebdesign avatar ralphhogenbirk avatar robert-hh avatar tomazursic avatar xykon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pycom-libraries's Issues

Pysense board ADC code generates an exception

Dear,

I have a loPy (1.7.7.b1) with a Pysense board. I changed the sense.py example into main.py with a few changes. Nothing special. However after running it, it will crash/stop.

Traceback (most recent call last):
File "main.py", line 41 in <module>
File "main.py", line 35 in <main>
File "/flash/lib/pysense.py", line 177, in read_battery_voltage
File "/flash/lib/pysense.py", line 118, in peek_memory
File "/flash/lib/pysense.py", line 85, in _write
File "/flash/lib/pysense.py", line 97, in _wait
OSError: I2C bus error
Micropython v1.8.6-715-g5fa16c2c on 2017-07-20; LoPy with ESP32

There is no I2C error but reading (peeking) the battery voltage is generating the problem.

Rebooting it by ctrl-C, ctrl-D let it tells me that the Pysense board cannot be found. Looking at the code the problem seems to be in the init part and the read_battery_voltage part of the code. Disabling the ADC init code and not using the py_read_battery_voltage() anymore keeps everything running.

Only de-powering the unit completely (no battery/no USB) will "recognise" the board again, but any use of the read_battery_voltage will raise an exception again.

DeepSleep library example do not work

Hello, I've tried to execute the example of DeepSleep.

I followed this guide, trying to figure the obscure steps:
https://docs.pycom.io/chapter/datasheets/boards/deepsleep/api.html

First, I added this example as a project in Atom:
https://github.com/pycom/pycom-libraries/tree/master/examples/deepsleep
So, I have a single main.py on my project.

Then I've copied the deepsleep.py file to the the ./lib/deepsleep/deepsleep.py path in my project.
The file I've copied is this: https://github.com/pycom/pycom-libraries/blob/master/deepsleep/deepsleep.py
Now I have two files
./main.py
./lib
./lib/deepsleep/deepsleep.py

Then I sync the project with my SiPy using the Atom Pimakr plugin and after the reset I see this:

Traceback...
File "", line 3, in
TypeError: 'module' object is not callable

I've tried to change
ds = DeepSleep()
to
ds = DeepSleep.DeepSleep()

and then

Traceback (most recent call last):
File "main.py", line 6, in
File "/flash/lib/deepsleep/DeepSleep.py", line 145, in get_wake_status
File "/flash/lib/deepsleep/DeepSleep.py", line 76, in peek
IndexError: bytes index out of range

Thanks for fixing the documentation and/or example and/or library.

Best regards.

pytrack: loses gps fix then crashes

wipy2.0

os.uname()=

(sysname='WiPy', nodename='WiPy', release='1.7.5.b2', version='v1.8.6-694-g25826866 on 2017-06-29', machine='WiPy with E
SP32')

pytrack dfu ver: 0.0.3

  1. loaded pytrack.py,L76GNSS.py and other classes from pycom github repo into /lib
  2. created the attached code (inside zip archive):
    gpsNtpSaveTest_cpy.zip

after some seconds of getting cordinates into the while loop, l76.coordinates() starts alternating (None,None)
and the correct values.
screenshot 2017-07-03 16 22 42

after another some seconds the device rebooted by itself
screenshot 2017-07-03 16 23 56

lorawan-nano-gateway gateway error code

hello
being using the exemple file stated above the node don't connect in otaa mode using another lopy as a gateway...
it keeps on saying not joined yet. i try the otaa node code with another ttn gateway and it worked well for both apb and otaa activation so i fugured out it would be on the gateway side

on ttn console only join request on the gateway trafic no up or downlink message.
does anybody else have the same problem...

thanks for your answer

Sqnsupgrade via UART fails on FiPy: object 'LTE' has no attribute 'modem_upgrade_mode'

I'm trying to get my FiPy to work with the Hologram SIM card in Canada. I've tested the SIM in my iPhone and it works fine, it hops around between networks for a few min but eventually successfully joins ROGERS and receives SMS and data over LTE. However, when I put the SIM in my FiPy and try connecting I just get the following on repeat, and it never manages to attach:

modem command: AT+CEREG?
response=['+CEREG: 2,0', 'OK']
tac=0
modem command: AT+CSQ
response=['+CSQ: 99,99', 'OK']
not attached: 5 secs

...many seconds later...

modem command: AT+CEREG?
response=['+CEREG: 2,4', 'OK']
tac=4
modem command: AT+CSQ
response=['+CSQ: 99,99', 'OK']
not attached: 465 secs

In the process of trying to get it to work I'm attempting an SQNS upgrade, but hit this error while following these instructions: https://docs.pycom.io/tutorials/lte/firmware
(fyi there's also a broken link in those docs: https://github.com/pycom/pycom-libraries/lib/sqnsupgrade​ should be /tree/...)

Uploading project (main folder)...
Not safe booting, disabled in settings
Reading file status
[1/5] Writing file lib/sqnsbr.py
[2/5] Writing file lib/sqnscodec.py
[3/5] Writing file lib/sqnscrc.py
[4/5] Writing file lib/sqnstp.py
[5/5] Writing file lib/test_sd.py
Upload done, resetting board...
OKets Jun  8 2016 00:22:57

rst:0x7 (TG0WDT_SYS_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff8028,len:8
load:0x3fff8030,len:1728
load:0x4009fa00,len:0
load:0x4009fa00,len:14584
entry 0x400a059c
Pybytes library: v0.9.0
Preparing modem for upgrade...
Attempting AT wakeup...
Starting STP (DO NOT DISCONNECT POWER!!!)
Session opened: version 1, max transfer 8192 bytes
Sending 54854 bytes: [########################################] 100%
Bootrom updated successfully, switching to upgrade mode
Attempting AT auto-negotiation...
Going into MIRROR mode... please close this terminal to resume the upgrade via UART
Traceback (most recent call last):
  File "main.py", line 2, in <module>
  File "/flash/lib/sqnsupgrade.py", line 575, in uart
  File "/flash/lib/sqnsupgrade.py", line 503, in upgrade_uart
  File "/flash/lib/sqnsupgrade.py", line 309, in __run
  File "/flash/lib/sqnsupgrade.py", line 461, in uart_mirror
AttributeError: type object 'LTE' has no attribute 'modem_upgrade_mode'
Pycom MicroPython 1.18.0.r1 [v1.8.6-849-9569a73] on 2018-07-20; FiPy with ESP32
Type "help()" for more information.

After a power cycle it gets stuck here:

Your modem is in recovery mode. You will need to use updater.elf file to upgrade.
Preparing modem for upgrade...
Attempting AT auto-negotiation...

Attempting the computer side of the upgrade at this point fails as well:

>>> sqnsupgrade.run('/dev/tty.usbmodemPy1197bb', '/Users/squash/Downloads/CATM1-38638/CATM1-38638.dup', '/Users/squash/Downloads/CATM1-38638/updater.elf')
<<< Welcome to the SQN3330 firmware updater >>>
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/squash/Documents/Code/pycom/pycom-libraries/lib/sqnsupgrade/sqnsupgrade.py", line 585, in run
    sqnup.upgrade_ext(port, ffile, mfile, resume, debug, False)
  File "/Users/squash/Documents/Code/pycom/pycom-libraries/lib/sqnsupgrade/sqnsupgrade.py", line 515, in upgrade_ext
    success = self.__run(file_path=mfile, load_ffh=True, port=port, debug=debug, pkgdebug=pkgdebug)
  File "/Users/squash/Documents/Code/pycom/pycom-libraries/lib/sqnsupgrade/sqnsupgrade.py", line 271, in __run
    response = self.return_pretty_response(self.read_rsp(size=7))
  File "/Users/squash/Documents/Code/pycom/pycom-libraries/lib/sqnsupgrade/sqnsupgrade.py", line 81, in return_pretty_response
    lines = rsp.decode('ascii').split('\r\n')
UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position 0: ordinal not in range(128)

Issue updating GPY

import sqnsupgrade
sqnsupgrade.uart(True)
Your modem is in recovery mode. You will need to use updater.elf file to upgrade.
Preparing modem for upgrade...
Attempting AT auto-negotiation...
ERROR sending AT command... no response? b''
AT auto-negotiation failed! Exiting.

I've already updated the main firmware on GPY https://docs.pycom.io/gettingstarted/installation/firmwaretool

Please let me know what else I should try.

Exception: Board not detected: I2C bus error (Pytrack only)

I'm not able to use the pytrack sensors (the board communicates fine through USB) with either of the fipy or gpy boards that I have. When I try to access a sensor on the Pytrack, whether it's the GPS or accelerometer, I get the error below. I've tried both stable and developer Pycom firmware updates, and am running the latest 0.0.8 DFU for the pytrack.

If I replace the pytrack with a pysense board and update the library imports, the pysense board is detected and the accelerometer code works fine.

Any ideas what I'm missing? Is there something special I need to configure on the pytrack to work with Fipy or Gpy?

Traceback (most recent call last):
File "", line 7, in
File "/flash/lib/pytrack.py", line 8, in init
File "/flash/lib/pycoproc.py", line 93, in init
File "/flash/lib/pycoproc.py", line 93, in init
Exception: Board not detected: I2C bus error

Boards tested:
Working: tested both Fipy and gpy + pysense (latest pysense_0.0.8.dfu and stable Pycom firmware)
Not working: tested both Fipy and gpy + pytrack (latest pytrack_0.0.8.dfu and stable or dev Pycom firmware)

Code tested:

import machine
from machine import I2C
from LIS2HH12 import LIS2HH12
from pytrack import Pytrack

py = Pytrack()
acc = LIS2HH12()

while True:
   print("Grabbing pitch")
   pitch = acc.pitch()
   roll = acc.roll()
   print('{},{}'.format(pitch, roll))
   time.sleep_ms(100)

MQTT error ECONNRESET

Hi I am receiving the following error after 2 packets are published successfully, with source code here:

>>> client.publish("wipy/", "test")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/flash/lib/mqtt.py", line 110, in publish
OSError: [Errno 104] ECONNRESET

This error is reported in a couple of different threads on the forums, and perhaps can be resolved by implementing umqtt-robust. I don't get this error when publishing from my Mac.

UPDATE: I identified the root cause as my using the same client_id on multiple devices.

Lopy4 TTN Join fail - Code examples NOT working

Hi,

We need an example code that works / with Lopy4 - The things Network for US frequency, we have several projects running with Pycom boards, there are too many flaws with these devices.

This code works with Lopy but NOT with Lopy4

from network import LoRa
import socket
import binascii
import time
import machine
import pycom
import os

pycom.heartbeat(False)

lora = LoRa(mode=LoRa.LORAWAN, public=True, adr=False)

for index in range(0, 8): #turn off channels 0-7
lora.remove_channel(index)

for index in range(16, 65): #turn off channels 16-64
lora.remove_channel(index)

for index in range(66, 72): #turn off channels 66-71
lora.remove_channel(index)

auth = (bytes([ 0x70, 0xB3, 0xD5, 0x7E, 0xD0, 0x00, 0xB5, 0x78 ]),
bytes([ 0xCE, 0xF9, 0x6A, 0x8F, 0x9D, 0x28, 0x1D, 0x51, 0x4C, 0xEC, 0xF1, 0x14, 0xE3, 0xA9, 0xD3, 0x4C ]))

print("Starting Join...")
lora.join(activation=LoRa.OTAA, auth=auth, timeout=0)
x=0

while (not lora.has_joined() and x<10):
time.sleep(2.5)
print('Lora Joining...');
x=x+1
print('Lora has joined?= ', lora.has_joined())

s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
s.setsockopt(socket.SOL_LORA, socket.SO_DR, 3)
lora.remove_channel(65)
s.setblocking(False)
time.sleep(5.0)

if (lora.has_joined()):
print('Joined...')

while True:
s.send(bytes([0x01]))
time.sleep(60)

I appreciate your help.

(sysname='LoPy', nodename='LoPy', release='1.18.1.r1', version='v1.8.6-849-b0520f1 on 2018-08-29', machine='LoPy with ESP32', lorawan='1.0.2')

Parsing of GPRMC messages

Currently only GLL messages (only containing location information) are parsed. It would be useful if parsing of GPRMC messages could be done also including speed and direction information

valueError : 868100000

Hi

I get ValueError 868100000 on startup but nanogateway is connecting to ttn . If I change value LORA_FREQUENCY = 903900000 there is no error .

pytrack accelerometer wrong values

Hi, I'm playing with the wipy2 + pytrack.

os.uname()=
(sysname='WiPy', nodename='WiPy', release='1.7.5.b2', version='v1.8.6-694-g25826866 on 2017-06-29', machine='WiPy with E
SP32')

pytrack dfu ver: 0.0.3

I used the turorial script from github to get the accelerometers data in a while loop:

while True:
    print("{} {:>10.3} {:>10.3} {:>10.3} ".format(li.acceleration(), li.pitch(), li.yaw(), li.roll()))
    utime.sleep_ms(500)

I think I got some bugged response

laying on the bench it seems all regular:


(-0.015625, -0.0007324219, 1.014038)      0.884    -0.0414     -0.883
(-0.01708984, 0.001098633, 1.014404)      0.967      0.062     -0.965  

but if I roll the pytrack, both pitch and roll reads some values:

(0.9797363, -0.1525879, -0.07019043)        -86      -8.83       80.3
(1.001099, -0.1734619, -0.1179199)      -83.4      -9.76       78.2 

if I pitch the pytrack, pitch and yaw reads some values:

(-0.03173828, 0.994873, -0.08068848)      -85.4         85      -1.82
(-0.01452637, 0.9941406, -0.07385254)      -85.8       85.7     -0.835

if i yaw the pytrack ( Holding it vertically), it's pitch and yaw again

(0.1431885, -1.013672, 0.03063965)       88.3      -81.8       8.04
(0.1501465, -1.015625, 0.03515625)         88      -81.4        8.4   

but if i turn it 90°, yaw decreases and roll increases:


(-0.9949951, -0.1469727, -0.04418945)      -87.5      -8.39      -81.2  
(-0.9726563, -0.09790039, -0.04040527)      -87.6      -5.74      -83.8 

is that a known bug or I do I have to parse the output data or else?

Pysense // LIS2HH12 // no yaw()

File

pycom-libraries/pysense/main.py

calls method yaw() but yaw() does not exist in

pycom-libraries/pysense/lib/LIS2HH12.py

it seems to have been removed by commit f05ce07 but the sample application main.py was not updated.

OSError: I2C bus error

Traceback (most recent call last):
File "main.py", line 31, in
File "/flash/lib/pycoproc.py", line 249, in button_pressed
File "/flash/lib/pycoproc.py", line 151, in peek_memory
File "/flash/lib/pycoproc.py", line 116, in _write
File "/flash/lib/pycoproc.py", line 130, in _wait
OSError: I2C bus error

Pysense accelerometer example (library LIS2HH12): I2C bus error

Import lis2hh12.py into a LoPy drive in directory /flash/lib/

Create a file containing the following code:

from machine import I2C
from lis2hh12 import LIS2HH12
import time

i2c = I2C(0, baudrate=100000, pins=('P9', 'P10'))      # Initialize the I2C bus

acc = LIS2HH12(i2c=i2c)

while True:
    print('----------------------------------')
    print('X, Y, Z:', acc.read())
    print('Roll:', acc.roll())
    print('Pitch:', acc.pitch())
    print('Yaw:', acc.yaw())
    time.sleep(1)

Produces the following error:

Traceback (most recent call last):
    File "<stdin>", line 8, in <module>
    File "/flash/lib/lis2hh12.py", line 37, in __init__
OSError: I2C bus error

Note that the following:

from machine import machine
i2c = I2C(0, I2C.MASTER, baudrate=100000)
i2c.scan()

Returns [].


Could it be my Pysense board that fails for some hardware reasons?

Thanks for your work & help!

calibrate_rtc error after a go_to_sleep ( pytrack )

I have an error after an "go_to_sleep"

Traceback (most recent call last):
File "", line 85, in
File "/flash/lib/pytrack.py", line 134, in setup_sleep
File "/flash/lib/pytrack.py", line 157, in calibrate_rtc
IndexError: list index out of range

AttributeError: 'LoRa' object has no attribute 'mesh'

I am working through the lora mesh network example. I am getting the error AttributeError: 'LoRa' object has no attribute 'mesh' in the loramesh.py on line 36: self.lora.mesh().

When I connect to the fipy via VS Code, I dont not see that function.
lora_functions

I updated the firmware a few days ago and am running the 0.0.8 DFU
py_version

Add license

It seems that there is no obvious license document for this repository and as such it cannot really be used.

Exception: Pysense board not detected

Hello,

I have connected the pycom wipy 2.0 board into pysense board and updated this libraries into it.
Now getting the following errors.
Can you please tell me what could be the problem ?

>>> ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff9028,len:8
load:0x3fff9030,len:932
load:0x4009fa00,len:0
ho 12 tail 0 room 4
load:0x4009fa00,len:13232
entry 0x400a04e8
1
Traceback (most recent call last):
  File "main.py", line 9, in <module>
  File "/flash/lib/pysense.py", line 102, in __init__
Exception: Pysense board not detected
MicroPython v1.8.6-820-g56004e13 on 2017-11-08; WiPy with ESP32
Type "help()" for more information.
>>>
>>>

Connect LoRaWan nano-gateway to a local network server

Hello!

I am using a Pycom expansion board with a lopy4 as a nano-gateway. I was able to connect the gateway with TTN (The Things Network) and send data from a sensor with no problems.
However, I wanted to use a local network server due to some privacy concerns. Therefore, I have installed the following compact server for private LoRaWAN networks: https://github.com/gotthardp/lorawan-server

I have installed this network server on my laptop.
The nano-gateway and my laptop are connected to the same local router.
The question is, what should I put as a server in the config.py file?
The network server I have installed uses port 1680 to listen to incoming packets. So there is no problem with the port number.
I have tried to put the private IP address of my PC as the Server Url, but it didn't work.
I have used Wireshark to track outgoing UDP packets but couldn't find any UDP packet being transferred from my nano-gateway (192.168.4.1) to my laptop (Private IP address of my laptop).

Since I am not an expert in networking I would be very grateful if someone could point out what's wrong with my configuration.

Thank you.

OTA Update - ssl, domain & authentication

I'd like to suggest that the OTA class should connect over a secure socket, and for ease of use be able to use a domain instead of just an IP address.

Oh - also, support for Basic Auth or some kind of authentication as well.
This is pretty important to protect our code.

I'm happy to work on implementing these features.

Sqnsupgrade recovery fails in FiPy

When trying to upgrade the LTE NB-IOT firmware using the recovery mode (fw version: 1.18.r1, lte fw version: NB1-37781) I am getting the following:

>>> import sqnsupgrade
>>> sqnsupgrade.run('/sd/NB1-37781.dup', '/sd/updater.elf', debug=True)
File /sd/updater.elf has size 306076
File /sd/NB1-37781.dup has size 5258127
Modem state: None
Resume: False Retry: False
<<< Welcome to the SQN3330 firmware updater >>>
mirror? False  recover? False  resume? False  direct? False  atneg_only? False bootrom? True 
Initial prepartion complete...
Loading built-in recovery bootrom
Attempting AT wakeup...
b''
count=1
b''
count=2
b''
count=3
b''
count=4
b''
count=5
b''
count=6
b''
count=7
b''
count=8
b''
count=9
b''
count=10
b''
Success1? False
Unable to upgrade bootrom.
Success2? False
Unable to load updater from /sd/updater.elf

I suspect this is also related to Issue #75 (hardware issue).
How should I proceed?

TypeError: object with buffer protocol required in accelerometer_wake example

Hello,
Using 'Pysense' board and getting the below error when I run the accelerometer_wake example.

Traceback (most recent call last):
  File "main.py", line 18, in <module>
  File "/flash/lib/LIS2HH12.py", line 119, in enable_activity_interrupt
TypeError: object with buffer protocol required

https://github.com/pycom/pycom-libraries/blob/master/examples/accelerometer_wake/main.py

Getting this error when encounter the below line of code.
https://github.com/pycom/pycom-libraries/blob/master/pysense/lib/LIS2HH12.py
self.i2c.writeto_mem(ACC_I2CADDR , ACT_THS, _ths)

What could be the problem ?
Can you please help me ?

Data not sent to TTN

I have a LoPy that is connected to the TTN. While monitoring the serial in a terminal I also see it receiving data.
Unfortunately none of this data can be seen in the TTN console.

LoPy is connected in the TTN console

screen shot 2017-11-12 at 15 20 39

Data is being received by the LoPy

screen shot 2017-11-12 at 15 19 35

Need more LoraMesh examples

Loramesh looks perfect for my application and I have bought 4 units to test it out.

We really need an example with a border router in order to make this useful. I personally need an ethernet based border router but any example would help.

I would also appreciate an example with firmware upgrade over loramesh.

MemoryError: memory allocation failed,

Hi guys,

iam using the LoPy board to try out the "Pytrack" sample but i got the following error:

Traceback (most recent call last):
File "main.py", line 35, in
File "/flash/lib/L76GNSS.py", line 55, in coordinates
MemoryError: memory allocation failed, allocating 3751 bytes
MicroPython v1.8.6-796-g489fafa0 on 2017-10-15; LoPy with ESP32
Type "help()" for more information.

os.uname()=
(sysname='LoPy', nodename='LoPy', release='1.9.2.b2', version='v1.8.6-796-g489fafa0 on 2017-10-15', machine='LoPy with ESP32', lorawan='1.0.0')

pytrack_0.0.6.dfu

what i´am doing wrong here?

thx and br,
fabian

Wrong documentation

In the documentation to upgrade the firmware, there's a step called:
os.mkfs(sd)

this formats the sd card and therefore not true.

After not executing this command, it worked!

SQN3330 firmware updater OSError: AT+SMSWBOOT=3,0 failed!

Got the following error updating SQN3330 firmware:

<<< Welcome to the SQN3330 firmware updater >>>
Entering recovery mode
Traceback (most recent call last):
  File "main.py", line 3, in <module>
  File "/flash/lib/sqnsupgrade.py", line 126, in run
OSError: AT+SMSWBOOT=3,0 failed!
MicroPython v1.8.6-849-56d00234 on 2018-05-18; GPy with ESP32

Sqnsupgrade does not work

>>> os.uname()
(sysname='FiPy', nodename='FiPy', release='1.18.1.r1', version='v1.8.6-849-b0520f1 on 2018-08-29', machine='FiPy with ESP32', lorawan='1.0.2', sigfox='1.0.1')
>>> from network import LTE
>>> lte = LTE()
>>> lte.send_at_cmd('ATI')
'\r\nSEQUANS Communications\r\nVZM20Q\r\nUE6.0.0.0\r\n\r\nOK\r\n'
>>> from machine import SD
>>> sd = SD()
>>> os.mount(sd, '/sd')
>>> os.listdir('/sd')
['NB1-38729.dup', 'updater.elf']
>>> import sqnsupgrade
>>> sqnsupgrade.run('/sd/NB1-38729.dup', '/sd/updater.elf')
<<< Welcome to the SQN3330 firmware updater >>>
Attempting AT wakeup...
Starting STP (DO NOT DISCONNECT POWER!!!)
Session opened: version 1, max transfer 8192 bytes
Sending 54854 bytes: [########################################] 100%
Bootrom updated successfully, switching to upgrade mode
Attempting AT auto-negotiation...
ERROR sending AT command... no response? b''
AT auto-negotiation failed! Exiting.
Unable to load updater from /sd/updater.elf
>>> sqnsupgrade.version()

ERROR

>>> sqnsupgrade.version()

SYSTEM VERSION
==============
  FIRMWARE VERSION
    Bootloader0  : 5.1.1.0 [33080]
    Bootloader1  : 5.1.1.0 [36417]
    Bootloader2* : 6.0.0.0 [37781]
    NV Info      : 1.1,0,0
    Software     : 6.0.0.0 [37781] by robot-soft at 2018-07-05 20:21:02
    UE           : 6.0.0.0
  COMPONENTS
    ZSP0         : 1.0.99-319
    ZSP1         : 1.0.99-302
>>>

LoRaWAN Nano Gateway Crashes

Hi,

I implemented the LoRaWan nanogateway. It works but keeps crashing and restarting at intervals with the following error message after what looks like a long hex dump.

`Guru Meditation Error of type LoadProhibited occurred on core 0. Exception was unhandled.
Register dump:
PC : 0x400879fd PS : 0x00060033 A0 : 0x80088f97 A1 : 0x3ffe37a0
A2 : 0x3ffe3800 A3 : 0x3ffe37d0 A4 : 0x00000020 A5 : 0x3ffc48b8
A6 : 0x00001182 A7 : 0x3ffe3da0 A8 : 0x3ff40000 A9 : 0x0000007d
A10 : 0x00000002 A11 : 0x3ffe3bb0 A12 : 0x8008b2f8 A13 : 0x3ffe3ba0
A14 : 0x3ffe3bd0 A15 : 0x00000020 SAR : 0x00000012 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00001186 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0x00000000

Backtrace: 0x400879f▒ets Jun 8 2016 00:22:57`

Any help solving this would be appreciated.

A. Izukanne

LoRaWAN Nanogateway for AS923

Hi,

Is there a working example for interaction with the Things Network using AS923?

I have 2 LoPys with each acting as an OTAA node and a nano gateway node respectively.
I modified the following files as follows,

config.py:

SERVER = 'router.as.thethings.network'
LORA_FREQUENCY = 923200000 
LORA_DR = "SF10BW125" 

nanogateway.py:

RX_PK = {"rxpk": [{"time": "", "tmst": 0,
                   "chan": 2, "rfch": 0,
                   "freq": 923.2, "stat": 1,
                   "modu": "LORA", "datr": "SF10BW125",
                   "codr": "4/5", "rssi": 0,
                   "lsnr": 0, "size": 0,
                   "data": ""}]}

OTAA/main.py:

for channel in range(0, 72):
    lora.remove_channel(channel)

for i in range(0, 16):
    lora.add_channel(i, frequency=923200000, dr_min=0, dr_max=4) #not sure why cannot set DR5

The JOIN_REQUEST & JOIN_ACCEPT messages have been successfully generated. However, my OTAA node is unable to join the network.

image

Please advise, thank you.

nanogateway.py: no attribute 'rx_timestamp' in LoRa mode.

When running the example, I get the following error: AttributeError: 'tuple' object has no attribute 'rx_timestamp'.

In your most recent version of nanogateway.py, you are trying to put stats.rx_timestamp in your data which is not part of lora.stats() tuple when LoRa object is initialized in LORA MODE (line 104).

In current implementation lora.stats() in LORA MODE contains only (timestamp=111270315, rssi=-20, snr=27, sf=7) .

def _lora_cb(self, lora):
        events = lora.events()
        if events & LoRa.RX_PACKET_EVENT:
            self.rxnb += 1
            self.rxok += 1
            rx_data = self.lora_sock.recv(256)
            stats = lora.stats()
            self._push_data(self._make_node_packet(rx_data, self.rtc.now(), stats.rx_timestamp,
stats.sfrx, stats.rssi, stats.snr))
            self.rxfw += 1

Did I miss something or should I simply adjust packets payload based on what's available in lora.stats() tuple?

MQTT Sock Has no Attribute

ERROR OUTPUT:

File "/flash/lib/mqtt.py", line 94 in ping
AttributeError: 'NoneType' object has no attribute 'write'

This error happens everytime a sock object is calls a function like on sock.ping() or on sock.write().

Someone knows how to fix this ?

Best Regards

gateway status is offline on TTN

I was able to connect my nano-gateway to TTN, and it worked like a charm, I was able to send data and I was receiving pull and push Ack. However, now it just refuses to go online, no matter what I do the gateway is always offline on TTN, I cannot send data and I am not receiving any push or pull Ack.
My configuration is 100% correct, and there is nothing wrong with my code. Any idea what seems to be the problem?

NB-IoT - DNS not working

DNS seems not working on NB-IoT, there's no DNS request in the network trace at all, instead the Fipy sends the TCP packets to various IP-Addresses. Thus MQTT over TLS only works, if the IP and not the FQDN of the broker is specified.

lorawan-nano-gateway won't run : function does not take keyword arguments

Just trying to execute main.py :


import config
from nanogateway import NanoGateway

if __name__ == '__main__':
    nanogw = NanoGateway(
        id=config.GATEWAY_ID,
        frequency=config.LORA_FREQUENCY,
        datarate=config.LORA_GW_DR,
        ssid=config.WIFI_SSID,
        password=config.WIFI_PASS,
        server=config.SERVER,
        port=config.PORT,
        ntp_server=config.NTP,
        ntp_period=config.NTP_PERIOD_S
        )

    nanogw.start()
    nanogw._log('You may now press ENTER to enter the REPL')
    input()

I obtain the following result by using lopy4 ( last firmware:1.17.5.b6 ) with Atom and pymakr.

Traceback (most recent call last):
  File "<stdin>", line 17, in <module>
TypeError: function does not take keyword arguments

Any help would be much appreciate.

LoRA OTAA nano gateway example error

I have imported the exact code(OTAA node) given in lorawan nano gateway. But this code gives an ValueError: invalid argument(s) module on this given line. My Lopy module is running latest firmware 1.7.5.b1

lora.add_channel(0, frequency=915000000, dr_min=0, dr_max=5)

Please need help on this. What wrong i have made.

Pysense MPL3115A2 hangs rather quickly and consistently.

This Pysense MPL3115A2 bug has been confirmed independently by two forum users, myself included.

Within a minute or two (it varies) below script hangs without any error message.

Serial communication also breaks down and a power cycle is required to regain communication with the LoPy Pysense combo.

import pycom
import pysense
import machine
from MPL3115A2 import MPL3115A2, PRESSURE
import utime
import sys

class Device:

    def __init__(self):
        self.iteration = 0
        self.sense(self)
        self.timer = machine.Timer.Alarm(self.sense, 3, periodic=True)

    def sense(self, device):
        # barometer mode, not raw, oversampling 128, minimum time 512 ms
        self.p = MPL3115A2(board, mode=PRESSURE).pressure()    # in Pa 
        self.iteration += 1
        print('%f Pa | iteration %d' % (self.p, self.iteration))
        pycom.rgbled(0x002200)
        utime.sleep(0.1)
        pycom.rgbled(0x000000)

pycom.wifi_on_boot(False)
pycom.heartbeat(False)
board = pysense.Pysense()
device = Device()

try:
    while True:
        pass
except KeyboardInterrupt:
    device.timer.cancel()
    sys.exit()

pytrack coordinates() returns unexpected (None, None)

To reproduce the problem you may add a delay to the example provided in main.py:

while (True):
    coord = l76.coordinates(debug=True)
    print("{} - {} - {}".format(coord, rtc .now(), gc.mem_free()))
    time.sleep(5)

This yields the following sequence:

(43.345543, 7.890123) - ...
(43.345543, 7.890123) - ...
(43.345543, 7.890123) - ...
(43.345543, 7.890123) - ...
(43.345543, 7.890123) - ...
GPS timed out after 30.592389 seconds
(None, None) - ...
(43.345543, 7.890123) - ...
(43.345543, 7.890123) - ...
(43.345543, 7.890123) - ...
(43.345543, 7.890123) - ...
(43.345543, 7.890123) - ...
GPS timed out after 31.049092 seconds
(None, None) - ...

After inserting some debugging code in coordinates()

def coordinates(self, debug=True):
        lat_d, lon_d, debug_timeout = None, None, False
        if self.timeout != None:
            self.chrono.start()
        nmea = b''
        while True:
            if debug:
                print('    elapsed time: ', self.chrono.read())
        ....

Console output

    elapsed time:   3.025e-05
    elapsed time:   0.1091974
    elapsed time:   0.2181762
    elapsed time:   0.3271883
    elapsed time:   0.4361712
    elapsed time:   0.5451854
    elapsed time:   0.6541712
    elapsed time:   0.7631838
    elapsed time:   0.8721723
    elapsed time:   0.9781687
(43.345543, 7.890123) - ...
    elapsed time:   5.992357
    elapsed time:   6.102176
    ...

The elapsed time doesn't start from 0 after a successful call to coordinates().
chrono.start() continous from the last chrono.stop() without resetting the timer.
Adding chrono.reset() before chrono.start() sets the time measurement to 0.

   def coordinates(self, debug=False):
       lat_d, lon_d, debug_timeout = None, None, False
       if self.timeout != None:
           self.chrono.reset()
           self.chrono.start()

console output as expected:

(43.345543, 7.890123) - ...
(43.345543, 7.890123) - ...
(43.345543, 7.890123) - ...
(43.345543, 7.890123) - ...
(43.345543, 7.890123) - ...
(43.345543, 7.890123) - ...
(43.345543, 7.890123) - ...
(43.345543, 7.890123) - ...
(43.345543, 7.890123) - ...

otaa_node never joins

Running the current version of otaa_node.py and it never joins. I've checked and double-checked my eui and key. Gateway is in the other room, and another node is joined to it and sending data. How might I diagnose this problem? Is there any way to find out why the join is failing?

Loramesh doesn't honor lora argument

The Loramesh example includes a bug in initializing the LoRa stack.

  if lora is not None:
    self.lora = LoRa(mode=LoRa.LORA, region=LoRa.EU868, bandwidth=LoRa.BW_125KHZ, sf=7)
  else:
    self.lora = lora

This should be:

  if lora is None:
    self.lora = LoRa(mode=LoRa.LORA, region=LoRa.EU868, bandwidth=LoRa.BW_125KHZ, sf=7)
  else:
    self.lora = lora

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.