soft-reset unreliable w/ SD card

Questions and discussion about The WiPy 1.0 board and CC3200 boards.
Target audience: Users with a WiPy 1.0 or CC3200 board.
User avatar
danicampora
Posts: 342
Joined: Tue Sep 30, 2014 7:20 am
Contact:

Re: soft-reset unreliable w/ SD card

Post by danicampora » Tue Nov 17, 2015 10:19 am

MikeStr was it working before the soft reboot fix? Or was the issue already present?

User avatar
danicampora
Posts: 342
Joined: Tue Sep 30, 2014 7:20 am
Contact:

Re: soft-reset unreliable w/ SD card

Post by danicampora » Tue Nov 17, 2015 10:22 am

@MikeStr: Are you also initializing the SD card in boot.py?

What happens if you try with the script from jcrfonera?

MikeStr
Posts: 6
Joined: Tue Nov 17, 2015 5:13 am

Re: soft-reset unreliable w/ SD card

Post by MikeStr » Tue Nov 17, 2015 7:38 pm

* 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?

User avatar
danicampora
Posts: 342
Joined: Tue Sep 30, 2014 7:20 am
Contact:

Re: soft-reset unreliable w/ SD card

Post by danicampora » Tue Nov 17, 2015 8:02 pm

@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?

MikeStr
Posts: 6
Joined: Tue Nov 17, 2015 5:13 am

Re: soft-reset unreliable w/ SD card

Post by MikeStr » Tue Nov 17, 2015 8:39 pm

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.

User avatar
danicampora
Posts: 342
Joined: Tue Sep 30, 2014 7:20 am
Contact:

Re: soft-reset unreliable w/ SD card

Post by danicampora » Tue Nov 17, 2015 9:30 pm

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

MikeStr
Posts: 6
Joined: Tue Nov 17, 2015 5:13 am

Re: soft-reset unreliable w/ SD card

Post by MikeStr » Tue Nov 17, 2015 10:34 pm

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.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: soft-reset unreliable w/ SD card

Post by pythoncoder » Wed Nov 18, 2015 8:14 am

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.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: soft-reset unreliable w/ SD card

Post by dhylands » Wed Nov 18, 2015 4:37 pm

+1 what @pythoncoder said

Post Reply