New firmware release 1.4.0.b1
-
@livius
This is how I understand it:-
heartbeat is a special function associated to the led and needs exclusive access. If it's active (set to 1 or True) you can't override it and the led will just blink periodically in blue.
-
rgbled doesn't just change the colour, it sets the led immediately to the colour you give it. If the colour is anything other than 0 (black) it turns the led on. To turn it off do pycom.rgbled(0)
-
-
and also problem with i2c
previous code run without any problem but now i got:I (8388) wifi: connected with livius, channel 9 WLAN connection to the router succeeded! Traceback (most recent call last): File "boot.py", line 16, in <module> File "wifi_sta_router.py", line 65, in <module> File "bmp180.py", line 48, in __init__ OSError: I2C bus errorwas something changed also in i2c?
@jmarcelino
i can also understand this in that way but what is then purpose about parameterpycom.heartbeat(1) pycom.heartbeat(0)i can disable it and enable back with the same color as previous?
but pycom.heartbeat(1) also disable it when it was enabled
i suppose that this work as toggle instead on/off@daniel
also i see that when i send file - size 3201 bytes throught wifi
it is somehow broken inside - it is transmitted as 3201 but some lines are wrong when i download it back throught wifi
e.g.
oryginal fileileTemp180=0 if (prevCisnienie180!=cisnienie180): prevCisnienie180=cisnienie180 s.send('{"U":"' + UID + 'C180' + '", "V":[[' + str(cisnienie180)+','+str(ileCisnienie180) +']]}\n') ileCisnienie180=0 time.sleep(1)and after download back:
ileTemp180=0 if (pr180) +']]}\n') ileCisnienie180=0 time.sleep(1)UPDATE
i see that problem with i2c was only because this crash(trash) in file not i2c itself (i suppose)
when i send this file e.g. 20 times (always successfully)
then it was eventually as should be and code work ok also in newest firmware
12 sensors read data throught i2c, one wire, digital and ADC and send it back throught wifi to service on computer and back to database :)And now i have question - how many times we can write to flash? What is the write cycle life of that flash?UPDATE 2
I supposed that it all was fixed
but after fresh start on early morning it bring me back same error about i2cWLAN connection to the router succeeded! Traceback (most recent call last): File "boot.py", line 16, in <module> File "wifi_sta_router.py", line 65, in <module> File "bmp180.py", line 48, in __init__ OSError: I2C bus error -
OK, just discovered something....
If I power the WIPY2 via expansion board / USB then it boots, but if I power it by VIN and GND it does not.
I have proved that it appears to be firmware related by performing the same test on another board that has factory firmware.
Can someone else verify this ?
Update 1
Is there a circuit diagram for the expansion board, I can't seem to find one ??
If I remove the expansion board jupmers for TX and RX and power it via USB, it does not boot, same as powering with VIN, I now suspect that the new firmware may not be pulling the TX/RX lines high during boot, or something is waiting for these lines to be pulled up.
Update 2
OK, If I hold P0 high, then the board will boot when:- powered via VIN
- powered via USB but the TX jumper is removed.
So my guess is that the firmware is not doing a soft-pullup on this pin during bootup ??
Update 3
After more study, I believe that this issue is caused when calling the serial console in the boot.py file, the system tries to initialise the serial console and if the line is not high then it just waits forever until it is.So not really a bug !
-
Thanks for the updates.
The
Bluetooth.CLIENT_CONNECTEDandBluetooth.CLIENT_DISCONNECTEDare working as expected. but I just can't work theBluetooth.CHAR_NOTIFY_EVENT! It simply won't call the callback function.I'm developing my own test app for iOS and when I try to subscribe to the characteristic I have defined, I get an update from my peripheral manager that indicates the characteristic is not subscribed for notification! Meaning the BLE characteristic has rejected the subscription. Could you provide us with a working example of the event callback to work on? Am I missing something here?
Here is how I'm defining the callback:
def char_subscribed(chr): print("Char Subscribed: %r" % chr) chr1_cb = chr1.callback(trigger = Bluetooth.CHAR_NOTIFY_EVENT, handler = char_subscribed)P.S.: If I substitute
CAHR_NOTIFY_EVENTwithCHAR_READ_EVENTthe callback is called when I try to read.UPDATE:
As I was browsing through the newly available source code of the MicroPython for pycom boards (Thanks a lot), I have noticed that the Notify event is for the BLE Client mode only (?!) am I right? it says
MOD_BT_GATTC_NOTIFY_EVTwhich fromGATTCpart I'm guessing it is for GATT Client only! Could someone confirm my findings?UPDATE 2:
Using other utilities leads to same results: If you try to subscribe, it simply fails to subscribe.
Tools I tried: LightBlue (iOS and macOS)
-
@mohpor
Yes thats is correct, the notification events are for the Py boards working as a GATT client only.What are you trying to achieve by having a notification callback as GATT server? Servers usually just send a notification if a characteristic was updated (this isn't implemented yet)
-
I have seen in later releases that I get a lot of these:
W (196498) wifi: post pm rx bcn failed
W (196498) wifi: post pm rx bcn failed
W (196498) wifi: post pm rx bcn failed
W (196498) wifi: post pm rx bcn failed
W (196498) wifi: post pm rx bcn failed
W (196498) wifi: post pm rx bcn failed
W (196498) wifi: post pm rx bcn failed
W (196498) wifi: post pm rx bcn failed
W (196498) wifi: post pm rx bcn failedI have no idea why, I cannot recall that I got them before.
They seem to be harmful since my sockets are being dropped after a while. Also, when they arrive the hw seem to stall for many seconds. -
@jmarcelino
I'm not sure what your question is about, but, there is a valid pattern involving here.
Acting as a server (GATT), you can start updating a characteristic's value IF the client subscribes to its notification which is extremely essential to GATT Servers, otherwise, you are updating a characteristic when no one's even interested in it! -
@mohpor
Yes that would be useful but this is a CHAR_NOTIFY_EVENT notification, where the Py board, acting as a GATT client, subscribes to a characteristic and for some reason (usually when the value was updated) the GATT server wishes to notify the Py board.As far as I know the Py acting as a GATT server cannot send notifications yet, so at the moment - to me at least - there seems to be no useful purpose for a "subscribed" callback.
-
@mohpor You probably have to make sure that the server side is actually sending notifications. I think this is usually done by writing to a specific register on the server service (look it up in the documentation for the sending device).
-
That was my question. Just like in Client mode, having no Notify callback in Server mode renders having GATT Server close to useless for me.
@arneme Please read the original question again.
-
@Wembly
Yes I've seen some WiFi timeouts as well. I suspect the STA mode WiFi power management isn't entirely on point - or maybe it's just doesn't like my "free" wifi router.(pinging @daniel) I'd suggest letting us disable the automatic power savings on WiFi. Perhaps the WiFi set_mode call can take an extra parameter for both mode (i.e. STA) and power savings setting.
-
@mohpor
May not be ideal or efficient but for many applications you can emulate the notification system by simply periodically polling the characteristic from your iOS app client which triggers the CHAR_READ_EVENT callback on the Py side. -
@jmarcelino
It's not going to work, because I want to actually read those values, plus, I need to send over large amount of data which I have to package in bundles of 140bytes and write/read them sequentially.One thing would work though, I could have a totally separate characteristic which have events on write and when I need the data, I can write on/off to trigger updates for the main characteristic. Seems rather counter intuitive but I have to make do :(
Cheers,
M. -
Acting as a server (GATT), you can start updating a characteristic's value IF the client subscribes to its notification which is extremely essential to GATT Servers, otherwise, you are updating a characteristic when no one's even interested in it!
This is actually not implemented. We are planning another early week release this Monday or Tuesday and we can have it available by then. I'll add it to the list.
-
I'd suggest letting us disable the automatic power savings on WiFi. Perhaps the WiFi set_mode call can take an extra parameter for both mode (i.e. STA) and power savings setting.
OK, will add this option. Thanks for the feedback everyone!
-
@daniel
Hi,is still i2c as software or it is hardware now?
i test now and when i change first bmp180 and then bh1750 it is ok:bus = I2C(0, I2C.MASTER, baudrate=100000, pins=("P19", "P20")) time.sleep_ms(1) from bmp180 import BMP180 bus.scan() time.sleep_ms(1) bmp180 = BMP180(bus) bmp180.oversample_sett = 2 bmp180.baseline = 103825 time.sleep_ms(1) #bus.scan() light_adr = bus.scan()[0] time.sleep_ms(1) light_sensor = bh1750fvi.BH1750FVI(bus, addr=light_adr) time.sleep_ms(1)but if i change first bh1750 and then bmp180 this cause
OSError: I2C bus errorunder current firmware - on previous all was okbus = I2C(0, I2C.MASTER, baudrate=100000, pins=("P19", "P20")) time.sleep_ms(1) #bus.scan() light_adr = bus.scan()[0] time.sleep_ms(1) light_sensor = bh1750fvi.BH1750FVI(bus, addr=light_adr) time.sleep_ms(1) from bmp180 import BMP180 bus.scan() time.sleep_ms(1) bmp180 = BMP180(bus) bmp180.oversample_sett = 2 bmp180.baseline = 103825 time.sleep_ms(1) -
@livius the I2C implementation is still by software and noting around that has changed on the last releases.
-
I know it has been a while since Bluetooth got introduced, and 2 firmware updates since GATT Server was added, but, why can't we add more than one Characteristic to a service?!
To clarify what I mean here it is the GATT Profile Hierarchy:
As you can see, a Service is defined as a collection of Characteristics...
Is there a timing or plan to have proper GATT Server implementation?
The syntax is tellingService.Characteristicwhile it should be:Service.add_characteristicfor example.Now, to be fair, there is an Open Issue about it on Espressif side of the code:
#280: How to create multiple characteristic on same service(for Bluetooth GATT server)
Update:
The issue is closed now. The solution looks simple.
Cheers,
M. -
@mophor thanks for pointing this out. We'll take this into account for the next release.
Cheers,
Daniel -
Digging through the code, it appears that advertisement events are tied to GATTs. They should be separate. You see the advertisements without connections.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login