Page 1 of 2

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.

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

Posted: Mon Oct 05, 2020 7:47 pm
by saulo
Stevo52 wrote:
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?
Micropython uses one storage to run the scripts inside, this is one reason to only mount 1 filesystem, the other reason is hardware:

The STM32F7 series have up to two SD/SDIO/MMC interfaces, there is one connected on murata 1DX wireless module (configured as 4bit bus) and another SDIO (also 4bits bus) are shared with SDcard and WBUS. I'm assuming a design choice by mr. George, since there will be high speeds for SDcard OR eMMC instead low speed for SDcard (using ordinary SPI interface (1 bit bus) for SD w/r) AND high speed for eMMC.

i don't think you can share SD/SDIO/MMC interfaces with 2 devices, DMA could become crazy with buffer control :(

I guess you can add another sdcard connector over an spi bus if you really need dual storage (there is need to drivers/filesystem modules to use it? i don't know if someone already did it or we can use native upython modules to do that), but you must use one of each original options to initialize the micropython correctly.

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

Posted: Mon Oct 05, 2020 8:57 pm
by Stevo52
That wasn't really what I was asking, I understand the benefits of EMMC and the single file system etc. My question was if it is not possible to use EMMC and SDCard together (as the documentation says), how is that detected/managed? I got around it with a try/except, checking for EMMC before the SD..

And I have added an external SD on SPI for user accessible card actions.

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

Posted: Tue Oct 20, 2020 7:42 pm
by Faloten
Dual storage is also possible as you told for that kind hardware spi (https://911electronic.com/spi-communica ... spi-works/) connections