Particle Electron GSM Error!



I have successfully virtualized my electron with Zerynth. I tried the “GSM HTTP” example code that is given. I have changed APN as per my SIM card, but it shows an error at the line "`g350.auto_init()" `as below:

Something bad happened HardwareInitializationError at line 28 of main
raised at line 38 of ublox.g350.g350.auto_init
raised at line 55 of ublox.g350.g350.init

What am I doing wrong?
I am also not able to find out the library for ublox g350 in python. Where can I find it?



Hi Dev07,

thanks for joining our community.
In the Zerynth GitHub you can find all source code of the Zerynth Supported Libraries (here, in particular, the Ublox g350 Python Library).

Regarding your issue, the Ublox g350 GSM chip requires a high input current that often the host PC, through the USB cable, is not able to provide; you can try to connect a Li-Po battery in the related connector (or an external power supply paying attention to the input voltage range supported by the device - here more info from our documentation) and try again to run the Python script.

Let me know if this can help you :slight_smile:


Hello @“Matteo Cipriani”,

I’ve tried using Li-Po battery but I still get the above error! All I’ve changed in the example code is that I’ve changed APN according to my SIM card provider as per below.

# set here the APN name
` ```
Help me solve this.


I also have another question! I have to reset the Electron each time I uplink the code(and that also too quickly)!
Is it possible that it can be auto-reset? 


Hi Dev07,

Sorry for the late answer; we’re working very hard to improve and complete our next release r2.1.0 that will be available in this weekend.

I’m also working on resolving your issue; stay tuned for updates.

Regarding the reset during the uplink procedure, yes it is, unfortunately, necessary.
Some devices (included the Particle Electron), do not expose a way to auto-reset with a command from the local machine; so to start the Zerynth Virtual Machine, a manual reset is needed.


Hi dev07,

Good News :smiley:
We found the bug, we fixed it and now everything works in the right way!

This fix will be available very soon in our next patch, but, if you need before, I can send you the blocks of code to replace.


Hi @“Matteo Cipriani”,

That would be great if you could share the code earlier.



Hi dev07,

I just commit new updates in the official Zerynth Github repository for Ublox-g350 library; you have to replace the g350.c and the under your Zerynth Installation:

g350.c must be replaced under "your_home/zerynth2/dist/r2.1.0/libs/official/ublox/g350/csrc/" must be replaced under "your_home/zerynth2/dist/r2.1.0/libs/official/ublox/g350/"

NOTE: if you are using mac or linux platform replace “zerynth2” with “.zerynth2” (hidden folder) in the path

Here below a Python script to test your Particle Electron:

from ublox.g350 import g350<br>from wireless import gsm<br>import streams<br>import requests<br>import json<br><br>streams.serial()<br><br>try:<br> g350.auto_init()<br> print("Registering to the network...")<br> <br> for i in range(20):<br> try:<br> # set here the APN name<br> gsm.attach('')<br> break<br> except g350Exception:<br> print("Something wrong on the G350")<br> except TimeoutError:<br> print("Can't register to network, took too long")<br> sleep(2000) <br> else:<br> print("ooops, can't register at all!")<br> while True:<br> sleep(1000)<br><br> print("Signal Strength:",gsm.rssi())<br> print("Link info",gsm.link_info())<br> print("Network info",gsm.network_info())<br> print("Device info",gsm.mobile_info())<br><br> for i in range(3):<br> try:<br> print("Trying to connect...")<br> response = requests.get("")<br> print("Http Status:",response.status)<br> break<br> except Exception as e:<br> print(e)<br><br> try:<br> if response.status==200:<br> print("Success!!")<br> print("-------------")<br> print("Headers are:",response.headers)<br> print("-------------")<br> print("And the result is:",response.content)<br> print("-------------")<br> js = json.loads(response.content)<br> print("Date:",js["now"]["rfc2822"][:16])<br> print("Time:",js["now"]["rfc2822"][17:])<br> except Exception as e:<br> print("ooops, something very wrong! :(",e)<br>except Exception as e:<br> print("Something bad happened",e)
<br>Remember to set your APN name and to remove the pin code from your sim card. <br><br>Let me know if this will work for you ;)<br><br>