soft-reset unreliable w/ SD card
- danicampora
- Posts: 342
- Joined: Tue Sep 30, 2014 7:20 am
- Contact:
Re: soft-reset unreliable w/ SD card
MikeStr was it working before the soft reboot fix? Or was the issue already present?
- danicampora
- Posts: 342
- Joined: Tue Sep 30, 2014 7:20 am
- Contact:
Re: soft-reset unreliable w/ SD card
@MikeStr: Are you also initializing the SD card in boot.py?
What happens if you try with the script from jcrfonera?
What happens if you try with the script from jcrfonera?
Re: soft-reset unreliable w/ SD card
* The boot.py is empty other than the default comment.
* This is my first project involving a WiPy. I can say that the problem manifests in both
wipy-2015-10-31-v1.5-64-gf705cb5 and
wipy-2015-11-17-v1.5-142-ge4404fb level firmware.
* I am using a SanDisk 2 GB SD card.
* When I run jcrfonera's script (after changing wifi details at lines 15-16) as boot.py, the SD is mounted successfully. Yea!
However, making boot.py contain only a comment and running the script as main.py there is a failure at line 41 (os.mount...).
Puzzling evidence...why would the SD initialization and mounting attempts succeed in boot.py and reliably fail in main.py?
* This is my first project involving a WiPy. I can say that the problem manifests in both
wipy-2015-10-31-v1.5-64-gf705cb5 and
wipy-2015-11-17-v1.5-142-ge4404fb level firmware.
* I am using a SanDisk 2 GB SD card.
* When I run jcrfonera's script (after changing wifi details at lines 15-16) as boot.py, the SD is mounted successfully. Yea!
However, making boot.py contain only a comment and running the script as main.py there is a failure at line 41 (os.mount...).
Puzzling evidence...why would the SD initialization and mounting attempts succeed in boot.py and reliably fail in main.py?
- danicampora
- Posts: 342
- Joined: Tue Sep 30, 2014 7:20 am
- Contact:
Re: soft-reset unreliable w/ SD card
@MikeStr Ok, I'll investigate. Do you think you can send me your full script? Or is the snippet that you published before already enough to reproduce the problem?
Re: soft-reset unreliable w/ SD card
The boot.py should be the default single line comment.
Replace the contents of main.py with jcrfonera's script and adjust the wifi client settings at lines 15-16.
I usually connect with both telent and USB serial using putty from Windows.
Then Ctrl+D to perform a soft boot. I see the errors on the USB serial console.
Thank you for investigating.
Replace the contents of main.py with jcrfonera's script and adjust the wifi client settings at lines 15-16.
I usually connect with both telent and USB serial using putty from Windows.
Then Ctrl+D to perform a soft boot. I see the errors on the USB serial console.
Thank you for investigating.
- danicampora
- Posts: 342
- Joined: Tue Sep 30, 2014 7:20 am
- Contact:
Re: soft-reset unreliable w/ SD card
Sorry, I can't reproduce it. I have tried with the 3 SD cards that I have laying around, and I never get the error. All of them are bigger >= 4GBs... Can you try with a different SD card to check if the issue is related to that? Thanks.
Cheers,
Daniel
Cheers,
Daniel
Re: soft-reset unreliable w/ SD card
Thank you for investigating this. Is there any verbose debugging or logging I can enable?
I was working on this late into the night and I didn't take detailed notes or remember under which circumstances the call to the SD initializer failed as opposed to the os.mount call.
Since I have a work around (i.e. running from boot.py) this unexpected behavior is less of an impediment.
Is there much difference between hosting my code in boot.py or main.py?
I can easily split my event logger between those two files or put all of the code in boot.py.
I was working on this late into the night and I didn't take detailed notes or remember under which circumstances the call to the SD initializer failed as opposed to the os.mount call.
Since I have a work around (i.e. running from boot.py) this unexpected behavior is less of an impediment.
Is there much difference between hosting my code in boot.py or main.py?
I can easily split my event logger between those two files or put all of the code in boot.py.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: soft-reset unreliable w/ SD card
boot.py is intended for short setup scripts. Use main.py. Arguably better is to put your code in another file and have main.py import your file. This can simplify debugging: if your code fails you can comment out the import, reboot to get the REPL back and debug from there.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.