The iccid() function only works after an attach command is attempted. Since we use the ICCID to determine the correct APN to use in the attach command, we have to do a dummy attach call, read the iccid, detach, and then correctly attach with the computed apn. Hope this helps others until this issue is resolved.
Below is the revised code that now works.
from network import LTE
lte = LTE()
iccid = lte.iccid() # does not work
lte.attach(apn='unknown') # attempt attach so iccid() will work
iccid = lte.iccid() # iccid() now works
# compute apn from iccid
lte.attach(apn=computed_apn) # attach with correct apn
I'm struggling to get this to work.
After following the instructions seemingly exactly with a wipy2.0 running 1.18.2.r4, I run into an error:
"Warning: Virtual write to unregistered pin 1"
All I did was download the code from wipy2 after setting up pymate, and add:
val = int(params)
if (val < 256):
val = val & 0xFF
elif (val > 255 and val < 512):
val = (val << 8) & 0xFF00
elif (val > 511):
val = (val << 16) & 0xFF0000
right under where it says "# Initialize Virtual Pins and Terminal Pins Here" in the Pymate_basic.py file in the lib.
I can't seem to figure out why this doesn't work since I am following this guide exactly.
Is the only way to upload code through FTP? I seem to be able to download, edit, and re-upload the code through REPL when booted in safe mode. Is this a no-no?
When I'm running this simple code to connect to Thingsboard and subscribing to a topic,
the code doesn't run passed the call to the subscribe method (line 35):
from mqtt import MQTTClient
from network import WLAN
def sub_cb(topic, msg):
wlan = WLAN(mode=WLAN.STA)
wlan.connect(config.WLAN_SSID, auth=(WLAN.WPA2, config.WLAN_Password), timeout=5000)
while not wlan.isconnected():
print("\nConnected to WiFi")
client = MQTTClient(client_id=config.MQTT_DEVICE_ID, server=config.MQTT_BROKER_ADDRESS,user=config.MQTT_DEVICE_TOKEN, password="", port=config.MQTT_BROKER_PORT)
client.settimeout = settimeout
print("Connected to MQTT Broker\n")
When triggering updates in Thingsboard, the device indeed gets the subscribed updates as shown in the terminal output:
But the code never reach the while loop, looks like the subscribe method are blocking(!?)
When idle for a few minutes, the code exits whit the following message:
Traceback (most recent call last):
File "/flash/main.py", line 35, in <module>
File "/flash/lib/mqtt.py", line 142, in subscribe
File "/flash/lib/mqtt.py", line 161, in wait_msg
Pycom MicroPython 1.18.2.r3 [v1.8.6-849-a1641ca] on 2019-02-28; FiPy with ESP32
Type "help()" for more information.
If I exclude the subscribe call, the loop suns as expected and updates reaches Thingsboard.
Running similar code in Arduino IDE on a Wemos Lolin ESP32 device works just fine, so it's not an issue with Thingsboard.
ANY help would be much appreciated to fix this issue, it's a showstopper for my (commercial) project!
@danielm said in Using PyCom products in Hungary, Telekom NB-IoT network:
In Slovak Telekom network NB-IoT service is operated in B20 using Ericsson RAN and it is possible to connect. By the way part of EPC functionalities is served from Deutsche Telekom and I expected it will be the case for Magyar Telekom NB-IoT network deployment as well.
Thanks for the info!
I can't get data out of the LIS2HH12 fast enough at any data rates greater than the lowest 10 Hz setting, using the default bypass mode. This inadequate read rate behavior is discussed in application note DM00165265.pdf on page 13, and I can confirm it by checking the STATUS register ZYXOR overrun bit just before reading the data. The overrun behavior is obvious even at 50 Hz.
The obvious solution is to use the FIFO but it's not clear to me that this will be sufficient for my purposes. I'd like to use an data rate of at least 100 Hz. Several accelerometer data sheets discuss the preference for using SPI rather than
I2C since the SPI read rate is higher - this is a built in limitation when using Pysense or Pytrack, including who knows what's going on with the co-processor.
Is anyone successfully using the FIFO? Before writing the FIFO code to try it out, I think I'll wire in a LIS2HH12 using SPI and see how fast that goes. It's unclear to me whether I2C is the major factor in read rate, python itself, the co-processor or some combination.
For a client, I'm looking for a senior Micropython/embedded developer (freelance/contractor) that preferrably has experience with Pycom modules. I have been working as developer for the client myself, but they need extra help.
You will be working on the software for a new iteration of the (Pycom-based) device that the company is developing. You will be working most of the time on the Micropython code that runs on the devices. You will also need to be comfortable with embedded C in order to analyze and fix problems in the Pycom firmware when they arise and extend the firmware in case a feature cannot be implemented in Micropython.
You can work remotely, but occassional visits to the company headquarters in Noord-Brabant are desired.
Developer Experience Profile
Embedded C + GNU command line toolchain (gcc, gdb, binutils)
Inter-IC Protocol knowledge: I2C, SPI, 1Wire, etc.
Analyzing/Debugging hardware issues using a logic analyzer
Development of device drivers and other low-level code (both in Micropython as well as C)
Unit testing (esp. Python) is a plus
TypeScript & React experience is a big plus, but not a must
Bluetooth experience is a plus, but not a must
The company is active in the smart building and real-estate space. It has many Pycom-based products deployed in a number of large buildings in The Netherlands. The team working on the products and services is very small so you will have a lot of influence on the product. The company is based in Noord-Brabant, The Netherlands, easily accesible by car or public transit.
Please contact me at:
post AT martijnthe DOT nl