WBUS-EMMC how to tell if it's present

The official PYBD running MicroPython, and its accessories.
Target audience: Users with a PYBD
Post Reply
mischko
Posts: 17
Joined: Tue Feb 03, 2015 12:32 am

WBUS-EMMC how to tell if it's present

Post by mischko » Fri Jun 21, 2019 3:33 am

This doesn't work in boot.py:

# Mount the WBUS-EMMC if it's there and set it up
mmc = pyb.MMCard()
if mmc.present():
import os
os.mount(mmc, '/mmc')
sys.path.append('/mmc')
pyb.usb_mode('VCP+MSC', msc=(mmc,))

The present() method returns False if the EMMC is present or not.
There does not appear to be a way to resolve this. the mmc.power(1) method never returns if it's not there. The mount() never returns if it's not there.
The info() method doesn't work ahead of mounting either.

This is a SF6W that I just received and it's working great otherwise.

I think this is a bug with the present() function. Any help would be greatly appreciated.

Scott

User avatar
jimmo
Posts: 427
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia

Re: WBUS-EMMC how to tell if it's present

Post by jimmo » Fri Jun 21, 2019 6:01 am

Yeah, the `present()` function is only implemented for SDCard. (But both SD and MM share the same type -- it's hardcoded to return false for MM).

I did notice the MMC's nRST line is connected to SD_SW. So SD_SW will be floating when not present, and high when present. Unfortunately setting the internal STM32 pull-down is too strong, so you're stuck trying to measure a floating pin. In practise this actually worked quite well - I got consistent results, but don't rely on it!

Code: Select all

>>> p = machine.Pin.board.SD_SW
>>> p.init(mode=machine.Pin.IN, pull=machine.Pin.PULL_NONE)
>>> p.value()
0
I'll raise a bug for this, at least might be good to fix on a future version of the WBUS-EMMC.

chuckbook
Posts: 91
Joined: Fri Oct 30, 2015 11:55 pm

Re: WBUS-EMMC how to tell if it's present

Post by chuckbook » Fri Jun 21, 2019 5:19 pm

Wouldn't the usual way be to just try mounting and evaluate except? EMMC is definitely not a hot-plug device.

Stevo52
Posts: 6
Joined: Sun Feb 03, 2019 10:28 pm

Re: WBUS-EMMC how to tell if it's present

Post by Stevo52 » Sat Jun 22, 2019 3:30 am

chuckbook wrote:
Fri Jun 21, 2019 5:19 pm
Wouldn't the usual way be to just try mounting and evaluate except? EMMC is definitely not a hot-plug device.
I have not fitted my WBUS-EMMC as yet but I am interested in this topic because I will start experimenting soon.

The WBUS-EMMC documentation states "This WBUS-EMMC replaces an SD-Card. It's not possible to use an SD card and the WBUS-EMMC together." so I figured that there must be something in the firmware that detects it and disables the SD card, but it sounds like that is NOT the case? Any comment from those who have used the EMMC board?

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

Re: WBUS-EMMC how to tell if it's present

Post by pythoncoder » Sat Jun 22, 2019 6:57 am

Apologies for asking a doubtless dumb question, but what is the benefit of an EMMC device over an SD card?
Peter Hinch

chuckbook
Posts: 91
Joined: Fri Oct 30, 2015 11:55 pm

Re: WBUS-EMMC how to tell if it's present

Post by chuckbook » Sat Jun 22, 2019 7:20 am

Where to start.. :)
Most important (for MCU applications) there is no need for flaky connectors.
But there are more:
- extended temperature range
- much more configuration options
- trade in space for reliability (SLC emulation)
- power efficiency
- space requirements
- better sourcing (who knows what' inside an SD card?)

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

Re: WBUS-EMMC how to tell if it's present

Post by pythoncoder » Sat Jun 22, 2019 7:53 am

Thank you.
Peter Hinch

Post Reply