Code Monkey home page Code Monkey logo

pycom-micropython-sigfox's People

Contributors

amotl avatar caylanlarson avatar doniks avatar dvdgiessen avatar eflorent2020 avatar ftylitak avatar geza-pycom avatar gijsio avatar herrfrei avatar husigeza avatar jirikrepl avatar knagymate avatar martijnthe avatar mate-pycom avatar msariisik avatar ninoita avatar ogauci avatar oligauc avatar peter-pycom avatar psychogenic avatar rcolistete avatar robert-hh avatar salal-m 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

pycom-micropython-sigfox's Issues

Memory leak

LOPY 1.7.9.b3.
if you run the below code, you will see that after many loops it will raise "memory error". To reproduce in fastest way set SLEEP= 0.5. Same result is with gc.enable().

import gc
import utime
from machine import Timer

class Object:

    def __init__(self, count=0):
        print ("Object INIT ", self)
        self._timer = Timer.Alarm(self._timerCallback, 0.5, periodic=False)

    def __del__(self):
        print ("Object DEL ", self)

    def _timerCallback(self, timer):    
        print("Timer finish " ,  self)
        self._timer.cancel()
        del self._timer
        self._timer = None
    
print("Start memory %s" %(gc.mem_free()))
SLEEP = 1.5
gc.disable()
while True:
    obj = Object(100)

    utime.sleep(SLEEP)
    gc.collect()
    print("\t\tmemory %s" %(gc.mem_free()))

Pin P8 is never pulled down if we declare it to

I was using WiPy 2.0

Firmware version
sysname='WiPy', nodename='WiPy', release='1.6.13.b1', version='v1.8.6-607-g9c8a0e9e on 2017-05-01', machine='WiPy with ESP32')

When configuring P8 as input

p_in = Pin('P8', mode=Pin.IN, pull=Pin.PULL_UP) It is high measuring 3.3v

when pulling it down
p_in = Pin('P8', mode=Pin.IN, pull=Pin.PULL_DOWN) it stills measure High 3.3V even i declared it as a pull down.

check pycom forum link

NameError: name 'TimeoutError' is not defined

I'm using the LoPy with firmware 1.7.3.b2.

Some functions like LoRa.join raise a TimeoutError if something fails. Python includes that exception since 3.3.

You define the exception in py/objexcept.c:

MP_DEFINE_EXCEPTION(TimeoutError, OSError)

I can catch the exception raised by the LoRa class:

>>> try:
...     lora.lora.join(activation=LoRa.OTAAauth=lora.authtimeout=1)
... except Exception as ee:
...     foo = ee
...
>>> foo
TimeoutError('timed out',)
>>> foo.__class__
<class 'TimeoutError'>  

...but the class does not exist in the global namespace!

>>> TimeoutError
Traceback (most recent call last):
  File "<stdin>"line 1in <module>
NameErrorname 'TimeoutError' is not defined

Old Issues

Please consider also the open issues from the pycom-micropython branch.
They should not get lost. Most of them are also applicable to this branch.

LoRaWAN downlinks only work in port 1 and 2

Board: LoPy running firmware 1.7.8.b1

Problem:
The LoRaWAN stack on the LoPy only accepts downlinks sent to port 1 and 2. Downlinks sent to other valid ports (3 - 223) don't trigger an RX_PACKET_EVENT and return empty on socket.recv()

This behaviour is confirmed by the source code - there are only case statements for port 1, 2 and 224 (the latter being the LoRaWAN certification port)

Expected result:
Since there isn't currently a way to filter downlinks by port number - socket.bind() on LoRa only changes the uplink ports - I think the LoPy should accept downlinks to all valid application ports 1 to 223 as per the LoRaWAN specification. Silently dropping them is not a good option.

Proposed solution:
I'd be happy to submit a pull request to fix this by simply allowing any valid port, but perhaps a more complex solution including downlink port filtering should be implemented. Such a mechanism has been requested in the forums, but I'm not sure what is the best place to do it.

Acknowledgments:
Thanks to bmarkus for raising the issue of missing downlinks.

Timer.Alarm fires too frequently.

Please include the following information when submitting a bug report:

  • LoPy + PyCom expansion board

  • (sysname='LoPy', nodename='LoPy', release='1.7.3.b1', version='1e46e72-dirty on 2017-06-18', machine='LoPy with ESP32', lorawan='1.0.0') plus some small printf mods below

  • Exact steps to cause this issue

importing this class and running the classes start() method runs a timer every 5 seconds that invokes _sendData()

from network import LoRa
import socket
import binascii
import time
from machine import Timer

class PNode:
    def start(self):
        lora = LoRa(mode=LoRa.LORA,
                    frequency=868100000,
                    bandwidth=LoRa.BW_125KHZ,
                    sf=12,
                    coding_rate=LoRa.CODING_4_8,
                    power_mode=LoRa.ALWAYS_ON, tx_iq=True)

        print("LoRa Initialised")

        self.__s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
        self.__s.setblocking(False)

        self.ping_counter = 1
        self.start_time = time.ticks_ms()
        self.__alarm = Timer.Alarm(self._sendData, 5, periodic=True)

    def _sendData(self, alarm):
        try:
            self.__s.send('Ping {0!s}'.format(self.ping_counter))
        except OSError as err:
            print("OSError {0}, time={1}".format(err,time.ticks_diff(self.start_time, time.ticks_ms())))
        else:
            print('Sent Ping {0!s} at time={1}ms'.format(self.ping_counter,time.ticks_diff(self.start_time, time.ticks_ms())))
            self.ping_counter += 1

Also using a modified version of the sigfox repo modlora.c code below to give some additional information via printf's. No other changes made.

static int32_t lora_send (const byte *buf, uint32_t len, uint32_t timeout_ms) {
    lora_cmd_data_t cmd_data;

    cmd_data.cmd = E_LORA_CMD_TX;
    memcpy (cmd_data.info.tx.data, buf, len);
    cmd_data.info.tx.len = len;

    printf("lora_send timeout is %dms\n",timeout_ms);
    printf("lora_send sending data len=%d\n",cmd_data.info.tx.len);
    printf("lora_send sending data=\"");
    for(int i=0; i<cmd_data.info.tx.len; i++) {
      printf("%c",cmd_data.info.tx.data[i]);
    }
    printf("\"\n");

    if (timeout_ms < 0) {
        // blocking mode
        timeout_ms = portMAX_DELAY;
    }

    xEventGroupClearBits(LoRaEvents, LORA_STATUS_COMPLETED | LORA_STATUS_ERROR | LORA_STATUS_MSG_SIZE);

    // just pass to the LoRa queue
    if (!xQueueSend(xCmdQueue, (void *)&cmd_data, (TickType_t)(timeout_ms / portTICK_PERIOD_MS))) {
        printf("xQueueSend Full\n");
        return 0;
    }

    lora_obj.sftx = lora_obj.sf;

    if (timeout_ms != 0) {
        xEventGroupWaitBits(LoRaEvents,
                            LORA_STATUS_COMPLETED | LORA_STATUS_ERROR | LORA_STATUS_MSG_SIZE,
                            pdTRUE,   // clear on exit
                            pdFALSE,  // do not wait for all bits
                            (TickType_t)portMAX_DELAY);
    }
    // return the number of bytes sent
    printf("lora_send sent %d bytes\n", len);
    return len;
}

Should send an incrementing Ping number every 5 seconds. It works mostly by occasionally gets a number of EAGAIN errors which fire repeatedly and very rapidly until the system becomes stable and starts ping again.

lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 17"
lora_send sent 7 bytes
Sent Ping 17 at time=85003ms
lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 18"
lora_send sent 7 bytes
Sent Ping 18 at time=93031ms

The timer alarm now seems to fire far more often than my 5 seconds requested.

lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 19"
lora_send sent 7 bytes
Sent Ping 19 at time=93042ms
lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 20"
lora_send sent 7 bytes
Sent Ping 20 at time=93054ms
lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 21"
xQueueSend Full                                                      

NOTE:*********************************
Queue seems full? and then the sytem
keeps retrying ~ 20ms without my consent
until fixed - see last entries below
every 

OSError [Errno 11] EAGAIN, time=93066                 
lora_send timeout is 0ms                                         
lora_send sending data len=7
lora_send sending data="Ping 21"
xQueueSend Full
OSError [Errno 11] EAGAIN, time=93079
lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 21"
xQueueSend Full
OSError [Errno 11] EAGAIN, time=93092
lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 21"
xQueueSend Full
OSError [Errno 11] EAGAIN, time=93104
lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 21"
xQueueSend Full
OSError [Errno 11] EAGAIN, time=93117
lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 21"
xQueueSend Full
OSError [Errno 11] EAGAIN, time=93130
lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 21"
xQueueSend Full
OSError [Errno 11] EAGAIN, time=93142
lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 21"
xQueueSend Full
OSError [Errno 11] EAGAIN, time=93155
lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 21"
xQueueSend Full
OSError [Errno 11] EAGAIN, time=93168
lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 21"
xQueueSend Full
OSError [Errno 11] EAGAIN, time=93180
lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 21"
xQueueSend Full
OSError [Errno 11] EAGAIN, time=93193
lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 21"
xQueueSend Full
OSError [Errno 11] EAGAIN, time=93206
lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 21"
xQueueSend Full
OSError [Errno 11] EAGAIN, time=93218
lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 21"
xQueueSend Full
OSError [Errno 11] EAGAIN, time=93231
lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 21"
xQueueSend Full
OSError [Errno 11] EAGAIN, time=93244
lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 21"
xQueueSend Full
OSError [Errno 11] EAGAIN, time=93256
lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 21"
xQueueSend Full
OSError [Errno 11] EAGAIN, time=93269
lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 21"
xQueueSend Full
OSError [Errno 11] EAGAIN, time=93282
lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 21"
xQueueSend Full
OSError [Errno 11] EAGAIN, time=93294
lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 21"
xQueueSend Full
OSError [Errno 11] EAGAIN, time=93307
lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 21"
xQueueSend Full
OSError [Errno 11] EAGAIN, time=93320
lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 21"
xQueueSend Full
OSError [Errno 11] EAGAIN, time=93332
lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 21"
xQueueSend Full
OSError [Errno 11] EAGAIN, time=93345
lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 21"
xQueueSend Full
OSError [Errno 11] EAGAIN, time=93358
lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 21"
xQueueSend Full
OSError [Errno 11] EAGAIN, time=93370
lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 21"
xQueueSend Full
OSError [Errno 11] EAGAIN, time=93383
lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 21"
xQueueSend Full
OSError [Errno 11] EAGAIN, time=93396
lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 21"
xQueueSend Full
OSError [Errno 11] EAGAIN, time=93408
lora_send timeout is 0ms
lora_send sending data len=7
lora_send sending data="Ping 21"
xQueueSend Full
OSError [Errno 11] EAGAIN, time=93421

************ Now it is recovered OK
lora_send timeout is 0ms                                                              
lora_send sending data len=7
lora_send sending data="Ping 21"
lora_send sent 7 bytes
Sent Ping 21 at time=95936ms

Questions:

Why does my timer fire more rapidly than 5 seconds that causes Queue full?
Why is the queue full?
I only issue a single send but the modlora code keeps firing.
Also, why does my try: except: clause keep firing? OSError [Errno 11] EAGAIN, time= messages are emitted by my python except clause.

The issue seems to be worse if I run a wlan.scan() on another timer every 30 seconds.

LoRaWAN Adaptive Data Rate Conflict

(sysname='LoPy', nodename='LoPy', release='1.6.13.b1', version='v1.8.6-593-g8e4ed0fa on 2017-04-12', machine='LoPy with ESP32', lorawan='1.0.0')

When ADR is enabled for the LoRaWAN class, the data rate is still expected to be set in the socket setsockopt() method.

s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)

s.setsockopt(socket.SOL_LORA, socket.SO_CONFIRMED, self.ack)

s.setblocking(True)

s.send(bytes([0x01, 0x02, 0x03]))

Where the LoRaWAN constructor is called as following:

lora = LoRa(mode=LoRa.LORAWAN, frequency=868000000, adr=True)

And the produced error is as follows:

Traceback (most recent call last):                                                                                      
  File "<stdin>", line 124, in <module>                                                                                 
  File "<stdin>", line 83, in transmit                                                                                  
OSError: [Errno 11] EAGAIN  

The ADR should not require the data rate to be set inside of the socket class as the gateway should provide feedback and control over data rate.

Thanks!

BLE scan is deaf for EMBC02 beacons

WiPy 2.0 or LoPy, both running 1.7.9.b3 firmware.

Strange BLE issue: an EMBC02 beacon advertising every second cannot be seen from WiPy (sometimes it catches one advertisement in 30 or 40). EMBC02 can advertise with its proprietary format (the trace below) or as a standard iBeacon/Eddystone; however, WiPy never sees it.

It's the unique type and make of device not seen until now (I have several). Did a scan with my Ubertooth One posting here the trace of one advertisement hoping that some expert sees why the ble stack is deaf for these devices:

systime=1503417955 freq=2402 addr=8e89bed6 delta_t=1008.339 ms rssi=-39
02 25 b4 46 0b ee f3 0c 0f 09 45 4d 42 65 61 63 6f 6e 31 38 30 39 31 00 0e ff 5a 00 bf f8 30 32 29 00 07 d2 e1 c0 01 23 21 3f 
Advertising / AA 8e89bed6 (valid)/ 37 bytes
    Channel Index: 37
    Type:  ADV_NONCONN_IND
    AdvA:  0c:f3:ee:0b:46:b4 (public)
    AdvData: 0f 09 45 4d 42 65 61 63 6f 6e 31 38 30 39 31 00 0e ff 5a 00 bf f8 30 32 29 00 07 d2 e1 c0 01
        Type 09 (Complete Local Name)
           EMBeacon18091.
        Type ff (Manufacturer Specific Data)
           Company: EM Microelectronic-Marin SA
           Data: bf f8 30 32 29 00 07 d2 e1 c0 01

    Data:  b4 46 0b ee f3 0c 0f 09 45 4d 42 65 61 63 6f 6e 31 38 30 39 31 00 0e ff 5a 00 bf f8 30 32 29 00 07 d2 e1 c0 01
    CRC:   23 21 3f

OTA firmware update

I was trying out the over-the-air (OTA) firmware update functionality and after a small tweak was surprised I could actually:

  1. Build a new image
  2. Upload the newly built appimg.bin to /flash/sys/appimg.bin using FTP
  3. New OTA image was picked up and everything worked on reboot!

The only change I made was setting

#define IMG_SIZE (1536 * 1024)

in pycom-micropython-sigfox/esp32/bootloader/bootloader.h

(the 1536K is the actual size of the image, the old value 1024 overwrote the running code on SPI and cause very bad results)

I understand the size of the images and maybe the bootloader may not be fixed in stone yet but maybe this could work within minor versions?

reset board is not equal to power remove SD card cannot be inited

wipy2.0
firmware version 1.7.2.b1
please wire all required wires for SD card slot
but do not insert SD card

put files
file sd.py

from machine import SD
import os
print('sd_init')
sd = SD()
print(sd)
os.mount(sd, '/sd')
print('sd mounted')
print(os.listdir('/sd'))

in main.py

execfile('/flash/sd.py')

and now - remove power and plug again
you got OSError - it is ok

but now - insert SD card and press reset
you still got OSError

remove power completly and plug again - it work
reset is not physical like power removing it miss something

usocket.connect() to down server ignores timeout and no exception thrown

WiPy 2.0
v1.8.6-650-g9bacbbd4 on 2017-06-09'

When I attempt to make a socket connection to a machine that is down the timeout value is completely ignored and connect() doesn't throw an exception.

Example code:

import time
import socket
def test1():
start = time.time()
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_TCP)
s.settimeout(3)
s.connect(('192.168.1.120', 15000))
finish = time.time()
print(finish - start)
s.close()

This takes 18-19 seconds and throws no exception.

LoRaWAN AddChannel Bug

(sysname='LoPy', nodename='LoPy', release='1.7.9.b3', version='v1.8.6-747-gc4ec6110 on 2017-08-09', machine='LoPy with ESP32', lorawan='1.0.0')

I tried to Add the FSK Channel from LoRaWAN 868 MHz (DR = 7) with the following command:

lora.add_channel(8, frequency=868800000, dr_min=7, dr_max=7)

An then i get the Error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: invalid argument(s) value

I think the Error is in:

esp32/mods/modlora.c :
lora_validate_data_rate()

It aborts, when the datarate is greater than DR_6 and that is wrong, because in 868 MHz band it can go to DR_7.

Set iBeacon Advertising Power and Frequency For LoPy

Hi,

I've managed to setup the advertisement as such now it functions as an iBeacon. However, I can't find anywhere in the documentation for a way to set the advertising frequency and the actual transmitting power. By Tx Power I do not mean the RSSI which is at the end of the manufacture data.
So I'm wondering if these can be set in some way.

Thanks,

QJ

pyTrack (+Lopy) bricked?

Please include the following information when submitting a bug report:

(Dev env on a ubuntu 16.04 machine.
Using atom with pymakr plugin (latest available))

pyTrack with LoPy (Using it for a PoC that needs all power savings patches available...)
(have 2 Lopy 1 pytrack and 1 pyExpboard)

Updated both LoPy to 1.7.9.b3
Updated pyTrack to 0.0.4 (using pytrack_0.0.4.dfu)
All updates worked fine.

Both LoPY on pyExpBoard works (=connects to REPL in atom/pymaker) over serial (/dev/ttyUSB3) and on wifi.

But on pyTrack ....

Before shield update it turn up as /dev/ttyACM0 as expected (although I could for some reason not use
that port (could be my env somehow) it complained about rst/dtr settings in dmesg..)
wifi worked though which was enough for our purposes. (but really needed to get the new patches in to
save power and some improvements on the LoRa layer (Counters - NVRAM helped.)

To issue started when I updated the sheild to 0.0.4.
Then it will not come up as a serial device anymore...
in dmesg:
[158447.985265] usb 2-2: new full-speed USB device number 119 using xhci_hcd
[158448.113748] usb 2-2: New USB device found, idVendor=04d8, idProduct=f014
[158448.113751] usb 2-2: New USB device strings: Mfr=0, Product=0, SerialNumber=0

usb-devices:
T: Bus=02 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#= 76 Spd=12 MxCh= 0
D: Ver= 1.00 Cls=fe(app. ) Sub=01 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=04d8 ProdID=f014 Rev=00.03
C: #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
I: If#= 0 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=00 Driver=(none)

No driver is found. (PIC16LF1459 say it should be ttyACMx)

  • strange it register itself as a xhci ..

WiFi is dead (comes to life if move to the pyExpboard)

and obviously installed program do not run....

so can't access it nor is anything starting ... bricked?

Is there any way of reverting the update via dfu-util of the pytrack shield?
(or is there a other pytrack_0.0.X that works?)

Any ideas what went wrong?

/ME

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?

LoPy stops detecting BLE advertisements

LoPy
Firmware release 1.6.13.b1

My analysis is also described here: https://forum.pycom.io/topic/1255/lopy-stops-detecting-ble-advertisements

What I wanted to test out was how well LoPy receives BLE advertisements as a preparation for a real use case with iBeacons on vehicles. As the LoPy would be USB-powered I use start_scan(-1). I might be able to check only occasionally later on, but for now I assume the LoPy needs to be always scanning.

I noticed that get_adv sees only some of the advertisements, and it comes and goes. For a few seconds it can detect all, then for several seconds it hardly detects any. I've secured that the advertisement buffer never gets full. The beacons used for testing were very close by (like 10 cm away).

Another related problem is that after a varying time it stops detecting advertisements altogether, and I need to reboot for it to start again. In that state get_adv simply returns nothing.

This seems related: espressif/esp-idf#421

Cheers,
Anders

Size of large files is displayed wrong

All versions:
for files larger than 2 GB the file size is displayed as negative number, resulting from a int <-> uint mismatch in the code for uos.stat(). This can be fixed by changing line 436 of mods/moduos.c into:

    t->items[6] = mp_obj_new_int_from_uint(fno.fsize); // st_size

Nothing tragic.

ticks_diff() argument order reversed?

I use both pyboard and xxPy, running both micropython. I used some code cross-boards as far as possible, and I ran into a minor annoyance for a function in utime called ticks_diff() that really doesn't have to be different at all.

The micropython of Pycom reverses the order of the arguments, whereas the implementation on the original micropython platform uses the IMHO right way to do this. Just to illustrate:

micropython's way

# Wait for GPIO pin to be asserted, but at most 500us
start = time.ticks_us()
while pin.value() == 0:
    if time.ticks_diff(time.ticks_us(), start) > 500:
        raise TimeoutError

Pycom's micropython way

# Wait for GPIO pin to be asserted, but at most 500us
start = time.ticks_us()
while pin.value() == 0:
    if time.ticks_diff(start, time.ticks_us()) > 500:
        raise TimeoutError

RTC ntp time server not working using DNS on static ip

When using a static IP address (instead of DHCP), the ntp_sync() doesn't work when using the FQDN 'pool.ntp.org' although it does work when DHCP is used or when an IP-address is used.

>>> import os
>>> os.uname()
(sysname='LoPy', nodename='LoPy', release='1.6.13.b1', version='v1.8.6-607-g9c8a0e9e on 2017-05-01', machine='LoPy with ESP32', lorawan='1.0.0')
>>> wlan.ifconfig()
('192.168.0.191', '255.255.255.0', '192.168.0.1', '213.46.228.196')
>>> import machine
>>> rtc = machine.RTC()
>>> rtc.ntp_sync('pool.ntp.org', 3600)
>>> rtc.now()
(1970, 1, 1, 0, 2, 21, 96633, None)
>>> rtc.ntp_sync('128.199.44.119', 3600)
>>> rtc.now()
(2017, 5, 16, 6, 3, 44, 126771, None)

Also (I am adding it here in this issue because it might be caused by the same problem), socket.getaddrinfo() often returns '0.0.0.0' while using a static IP-address:

>>> wlan.ifconfig() ('192.168.0.191', '255.255.255.0', '192.168.0.1', '213.46.228.196')
>>> socket.getaddrinfo('pool.ntp.org', 80)
[(2, 1, 0, '', ('0.0.0.0', 80))]
>>> socket.getaddrinfo('pool.ntp.org', 80)
[(2, 1, 0, '', ('122.175.14.128', 80))]
>>> socket.getaddrinfo('pool.ntp.org', 80)
[(2, 1, 0, '', ('16.88.252.63', 80))]
>>> socket.getaddrinfo('pool.ntp.org', 80)
[(2, 1, 0, '', ('0.0.0.0', 80))]
>>> socket.getaddrinfo('pool.ntp.org', 80)
[(2, 1, 0, '', ('0.0.0.0', 80))]
>>> socket.getaddrinfo('pool.ntp.org', 80)
[(2, 1, 0, '', ('0.0.0.0', 80))]
>>> socket.getaddrinfo('pool.ntp.org', 80)
[(2, 1, 0, '', ('80.87.252.63', 80))]

Pycom Firmware Update not working

Using LoPY1.0r with Expansion board. Trying to use Pycom Firmware Update.app version 1.1.1.b1 running on a MacBook Pro with macOS Sierra version 10.12.4.

Getting message:

The upgrade failed, please check the connections and try the steps again.

This is the log of the upgrading process

Connecting...........................................

Failure!

I've checked and rechecked. A colleague has tested the board with a PC and everything seemed
OK, but it won't work on my Mac.

Enhancement: Bluetooth should have a timeout function for connect

https://docs.pycom.io/chapter/firmwareapi/pycom/network/bluetooth/

bluetooth.connect(mac_addr)
Opens a BLE connection with the device specified by the mac_addr argument. This function blocks until the connection succeeds or fails. If the connections succeeds it returns a object of type GATTCConnection.
bluetooth.connect('112233eeddff') # mac address is accepted as a string

I have tried putting in a dummy MAC address and it takes 30 seconds to timeout.

I think it will be great if we can set our own timeout.
e.g. bluetooth.connect('MAC',timeout)

CLI build instructions incorrect

Per the README.me in the esp32/ directory:

In order to build this project, a copy of the Espressif IDF is required and it's
path must be specified via the ESP_IDF_PATH variable. See the Makefile for details.

It should be IDF_PATH instead of ESP_IDF_PATH, since Makefile copies IDF_PATH to ESP_IDF_PATH, but application.mk only uses IDF_PATH; this causes the call to esptool.py to fail because the path is wrong.

Also, this line:

make BOARD=LOPY -j5 TARGET=boot

should read

make BOARD=LOPY -j5 LORA_BAND=USE_BAND_868 TARGET=boot

And I'd recommend some text about selecting the correct band for your region.

I can submit a PR, if desired.

MIT license violations

There are some files in this repository which are substantial copies of MIT licensed code from the upstream MicroPython repo and they violate the MIT license because the copyright header is not retained. The MIT license has only one single requirement, namely: "The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software."

Please fix this.

The following files at least need fixing:

boards/make-pins.py
mpconfigport.h
mods/machpin.c
mods/machspi.c
mods/modmachine.c
mods/modnetwork.h
mods/modnetwork.c
mods/moduos.c
mods/moduselect.c
mods/modusocket.c
mods/modutime.c

LoRa.nvram_save() doesn't save parameters necessary for ADR

I have observed this with a LoPy running 1.8.0b1.

For ADR to perform correctly with deep sleep, the AdrAckCounter value must be saved in order for the device to decrease its data rates.

Similarly some information about the channel mask (among other things) and other setup parameters, transferred in the LinkAdrReq etc MAC commands must be persisted for the lifetime of the device session or the device will behave incorrectly. Channel frequency setups for non-US bands are a separate problem. RX1/RX2 timing windows and frequencies should also be persisted.

It looks like persisting LoRaMacParams and AdrAckCounter within LoRaMacNvsSave and adding some MIB_... enums to handle them should be sufficient. LoRaMacParams doesn't appear to contain any pointers so it should be straightforward.

Heartbeat doesn't work while code is running

Platform: (sysname='LoPy', nodename='LoPy', release='1.6.13.b1', version='v1.8.6-607-g9c8a0e9e on 2017-05-01', machine='LoPy with ESP32', lorawan='1.0.0')

Expected behaviour, quoted from documentation:

By default the heartbeat LED flashes in blue color once every 4s to signal that the system is alive.

Observed behaviour:
The heartbeat only flashes when there's no code running!

Steps to reproduce:

  1. os.mkfs('/flash'), to make sure we're in a completely clean state.
  2. Reset the board.
  3. Observe that heartbeat LED flashes every 4 seconds.
  4. Run from the REPL:
    while True:
        pass
  5. Observe that heartbeat LED doesn't flash anymore.

Alternative ways to reproduce:
Different main.py files using busy loops, machine idle loops, time sleep loops:

if __name__ == '__main__':
    while True:
        pass
import machine
if __name__ == '__main__':
    while True:
        machine.idle()
import utime
if __name__ == '__main__':
    while True:
        utime.sleep_ms(10)

main.py file having running code in a separate thread:

import _thread
def foo():
    while True:
        pass
if __name__ == '__main__':
    _thread.start_new_thread(foo, ())

See also the forum thread at the Pycom forums.

Memory leak using Pin (callback)

Hello,

LOPY 1.7.9.b3.

If you run this piece of code you will see that memory is decreasing ... in the end it stops with 'MemoryError: memory allocation failed' . Comparing to previous timer memory leak issue, I believe there is ALWAYS a LEAK when you are using function callbacks.

import gc
import utime
from machine import Pin


class Object:
    
    def __init__(self): 
        print ("Object INIT ", self)
        

    def start(self):    
        
        def _call(arg):
            print('PIN changed')
        
        self._analogPin=Pin('P15',mode=Pin.IN,pull=Pin.PULL_UP)    
        self._analogPin.callback(Pin.IRQ_FALLING , _call)
         
        
    def __del__(self):
        print ("Object DEL ", self)

    
    def stop(self):    
        self._analogPin.callback(Pin.IRQ_FALLING , None)
        del self._analogPin
        self._analogPin = None
        

print("Start memory %s" %(gc.mem_free()))

SLEEP = 0.1

gc.enable()
while True:
    obj = Object()
    obj.start()
    utime.sleep(SLEEP)
    obj.stop()
    del obj 
    obj = None
    
    gc.collect()
    print("\t\tmemory %s" %(gc.mem_free()))

BLE notifications don't seem to be working on the LoPy

BLE notifications don't seem to be working on the LoPy, when the LoPy is running as a BLE server (firmware version: 1.7.6.b1). Subscribing to notifications for a characteristic being advertised by a LoPy does not seem to trigger any notifications.

Sample code:

from network import Bluetooth
import pycom
import time

print('Advertising Bluetooth...')
bluetooth = Bluetooth()
bluetooth.set_advertisement(name='LoPy', service_uuid=b'1234567890abcdef')

def conn_cb (bt_o):
    events = bt_o.events()
    if  events & Bluetooth.CLIENT_CONNECTED:
        print("Client connected")
    elif events & Bluetooth.CLIENT_DISCONNECTED:
        print("Client disconnected")

bluetooth.callback(trigger=Bluetooth.CLIENT_CONNECTED | Bluetooth.CLIENT_DISCONNECTED, handler=conn_cb)
bluetooth.advertise(True)

#Create service and characteristic
srv1 = bluetooth.service(uuid='0000000000000000', isprimary=True)
chr1 = srv1.characteristic(uuid='0000000000000002', properties=Bluetooth.PROP_INDICATE | Bluetooth.PROP_BROADCAST | Bluetooth.PROP_READ | Bluetooth.PROP_NOTIFY, value='InitialValue')

#Create callback for read events on the characteristic
def char1_cb(chr):
    events = chr.events()
    if events & Bluetooth.CHAR_READ_EVENT :
        print('Bluetooth.CHAR_READ_EVENT')

chr1.callback(trigger=Bluetooth.CHAR_READ_EVENT, handler=char1_cb)

#Update the characteristic value very few seconds
i=0
while True:
    val = 'Value{}'.format(i)
    print('Setting value: {}'.format(val))
    chr1.value(val) #Set the characteristic value - should trigger notification is a client has registered for notifications
    time.sleep(3)
    i+=1

Steps to reproduce:

  1. The above code running on a LoPy advertises a BLE service and characteristic with Read, Indicate & Notify properties. The LoPy is acting as the Bluetooth server / peripheral in this case. The value of the characteristic will be changed every few seconds.
  2. Connect to the Lopy using a BLE app on a smartphone (e.g. BLE Scanner for Android or LightBlue Explorer for iOS).
  3. Test that manually triggering a read value works - it should
  4. Press the button on the app to subscribe to notifications. Expected: Every update in value on the LoPy should be notified to the app. Actual: No value updates are notified to the app. Only manually triggered reads seem to work.

Is this a known issue or am I missing something?
Thanks!

Fault in unix version

   MicroPython ccb10e3 on 2017-08-25; linux version
   Use Ctrl-D to exit, Ctrl-E for paste mode
   >>> print('Hello World')
   Segmentation fault (core dumped)
  • make test:
    Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
    cd ../tests && MICROPY_MICROPYTHON=../unix/micropython ./run-tests
    FAIL basics/0prelim.py
    pass basics/andor.py
    FAIL basics/array1.py
    FAIL basics/array_add.py
    FAIL basics/array_construct.py
    FAIL basics/array_construct2.py
    skip basics/array_construct_endian.py
    FAIL basics/array_q.py
    FAIL basics/assign1.py
    FAIL basics/async_await.py
    FAIL basics/async_await2.py
    FAIL basics/async_def.py
    FAIL basics/async_for.py
    FAIL basics/async_for2.py
    FAIL basics/async_with.py
    FAIL basics/async_with2.py
    FAIL basics/attrtuple1.py
    FAIL basics/bool1.py
    FAIL basics/boundmeth1.py
    FAIL basics/break.py
    FAIL basics/builtin_abs.py
    FAIL basics/builtin_allany.py
    FAIL basics/builtin_bin.py
    FAIL basics/builtin_callable.py
    FAIL basics/builtin_chr.py
    FAIL basics/builtin_compile.py
    FAIL basics/builtin_delattr.py
    FAIL basics/builtin_dir.py
    FAIL basics/builtin_divmod.py
    pass basics/builtin_ellipsis.py
    FAIL basics/builtin_eval.py
    FAIL basics/builtin_eval_error.py
    FAIL basics/builtin_hash.py
    FAIL basics/builtin_hex.py
    FAIL basics/builtin_id.py
    FAIL basics/builtin_issubclass.py
    FAIL basics/builtin_len1.py
    FAIL basics/builtin_minmax.py
    FAIL basics/builtin_oct.py
    FAIL basics/builtin_ord.py
    FAIL basics/builtin_override.py
    FAIL basics/builtin_pow.py
    FAIL basics/builtin_property.py
    FAIL basics/builtin_range.py
    FAIL basics/builtin_reversed.py
    FAIL basics/builtin_round.py
    FAIL basics/builtin_slice.py
    FAIL basics/builtin_sorted.py
    FAIL basics/builtin_sum.py
    FAIL basics/builtin_type.py
    FAIL basics/bytearray1.py
    FAIL basics/bytearray_add.py
    FAIL basics/bytearray_append.py
    FAIL basics/bytearray_construct.py
    skip basics/bytearray_construct_endian.py
    FAIL basics/bytearray_longint.py
    FAIL basics/bytearray_slice_assign.py
    FAIL basics/bytes.py
    FAIL basics/bytes_add.py
    skip basics/bytes_add_endian.py
    pass basics/bytes_compare.py
    FAIL basics/bytes_compare2.py
    FAIL basics/bytes_compare3.py
    FAIL basics/bytes_construct.py
    skip basics/bytes_construct_endian.py
    FAIL basics/bytes_count.py
    FAIL basics/bytes_find.py
    FAIL basics/bytes_format_modulo.py
    FAIL basics/bytes_gen.py
    FAIL basics/bytes_large.py
    FAIL basics/bytes_mult.py
    FAIL basics/bytes_partition.py
    FAIL basics/bytes_replace.py
    FAIL basics/bytes_split.py
    FAIL basics/bytes_strip.py
    FAIL basics/bytes_subscr.py
    FAIL basics/class1.py
    FAIL basics/class2.py
    FAIL basics/class3.py
    FAIL basics/class_bind_self.py
    FAIL basics/class_binop.py
    FAIL basics/class_call.py
    FAIL basics/class_contains.py
    FAIL basics/class_descriptor.py
    FAIL basics/class_emptybases.py
    FAIL basics/class_getattr.py
    FAIL basics/class_inherit1.py
    FAIL basics/class_inherit_mul.py
    FAIL basics/class_instance_override.py
    FAIL basics/class_item.py
    FAIL basics/class_new.py
    FAIL basics/class_number.py
    FAIL basics/class_staticclassmethod.py
    FAIL basics/class_store.py
    FAIL basics/class_store_class.py
    FAIL basics/class_str.py
    FAIL basics/class_super.py
    FAIL basics/class_super_object.py
    FAIL basics/class_use_other.py
    FAIL basics/closure1.py
    FAIL basics/closure2.py
    FAIL basics/closure_defargs.py
    FAIL basics/closure_manyvars.py
    FAIL basics/closure_namedarg.py
    FAIL basics/compare_multi.py
    FAIL basics/comprehension1.py
    FAIL basics/containment.py
    FAIL basics/continue.py
    FAIL basics/decorator.py
    FAIL basics/del_attr.py
    FAIL basics/del_deref.py
    FAIL basics/del_global.py
    FAIL basics/del_local.py
    FAIL basics/del_name.py
    FAIL basics/del_subscr.py
    pass basics/dict1.py
    FAIL basics/dict2.py
    FAIL basics/dict_clear.py
    FAIL basics/dict_construct.py
    FAIL basics/dict_copy.py
    FAIL basics/dict_del.py
    FAIL basics/dict_from_iter.py
    FAIL basics/dict_fromkeys.py
    FAIL basics/dict_get.py
    FAIL basics/dict_intern.py
    FAIL basics/dict_iterator.py
    FAIL basics/dict_pop.py
    FAIL basics/dict_popitem.py
    FAIL basics/dict_setdefault.py
    FAIL basics/dict_specialmeth.py
    FAIL basics/dict_update.py
    FAIL basics/dict_views.py
    FAIL basics/enumerate.py
    FAIL basics/equal.py
    FAIL basics/equal_class.py
    FAIL basics/errno1.py
    FAIL basics/except_match_tuple.py
    FAIL basics/exception1.py
    FAIL basics/exception_chain.py
    FAIL basics/exceptpoly.py
    FAIL basics/exceptpoly2.py
    FAIL basics/exec1.py
    FAIL basics/filter.py
    FAIL basics/floordivide.py
    FAIL basics/for1.py
    FAIL basics/for2.py
    FAIL basics/for3.py
    FAIL basics/for_break.py
    FAIL basics/for_range.py
    FAIL basics/for_return.py
    FAIL basics/frozenset1.py
    FAIL basics/frozenset_add.py
    pass basics/frozenset_binop.py
    FAIL basics/frozenset_copy.py
    pass basics/frozenset_difference.py
    FAIL basics/frozenset_set.py
    FAIL basics/fun1.py
    FAIL basics/fun2.py
    FAIL basics/fun3.py
    FAIL basics/fun_annotations.py
    FAIL basics/fun_calldblstar.py
    FAIL basics/fun_calldblstar2.py
    FAIL basics/fun_calldblstar3.py
    FAIL basics/fun_callstar.py
    FAIL basics/fun_callstardblstar.py
    FAIL basics/fun_defargs.py
    FAIL basics/fun_defargs2.py
    FAIL basics/fun_error.py
    FAIL basics/fun_kwargs.py
    FAIL basics/fun_kwonly.py
    pass basics/fun_kwonlydef.py
    FAIL basics/fun_kwvarargs.py
    FAIL basics/fun_largestate.py
    FAIL basics/fun_name.py
    FAIL basics/fun_str.py
    FAIL basics/fun_varargs.py
    FAIL basics/gc1.py
    FAIL basics/gen_yield_from.py
    FAIL basics/gen_yield_from_close.py
    FAIL basics/gen_yield_from_ducktype.py
    FAIL basics/gen_yield_from_exc.py
    FAIL basics/gen_yield_from_iter.py
    FAIL basics/gen_yield_from_send.py
    FAIL basics/gen_yield_from_stopped.py
    FAIL basics/gen_yield_from_throw.py
    FAIL basics/generator1.py
    FAIL basics/generator2.py
    FAIL basics/generator_args.py
    FAIL basics/generator_close.py
    FAIL basics/generator_closure.py
    FAIL basics/generator_exc.py
    pass basics/generator_return.py
    FAIL basics/generator_send.py
    FAIL basics/getattr.py
    FAIL basics/getattr1.py
    FAIL basics/getitem.py
    FAIL basics/globals_del.py
    FAIL basics/hasattr1.py
    FAIL basics/ifcond.py
    FAIL basics/int1.py
    FAIL basics/int2.py
    FAIL basics/int_big_and.py
    pass basics/int_big_and2.py
    FAIL basics/int_big_and3.py
    FAIL basics/int_big_cmp.py
    FAIL basics/int_big_div.py
    FAIL basics/int_big_error.py
    FAIL basics/int_big_lshift.py
    FAIL basics/int_big_mod.py
    FAIL basics/int_big_mul.py
    FAIL basics/int_big_or.py
    FAIL basics/int_big_or2.py
    FAIL basics/int_big_or3.py
    FAIL basics/int_big_pow.py
    FAIL basics/int_big_rshift.py
    FAIL basics/int_big_unary.py
    FAIL basics/int_big_xor.py
    FAIL basics/int_big_xor2.py
    FAIL basics/int_big_xor3.py
    FAIL basics/int_big_zeroone.py
    FAIL basics/int_bytes.py
    FAIL basics/int_constfolding.py
    FAIL basics/int_divmod.py
    FAIL basics/int_divzero.py
    FAIL basics/int_long.py
    FAIL basics/int_mpz.py
    FAIL basics/int_small.py
    FAIL basics/is_isnot.py
    FAIL basics/iter0.py
    FAIL basics/iter1.py
    FAIL basics/iter2.py
    FAIL basics/iter_of_iter.py
    FAIL basics/lambda1.py
    FAIL basics/lambda_defargs.py
    FAIL basics/lexer.py
    FAIL basics/list1.py
    FAIL basics/list_clear.py
    FAIL basics/list_compare.py
    FAIL basics/list_copy.py
    FAIL basics/list_count.py
    FAIL basics/list_extend.py
    FAIL basics/list_index.py
    FAIL basics/list_insert.py
    FAIL basics/list_mult.py
    FAIL basics/list_pop.py
    FAIL basics/list_remove.py
    FAIL basics/list_reverse.py
    FAIL basics/list_slice.py
    FAIL basics/list_slice_3arg.py
    FAIL basics/list_slice_assign.py
    FAIL basics/list_slice_assign_grow.py
    FAIL basics/list_sort.py
    FAIL basics/list_sum.py
    FAIL basics/map.py
    FAIL basics/memoryerror.py
    FAIL basics/memoryview1.py
    FAIL basics/memoryview2.py
    FAIL basics/memoryview_gc.py
    FAIL basics/module1.py
    FAIL basics/module2.py
    FAIL basics/namedtuple1.py
    FAIL basics/object1.py
    FAIL basics/object_dict.py
    FAIL basics/object_new.py
    FAIL basics/op_error.py
    pass basics/ordereddict1.py
    pass basics/ordereddict_eq.py
    FAIL basics/parser.py
    FAIL basics/print.py
    FAIL basics/python34.py
    FAIL basics/return1.py
    FAIL basics/scope.py
    pass basics/self_type_check.py
    FAIL basics/seq_unpack.py
    FAIL basics/set1.py
    FAIL basics/set_add.py
    pass basics/set_binop.py
    FAIL basics/set_clear.py
    FAIL basics/set_copy.py
    FAIL basics/set_difference.py
    FAIL basics/set_discard.py
    FAIL basics/set_intersection.py
    FAIL basics/set_isdisjoint.py
    FAIL basics/set_isfooset.py
    FAIL basics/set_iter.py
    FAIL basics/set_pop.py
    pass basics/set_remove.py
    FAIL basics/set_specialmeth.py
    FAIL basics/set_symmetric_difference.py
    FAIL basics/set_union.py
    FAIL basics/set_unop.py
    FAIL basics/set_update.py
    FAIL basics/setattr1.py
    FAIL basics/slice_attrs.py
    FAIL basics/slice_bignum.py
    FAIL basics/slots_bool_len.py
    FAIL basics/special_methods.py
    FAIL basics/string1.py
    FAIL basics/string_center.py
    FAIL basics/string_compare.py
    FAIL basics/string_count.py
    FAIL basics/string_cr_conversion.py
    FAIL basics/string_crlf_conversion.py
    FAIL basics/string_endswith.py
    FAIL basics/string_escape.py
    FAIL basics/string_find.py
    FAIL basics/string_format.py
    Traceback (most recent call last):
    File "basics/string_format2.py", line 58, in
    File "basics/string_format2.py", line 27, in test_fmt
    NameError: name 'test' is not defined
    FAIL basics/string_format2.py
    FAIL basics/string_format_error.py
    FAIL basics/string_format_modulo.py
    FAIL basics/string_index.py
    pass basics/string_istest.py
    FAIL basics/string_join.py
    FAIL basics/string_large.py
    FAIL basics/string_mult.py
    FAIL basics/string_partition.py
    FAIL basics/string_replace.py
    FAIL basics/string_repr.py
    FAIL basics/string_rfind.py
    FAIL basics/string_rindex.py
    FAIL basics/string_rpartition.py
    FAIL basics/string_rsplit.py
    FAIL basics/string_slice.py
    FAIL basics/string_split.py
    FAIL basics/string_splitlines.py
    FAIL basics/string_startswith.py
    FAIL basics/string_strip.py
    pass basics/string_upperlow.py
    FAIL basics/struct1.py
    FAIL basics/struct2.py
    FAIL basics/subclass_classmethod.py
    FAIL basics/subclass_native1.py
    FAIL basics/subclass_native2_list.py
    FAIL basics/subclass_native2_tuple.py
    FAIL basics/subclass_native3.py
    FAIL basics/subclass_native4.py
    FAIL basics/subclass_native5.py
    FAIL basics/subclass_native_buffer.py
    FAIL basics/subclass_native_cmp.py
    FAIL basics/subclass_native_specmeth.py
    FAIL basics/syntaxerror.py
    pass basics/sys1.py
    pass basics/true_value.py
    FAIL basics/try1.py
    FAIL basics/try2.py
    FAIL basics/try3.py
    FAIL basics/try4.py
    pass basics/try_as_var.py
    FAIL basics/try_continue.py
    pass basics/try_error.py
    pass basics/try_finally1.py
    FAIL basics/try_finally2.py
    pass basics/try_finally_loops.py
    FAIL basics/try_finally_return.py
    FAIL basics/try_finally_return2.py
    pass basics/try_reraise.py
    pass basics/try_reraise2.py
    FAIL basics/tuple1.py
    FAIL basics/tuple_compare.py
    FAIL basics/tuple_count.py
    FAIL basics/tuple_index.py
    FAIL basics/tuple_mult.py
    FAIL basics/types1.py
    FAIL basics/types2.py
    FAIL basics/unary_op.py
    FAIL basics/unboundlocal.py
    FAIL basics/unpack1.py
    FAIL basics/while1.py
    FAIL basics/while_cond.py
    FAIL basics/while_nest_exc.py
    FAIL basics/with1.py
    FAIL basics/with_break.py
    FAIL basics/with_continue.py
    FAIL basics/with_return.py
    FAIL basics/zip.py
    FAIL cmdline/cmd_optimise.py
    FAIL cmdline/cmd_showbc.py
    FAIL cmdline/cmd_verbose.py
    FAIL cmdline/repl_basic.py
    FAIL cmdline/repl_cont.py
    skip cmdline/repl_emacs_keys.py
    FAIL extmod/btree1.py
    FAIL extmod/framebuf1.py
    pass extmod/machine1.py
    FAIL extmod/machine_pinbase.py
    FAIL extmod/machine_pulse.py
    FAIL extmod/ticks_diff.py
    FAIL extmod/time_ms_us.py
    FAIL extmod/ubinascii_a2b_base64.py
    FAIL extmod/ubinascii_b2a_base64.py
    pass extmod/ubinascii_crc32.py
    FAIL extmod/ubinascii_hexlify.py
    FAIL extmod/ubinascii_unhexlify.py
    FAIL extmod/uctypes_array_assign_le.py
    FAIL extmod/uctypes_array_assign_native_le.py
    FAIL extmod/uctypes_bytearray.py
    FAIL extmod/uctypes_le.py
    FAIL extmod/uctypes_le_float.py
    FAIL extmod/uctypes_native_float.py
    FAIL extmod/uctypes_native_le.py
    FAIL extmod/uctypes_ptr_le.py
    FAIL extmod/uctypes_ptr_native_le.py
    FAIL extmod/uctypes_sizeof.py
    FAIL extmod/uctypes_sizeof_native.py
    pass extmod/uhashlib_sha1.py
    pass extmod/uhashlib_sha256.py
    Traceback (most recent call last):
    File "extmod/uheapq1.py", line 27, in
    File "extmod/uheapq1.py", line 19, in pop_and_print
    NameError: name 'heapq' is not defined
    FAIL extmod/uheapq1.py
    FAIL extmod/ujson_dumps.py
    FAIL extmod/ujson_dumps_extra.py
    FAIL extmod/ujson_dumps_float.py
    FAIL extmod/ujson_load.py
    FAIL extmod/ujson_loads.py
    FAIL extmod/ujson_loads_float.py
    FAIL extmod/urandom_basic.py
    FAIL extmod/urandom_extra.py
    FAIL extmod/ure1.py
    FAIL extmod/ure_error.py
    FAIL extmod/ure_group.py
    FAIL extmod/ure_namedclass.py
    FAIL extmod/ure_split.py
    FAIL extmod/ure_split_empty.py
    pass extmod/uzlib_decompio.py
    pass extmod/uzlib_decompio_gz.py
    FAIL extmod/uzlib_decompress.py
    skip extmod/vfs_fat_fileio.py
    skip extmod/vfs_fat_fsusermount.py
    skip extmod/vfs_fat_oldproto.py
    skip extmod/vfs_fat_ramdisk.py
    FAIL float/array_construct.py
    FAIL float/builtin_float_minmax.py
    pass float/builtin_float_round.py
    FAIL float/bytearray_construct.py
    FAIL float/bytes_construct.py
    pass float/cmath_fun.py
    FAIL float/cmath_fun_special.py
    skip float/complex1.py
    FAIL float/float1.py
    pass float/float2int.py
    Traceback (most recent call last):
    File "float/float2int_doubleprec.py", line 42, in
    NameError: name 'testpass' is not defined
    FAIL float/float2int_doubleprec.py
    pass float/float2int_fp30.py
    FAIL float/float_array.py
    FAIL float/float_divmod.py
    FAIL float/float_divmod_relaxed.py
    FAIL float/float_struct.py
    skip float/int_big_float.py
    FAIL float/int_divzero.py
    FAIL float/int_power.py
    FAIL float/list_index.py
    Traceback (most recent call last):
    File "float/math_fun.py", line 39, in
    NameError: name 'test_values' is not defined
    FAIL float/math_fun.py
    pass float/math_fun_bool.py
    Traceback (most recent call last):
    File "float/math_fun_special.py", line 36, in
    File "float/math_fun_special.py", line 34, in
    NameError: name 'function' is not defined
    FAIL float/math_fun_special.py
    FAIL float/string_format.py
    Traceback (most recent call last):
    File "float/string_format2.py", line 103, in
    File "float/string_format2.py", line 26, in test_fmt
    NameError: name 'test' is not defined
    FAIL float/string_format2.py
    FAIL float/string_format_fp30.py
    FAIL float/string_format_modulo.py
    FAIL float/string_format_modulo2.py
    skip float/true_value.py
    skip float/types.py
    FAIL import/gen_context.py
    FAIL import/gen_context2.py
    FAIL import/import1a.py
    FAIL import/import1b.py
    FAIL import/import2a.py
    FAIL import/import3a.py
    FAIL import/import_file.py
    FAIL import/import_pkg1.py
    FAIL import/import_pkg2.py
    FAIL import/import_pkg3.py
    FAIL import/import_pkg4.py
    FAIL import/import_pkg5.py
    FAIL import/import_pkg6.py
    FAIL import/rel_import_inv.py
    FAIL import/try_module.py
    FAIL io/argv.py
    FAIL io/buffered_writer.py
    FAIL io/bytesio_ext.py
    FAIL io/file1.py
    FAIL io/file_iter.py
    FAIL io/file_long_read.py
    FAIL io/file_long_read2.py
    FAIL io/file_long_read3.py
    FAIL io/file_readinto.py
    FAIL io/file_readinto_len.py
    FAIL io/file_readline.py
    FAIL io/file_seek.py
    FAIL io/file_stdio.py
    pass io/file_with.py
    FAIL io/open_append.py
    FAIL io/open_plus.py
    FAIL io/stringio1.py
    FAIL io/stringio_with.py
    FAIL io/write_ext.py
    FAIL micropython/const.py
    FAIL micropython/const2.py
    FAIL micropython/const_error.py
    FAIL micropython/decorator.py
    FAIL micropython/decorator_error.py
    FAIL micropython/emg_exc.py
    FAIL micropython/heap_lock.py
    FAIL micropython/heapalloc.py
    FAIL micropython/meminfo.py
    FAIL micropython/memstats.py
    skip micropython/native_closure.py
    skip micropython/native_const.py
    skip micropython/native_misc.py
    FAIL micropython/opt_level.py
    skip micropython/viper_addr.py
    skip micropython/viper_args.py
    skip micropython/viper_binop_arith.py
    skip micropython/viper_binop_comp.py
    skip micropython/viper_binop_comp_imm.py
    skip micropython/viper_binop_multi_comp.py
    skip micropython/viper_cond.py
    skip micropython/viper_error.py
    skip micropython/viper_misc.py
    skip micropython/viper_ptr16_load.py
    skip micropython/viper_ptr16_store.py
    skip micropython/viper_ptr32_load.py
    skip micropython/viper_ptr32_store.py
    skip micropython/viper_ptr8_load.py
    skip micropython/viper_ptr8_store.py
    skip micropython/viper_subscr.py
    FAIL misc/features.py
    FAIL misc/non_compliant.py
    FAIL misc/non_compliant_lexer.py
    Traceback (most recent call last):
    File "misc/print_exception.py", line 32, in
    File "misc/print_exception.py", line 32, in
    File "misc/print_exception.py", line 13, in print_exc
    NameError: name 'io' is not defined
    FAIL misc/print_exception.py
    FAIL misc/recursion.py
    FAIL misc/recursive_data.py
    Traceback (most recent call last):
    File "misc/recursive_iternext.py", line 40, in
    File "misc/recursive_iternext.py", line 36, in
    NameError: name 'N' is not defined
    FAIL misc/recursive_iternext.py
    FAIL misc/rge_sm.py
    FAIL misc/sys_exc_info.py
    FAIL stress/dict_copy.py
    FAIL stress/dict_create.py
    FAIL stress/list_sort.py
    FAIL unicode/file1.py
    FAIL unicode/file2.py
    pass unicode/unicode.py
    pass unicode/unicode_chr.py
    FAIL unicode/unicode_id.py
    FAIL unicode/unicode_index.py
    FAIL unicode/unicode_iter.py
    FAIL unicode/unicode_ord.py
    FAIL unicode/unicode_pos.py
    FAIL unicode/unicode_str_format.py
    FAIL unicode/unicode_str_modulo.py
    FAIL unicode/unicode_subscr.py
    FAIL unix/extra_coverage.py
    FAIL unix/ffi_callback.py
    FAIL unix/ffi_float.py
    FAIL unix/ffi_float2.py
    518 tests performed (17778 individual testcases)
    38 tests passed
    32 tests skipped: array_construct_endian bytearray_construct_endian bytes_add_endian bytes_construct_endian repl_emacs_keys vfs_fat_fileio vfs_fat_fsusermount vfs_fat_oldproto vfs_fat_ramdisk complex1 int_big_float true_value types native_closure native_const native_misc viper_addr viper_args viper_binop_arith viper_binop_comp viper_binop_comp_imm viper_binop_multi_comp viper_cond viper_error viper_misc viper_ptr16_load viper_ptr16_store viper_ptr32_load viper_ptr32_store viper_ptr8_load viper_ptr8_store viper_subscr
    480 tests failed: 0prelim array1 array_add array_construct array_construct2 array_q assign1 async_await async_await2 async_def async_for async_for2 async_with async_with2 attrtuple1 bool1 boundmeth1 break builtin_abs builtin_allany builtin_bin builtin_callable builtin_chr builtin_compile builtin_delattr builtin_dir builtin_divmod builtin_eval builtin_eval_error builtin_hash builtin_hex builtin_id builtin_issubclass builtin_len1 builtin_minmax builtin_oct builtin_ord builtin_override builtin_pow builtin_property builtin_range builtin_reversed builtin_round builtin_slice builtin_sorted builtin_sum builtin_type bytearray1 bytearray_add bytearray_append bytearray_construct bytearray_longint bytearray_slice_assign bytes bytes_add bytes_compare2 bytes_compare3 bytes_construct bytes_count bytes_find bytes_format_modulo bytes_gen bytes_large bytes_mult bytes_partition bytes_replace bytes_split bytes_strip bytes_subscr class1 class2 class3 class_bind_self class_binop class_call class_contains class_descriptor class_emptybases class_getattr class_inherit1 class_inherit_mul class_instance_override class_item class_new class_number class_staticclassmethod class_store class_store_class class_str class_super class_super_object class_use_other closure1 closure2 closure_defargs closure_manyvars closure_namedarg compare_multi comprehension1 containment continue decorator del_attr del_deref del_global del_local del_name del_subscr dict2 dict_clear dict_construct dict_copy dict_del dict_from_iter dict_fromkeys dict_get dict_intern dict_iterator dict_pop dict_popitem dict_setdefault dict_specialmeth dict_update dict_views enumerate equal equal_class errno1 except_match_tuple exception1 exception_chain exceptpoly exceptpoly2 exec1 filter floordivide for1 for2 for3 for_break for_range for_return frozenset1 frozenset_add frozenset_copy frozenset_set fun1 fun2 fun3 fun_annotations fun_calldblstar fun_calldblstar2 fun_calldblstar3 fun_callstar fun_callstardblstar fun_defargs fun_defargs2 fun_error fun_kwargs fun_kwonly fun_kwvarargs fun_largestate fun_name fun_str fun_varargs gc1 gen_yield_from gen_yield_from_close gen_yield_from_ducktype gen_yield_from_exc gen_yield_from_iter gen_yield_from_send gen_yield_from_stopped gen_yield_from_throw generator1 generator2 generator_args generator_close generator_closure generator_exc generator_send getattr getattr1 getitem globals_del hasattr1 ifcond int1 int2 int_big_and int_big_and3 int_big_cmp int_big_div int_big_error int_big_lshift int_big_mod int_big_mul int_big_or int_big_or2 int_big_or3 int_big_pow int_big_rshift int_big_unary int_big_xor int_big_xor2 int_big_xor3 int_big_zeroone int_bytes int_constfolding int_divmod int_divzero int_long int_mpz int_small is_isnot iter0 iter1 iter2 iter_of_iter lambda1 lambda_defargs lexer list1 list_clear list_compare list_copy list_count list_extend list_index list_insert list_mult list_pop list_remove list_reverse list_slice list_slice_3arg list_slice_assign list_slice_assign_grow list_sort list_sum map memoryerror memoryview1 memoryview2 memoryview_gc module1 module2 namedtuple1 object1 object_dict object_new op_error parser print python34 return1 scope seq_unpack set1 set_add set_clear set_copy set_difference set_discard set_intersection set_isdisjoint set_isfooset set_iter set_pop set_specialmeth set_symmetric_difference set_union set_unop set_update setattr1 slice_attrs slice_bignum slots_bool_len special_methods string1 string_center string_compare string_count string_cr_conversion string_crlf_conversion string_endswith string_escape string_find string_format string_format2 string_format_error string_format_modulo string_index string_join string_large string_mult string_partition string_replace string_repr string_rfind string_rindex string_rpartition string_rsplit string_slice string_split string_splitlines string_startswith string_strip struct1 struct2 subclass_classmethod subclass_native1 subclass_native2_list subclass_native2_tuple subclass_native3 subclass_native4 subclass_native5 subclass_native_buffer subclass_native_cmp subclass_native_specmeth syntaxerror try1 try2 try3 try4 try_continue try_finally2 try_finally_return try_finally_return2 tuple1 tuple_compare tuple_count tuple_index tuple_mult types1 types2 unary_op unboundlocal unpack1 while1 while_cond while_nest_exc with1 with_break with_continue with_return zip cmd_optimise cmd_showbc cmd_verbose repl_basic repl_cont btree1 framebuf1 machine_pinbase machine_pulse ticks_diff time_ms_us ubinascii_a2b_base64 ubinascii_b2a_base64 ubinascii_hexlify ubinascii_unhexlify uctypes_array_assign_le uctypes_array_assign_native_le uctypes_bytearray uctypes_le uctypes_le_float uctypes_native_float uctypes_native_le uctypes_ptr_le uctypes_ptr_native_le uctypes_sizeof uctypes_sizeof_native uheapq1 ujson_dumps ujson_dumps_extra ujson_dumps_float ujson_load ujson_loads ujson_loads_float urandom_basic urandom_extra ure1 ure_error ure_group ure_namedclass ure_split ure_split_empty uzlib_decompress array_construct builtin_float_minmax bytearray_construct bytes_construct cmath_fun_special float1 float2int_doubleprec float_array float_divmod float_divmod_relaxed float_struct int_divzero int_power list_index math_fun math_fun_special string_format string_format2 string_format_fp30 string_format_modulo string_format_modulo2 gen_context gen_context2 import1a import1b import2a import3a import_file import_pkg1 import_pkg2 import_pkg3 import_pkg4 import_pkg5 import_pkg6 rel_import_inv try_module argv buffered_writer bytesio_ext file1 file_iter file_long_read file_long_read2 file_long_read3 file_readinto file_readinto_len file_readline file_seek file_stdio open_append open_plus stringio1 stringio_with write_ext const const2 const_error decorator decorator_error emg_exc heap_lock heapalloc meminfo memstats opt_level features non_compliant non_compliant_lexer print_exception recursion recursive_data recursive_iternext rge_sm sys_exc_info dict_copy dict_create list_sort file1 file2 unicode_id unicode_index unicode_iter unicode_ord unicode_pos unicode_str_format unicode_str_modulo unicode_subscr extra_coverage ffi_callback ffi_float ffi_float2
    Makefile:190: recipe for target 'test' failed
    make: *** [test] Error 1

Thank you!

BLE - OSError: connection refused

(sysname='LoPy', nodename='LoPy', release='1.6.13.b1', version='v1.8.6-607-g9c8a0e9e on 2017-05-01', machine='LoPy with 
ESP32', lorawan='1.0.0') 

Attempting to connect from one LoPy to another LoPy device:

from network import Bluetooth
import binascii
bluetooth = Bluetooth()

# scan until we can connect to any BLE device around
bluetooth.start_scan(-1)
adv = None
while True:
    adv = bluetooth.get_adv()
    if adv:
        try:
            print(binascii.hexlify(adv.mac))
            bluetooth.connect(adv.mac)
        except:
            # start scanning again
            bluetooth.start_scan(-1)
            continue
        break
print("Connected to device with addr = {}".format(binascii.hexlify(adv.mac)))

Error arises after the connecting LoPy finds the address of the advertising device and attempts to connect.

b'240ac40061fa'
Traceback (most recent call last):                                                                                      
  File "<stdin>", line 50, in <module>                                                                                  
OSError: connection already closed

                                                                         
Thanks!

ustruct Guru Meditation Error crash and blocks the device

LopY 1.7.8.b1

This type of crash blocks the device.

Simple to reproduce. Type in console:

a= 0xaabbccdd
a.to_bytes(4)
b'\xdd\xcc\xbb\xaa'

import ustruct
ustruct.pack('4b',a)

Guru Meditation Error of type LoadProhibited occurred on core 0. Exception was unhandled.
Register dump:
PC : 0x400ee210 PS : 0x00060030 A0 : 0x800ee403 A1 : 0x3ffc6830
A2 : 0x3ffc6af0 A3 : 0x3ffc6841 A4 : 0x00000001 A5 : 0x3ffe83f2
A6 : 0x000000fb A7 : 0xffffffff A8 : 0x00000000 A9 : 0x0000ccdd
A10 : 0x00000002 A11 : 0x3ffe83f0 A12 : 0x0000ccdd A13 : 0x3ffe83ef
A14 : 0x00000010 A15 : 0x3ffe83f1 SAR : 0x0000001e EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000004 LBEG : 0x4000c28c LEND : 0x4000c296 LCOUNT : 0x00000000

Backtrace: 0x400ee210:0x3ffc6830 0x400ee400:0x3ffc6850 0x400f5ef0:0x3ffc6870 0x400f77ae:0x3ffc68b0 0x400f7801:0x3ffc68f0 0x400f078b:0x3ffc6920 0x400ecc5d:0x3ffc6950 0x400eccc5:0x3ffc6970 0x400f883d:0x3ffc6990 0x400f0710:0x3ffc6a30 0x400ecc5d:0x3ffc6ab0 0x400ecc8a:0x3ffc6ad0 0x400d9953:0x3ffc6af0 0x400d9bf4:0x3ffc6b90 0x400d8c28:0x3ffc6bd0

Guru Meditation Error of type LoadProhibited occurred on core 0. Exception was unhandled.
Register dump:
PC : 0x4008a199 PS : 0x00060033 A0 : 0x80088fd6 A1 : 0x3ffc6470
A2 : 0x3ffc64c0 A3 : 0x3ffc6490 A4 : 0x00000000 A5 : 0x3ffc483c
A6 : 0x00000000 A7 : 0x3ffc4858 A8 : 0x00000012 A9 : 0x3ffc6440
A10 : 0x3ffc6508 A11 : 0x3ffc6490 A12 : 0x3ffb798c A13 : 0x3ffc6850
A14 : 0x3ffc6af0 A15 : 0x00000000 SAR : 0x00000020 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0x00000000

Backtrace: 0x4008a199:0x3ffc6470 0x40088fd3:0x3ffc6490 0x4008b2f5:0x3ffc64c0 0x4008b66a:0x3ffc6690 0x4008af75:0x3ffc66d0 0x4008b0f0:0x3ffc6750 0x4008168a:0x3ffc6770 0x400ee20d:0x3ffc6830 0x400ee20d:0x3ffc6850 0x400f5ef0:0x3ffc6870 0x400f77ae:0x3ffc68b0 0x400f7801:0x3ffc68f0 0x400f078b:0x3ffc6920 0x400ecc5d:0x3ffc6950 0x400eccc5:0x3ffc6970 0x400f883d:0x3ffc6990 0x400f0710:0x3ffc6a30 0x400ecc5d:0x3ffc6ab0 0x400ecc8a:0x3ffc6ad0 0x400d9953:0x3ffc6af0 0x400d9bf4:0x3ffc6b90 0x400d8c28:0x3ffc6bd0

No rule to make target 'build/LOPY_868/release/bootloader/bootloader.bin'

Hi, I wanna try to compile micropython for my Lopy but I am facing this error. Any idea ?

git revision: f4f56ab

make BOARD=LOPY LORA_BAND=USE_BAND_868 flash V=1
[...]
IMAGE build/LOPY_868/release/lopy_868.bin
python /home/edby8475/Documents/DevOPS/FabLab/lopy_compile/pycom-esp-idf/components/esptool_py/esptool/esptool.py --chip esp32 elf2image --flash_mode qio --flash_freq 40m -o build/LOPY_868/release/lopy_868.bin build/LOPY_868/release/application.elf
esptool.py v2.0-beta2
Signing OTA image
bash tools/appsign.sh build/LOPY_868/release/lopy_868.bin build/LOPY_868/release
make: *** No rule to make target 'build/LOPY_868/release/bootloader/bootloader.bin', needed by 'flash'.  Stop.

Thanks for your help

BLE: GATTCCharacteristics.write('value') doesn't work!

I use a WiPy 2.0 with firmware 1.7.6.b1.

I notice that with firmware 1.7.6.b1 now the BLE connection function works fine. Now it is possible discover all services and characteristics, but the write function on a characteristic does not work. In my code example chars[0] is a PROP_WRITE charateristic, but when I write something on it, anything happen.

from network import Bluetooth
import ubinascii
import machine
import uos
import utime

bt = Bluetooth()
bt.start_scan(-1)
while True:
    adv = bt.get_adv()
    try:
        if adv and bt.resolve_adv_data(adv.data, Bluetooth.ADV_NAME_CMPL) == 'X-DOM-NC':
            print(adv.mac)
            conn = bt.connect(adv.mac)
            while not conn.isconnected():
                machine.idle()
            print("connected")
            print(conn)
            services = conn.services()
            print("services")
            print(services)
            print(services[0].uuid())
            print(services[1].uuid())
            print(services[2].uuid())
            chars = services[2].characteristics()
            print(chars)
            print(chars[0].properties())
            print(chars[1].properties())
            print(chars[0].uuid())
            print(chars[1].uuid())
            chars[0].write(b'x0f')
            utime.sleep(2)
            break
    except:
        print("Error while connecting or reading from the BLE device")
        break
while True:
    pass
conn.disconnect()

Instead, if chars[0] has a property PROP_WRITE_NR the write function works fine!

ESP32: Partitioning inconsistency between pycom.io builds and own builds from the repository

There is obviously an inconsistency in the partition map between firmware builds, made by Pycom and those made locally from the github repository. What happens when:
If you have first loaded an pycom.io firmware via updater tool, and then flash a self built image via "make flash", the device does not start, but just shows a red RGB led. One has to erase the flash completely and reload to get it working.
If you have a self built image working and then load an pycom.io image, the device starts, but the content of the file system is gone.
So: would please someone make these two variants consistent.

LoPy build error on linux 64 machine

Building LoPy(Latest firmware update today) from Pycom. Getting this error on linux 64 bit OS. Please resolve this. Even i have tried the method above but no luck.

Error shown below-----

skmis@skmis-VirtualBox:~/esp/esp32$ make BOARD=LOPY -j5 LORA_BAND=USE_BAND_868 TARGET=app
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
LINK build/LOPY_868/release/application.elf
/home/skmis/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: cannot find -lrtc_clk
collect2: error: ld returned 1 exit status
application.mk:360: recipe for target 'build/LOPY_868/release/application.elf' failed
make: *** [build/LOPY_868/release/application.elf] Error 1

int32 overflow because of to late cast

int32 overflow because of to late cast

STATIC mp_obj_t machine_deepsleep (uint n_args, const mp_obj_t *arg) {
    mperror_enable_heartbeat(false);
    bt_deinit(NULL);
    wlan_deinit(NULL);
    if (n_args == 0) {
        esp_deep_sleep_start();
    } else {
        esp_deep_sleep((uint64_t)(mp_obj_get_int(arg[0]) * 1000));
    }
}

but should be

 esp_deep_sleep((uint64_t)mp_obj_get_int(arg[0]) * 1000);

Atom editor crashes when trying to connect to Pycom

Hello,

I am trying to connect to Pycom (1.1.3) from Atom editor (Atom: 1.20.1, Electron: 1.6.9, Chrome: 56.0.2924.87, Node: 7.4.0) on Ubuntu 14.04. I added Pymkr 1.1.3 automatically using the Atom GUI. The Atom editor crashes when clicking on connect, after retrieving and setting the USB serial port for Pycom. The message displayed is "Editor has crashed. Please report this issue". I am totally new to the environment and trying to do my first set up. Could anyone help me identify the source of the problem and fix it?

Thank you!

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

BLE API doesn't have Descriptor

I am connecting my device to a HM-10 BLE product using GATTC.

In super summary, BLE works the following way for GATT,
There is a service, which MAY contain characteristics.
The characteristics will have a value and may have a descriptor.
http://static.thegeekstuff.com/wp-content/uploads/2014/07/ti-ble-profile.png

Usually if you expect a reply from a client, you have to enable the notifications / indications to be 1 within the descriptor field of the characteristic you want to have a reply.

For example, in HM-10, if i send a "AT", i should receive "OK"
For my android phones, and pygatt software and micropython(https://github.com/MrSurly/micropython-esp32/blob/dev-bluetooth/esp32/bluetooth_docs.md), to receive the "OK" command, I will have to manually set the notifications or indications field to be true. It works on all the devices.

However, there is no way for me to set it to be true in pycom micropython as there is no descriptor function within characteristic.

dir(blecharacteristic)
['uuid', 'instance', 'properties', 'read', 'write', 'callback']

I believe you guys missed this portion of the API. Do let me know if you guys need logs or anything.

LoRaWAN MAC Battery Level reporting

Board: LoPy

Firmware: 1.7.8.b1

There is a lora.set_battery_level(level) method introduced in latest firmware.

Unfortunately current implementation is not in line with LoraWAN Specification v1.0.2

Method is passing values between 0 and 100 to the LoRaWAN server directly which means on server side 39% for level=100, 20% for level=50, there are no way to report battery level 40-100%.

Default value is 0 which indicates device is running on external source, level=0 doesn't mean 0%. Proper default value would be 255 which by the way can't be reported via this method.

I advice to allow level=0...255 in the method inpput argument and use level=255 as default, adding the quoted text from the LoRaWAN specification to the documentation.

Forum reference: https://forum.pycom.io/topic/1613/lorawan-mac-battery-level-reporting

(from bmarkus)

Visual Studio Code not working

Hi. I just got a WiPy 2.0, and discovered that the plugin for Atom is broken (can't find serialport.py), so I'm trying VS Code. I've installed the plugin there, and restarted VSCode. The instruction say to:
Open 'Global Settings' (this opens automatically after first install).
Where is "Global Settings"? I've been all over the menus, and there's nothing like that.
My first experience with PyCom is definitely not a great start.
Please help!
(I'd enter all that stuff you wnated from the REPL, but I can't get a REPL!)
Thanks,
Steve

Pysense issues

(sysname='WiPy', nodename='WiPy', release='1.8.0.b1', version='v1.8.6-760-g90b72952 on 2017-09-01', machine='WiPy with ESP32')
WiPy 2.0
Pysense firmware updated to 0.0.4, board v1.0
I synced the pysense software using pymakr and the WiPy in the expansion dock as syncing was erratic when the WiPy is in the Pysense dock.
When booting in the Pysense dock I get:

rst:0x1 (POWERON_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:0x3fff9010,len:12
ho 0 tail 12 room 4
load:0x3fff9020,len:388
load:0x40078000,len:11584
load:0x4009fb00,len:848
entry 0x4009fc9c
Hello from playtime/boot
Hello from playtime/main
MicroPython v1.8.6-760-g90b72952 on 2017-09-01; WiPy with ESP32
Type "help()" for more information.

(boot.py and main.py each contain only a simple print statement)

At this point the behavior is unpredictable. Sometimes I can interact with the REPL, mostly not. If I can and import pysense, it becomes unresponsive.

This is being done on an 11 inch Macbook Air using CoolTerm for interactions with the REPL. I have no issues at all when the WiPy is in the expansion doc. I suspect that the Pysense board is defective.

Compilation errors in latest version

After cloning the latest version (including pycom-esp-idf) on OS X I get the following compilation error:
/Users/avb/Work/Pycom/pycom-esp-idf/components/soc/esp32/include/soc/io_mux_reg.h: In function 'PIN_PULLUP_DIS':
/Users/avb/Work/Pycom/pycom-esp-idf/components/esp32/include/esp_assert.h:23:28: error: first argument to '__builtin_choose_expr' not a constant
_Static_assert(__builtin_choose_expr(__builtin_constant_p(CONDITION), (CONDITION), 1), #MSG);
... many similar messages to follow

This is for a LOPY on 868 MHz
As earlier versions compiled and worked correctly I think something is broken. Any suggestions how to fix this?

Tnx, Auke

int.from_bytes(b'\xFF\x00','big') returns incorrect result

Hardware: WiPy 2.0 (though probably same issue on all).

Problem: int.from_bytes(b'\xFF\x00','big')
returns 255. Expected: 65280 for big endian (255 is correct for little endian).

Apparently this was fixed in the original micropython.org branch in January with PR #2791.

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.