Page 1 of 1

WBUS-EMMC how to tell if it's present

Posted: Fri Jun 21, 2019 3:33 am
by mischko
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

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

Posted: Fri Jun 21, 2019 6:01 am
by jimmo
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.

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

Posted: Fri Jun 21, 2019 5:19 pm
by chuckbook
Wouldn't the usual way be to just try mounting and evaluate except? EMMC is definitely not a hot-plug device.

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

Posted: Sat Jun 22, 2019 3:30 am
by Stevo52
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?

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

Posted: Sat Jun 22, 2019 6:57 am
by pythoncoder
Apologies for asking a doubtless dumb question, but what is the benefit of an EMMC device over an SD card?

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

Posted: Sat Jun 22, 2019 7:20 am
by chuckbook
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?)

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

Posted: Sat Jun 22, 2019 7:53 am
by pythoncoder
Thank you.