VS1010 and eMMC

Designing hardware and software for systems that use the VS1010 MP3 Audio DSP Microcontroller.
rflores765
User
Posts: 15
Joined: Sun 2019-05-26 7:13

VS1010 and eMMC

Post by rflores765 » Mon 2019-08-05 3:46

Hello,

I've used the VS1010 with an eMMC in a design but there seems to be a communication issue between them. The VS1010 will send clock and commands to the eMMC but there is either no response or an incorrect response so higher clock speeds are not achieved. The initial clock frequency from the VS1010 is measured at 960 Khz but the spec for the eMMC states this should be 400 Khz max. I see the initial clock frequency is also 960Khz on the dev board with an SD card but the clock frequency later jumps to 15Mhz as expected. It has already been suggested to that I use a <5Mhz crystal to bring the initial clock frequency down to <400khz but while I wait for the parts to arrive, is there any other part of the design I should investigate?

Thanks,
Rodrigo

User avatar
Panu
VLSI Staff. Currently on holiday.
Posts: 2697
Joined: Tue 2010-06-22 13:43

Re: VS1010 and eMMC

Post by Panu » Mon 2019-08-05 22:09

Hi!

What does the console say (TX0 at 115200 bps) ?

Please dump the entire console output here, there may be valuable info in it!

-Panu
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

rflores765
User
Posts: 15
Joined: Sun 2019-05-26 7:13

Re: VS1010 and eMMC

Post by rflores765 » Sat 2019-08-10 6:20

Hi Panu,

Unfortunately, there is a hardware error. The CMD and CLK lines on the eMMC are swapped so this design was never going to work. It's a tight design but jumping the copper over to right orientation should be possible and I will try that tomorrow.

Attached is an image from Toshiba on the initialization sequence for the eMMC. For reference, here is the part number: THGBMNG5D1LBAIT

Once I have reworked the board, I'll provide the console output. So far it starts up in runlevel 2 ands with "SD:No ID."

Thanks,
Rodrigo
Attachments
eMMC_Init.png
eMMC_Init.png (42.49 KiB) Viewed 762 times

rflores765
User
Posts: 15
Joined: Sun 2019-05-26 7:13

Re: VS1010 and eMMC

Post by rflores765 » Mon 2019-08-12 1:23

So I have done some more testing and investigating. There is an error in the schematic where CMD and CLK are swapped. I am able to rework the board and correct the nets and also keep the pull-up on the CMD line. I have also swapped the 12.288 MHZ crystal with a 5 MHZ crystal. I am now seeing that the eMMC clock goes from 375KHZ for intialization to ~4.1MHZ and I am seeing data on DAT0. I have not tried again with a 12.288 MHZ crystal again

On the console I am seeing this:

C#n
VS1010D VSOS 4.20
Files:6
Buffers:3
SPIF: FFFF, none
Runlevel 2
SD: NO ID. S=SD

The Salae logic analyzer I am using doesn't have an analyzer built-in for SD/MMC communication so I can't simply read out which commands were sent before the clock speed changed. It also maxes out at 3MS/s so I can't capture the high-speed communication. I verified the clock speed and DAT0 data using an oscilloscope

User avatar
Panu
VLSI Staff. Currently on holiday.
Posts: 2697
Joined: Tue 2010-06-22 13:43

Re: VS1010 and eMMC

Post by Panu » Mon 2019-08-12 16:34

Hi!

Wow, nice picture! I wish I had one of those when we wrote the SD init nearly 10 years ago ;)
What's the voltage level on the CMD, SDCLK and DAT0 lines? And VCC?

-Panu
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

rflores765
User
Posts: 15
Joined: Sun 2019-05-26 7:13

Re: VS1010 and eMMC

Post by rflores765 » Mon 2019-08-12 21:14

Hi Panu!

Voltages are here:

eMMC is powered by a regulated 3.3V
VS1010 is powered with a max voltage of 4.2V
CMD and DAT0 are pulled up to regulated 3.3V
SDCLK is powered by IOVDD which is set to 3.3V but measured at 3.17V
All other VS1010 are default voltages.

Toshiba asked to confirm that CMD1 is sent repeatedly until the most significant bit is 1 before moving on to CMD2.

Thanks,
Rodrigo

rflores765
User
Posts: 15
Joined: Sun 2019-05-26 7:13

Re: VS1010 and eMMC

Post by rflores765 » Wed 2019-08-14 14:47

Hi Panu!

Would it be helpful or possible for me to send one of the boards to VLSI for testing the communication between the eMMC and the VS1010?

Thanks!
Rodrigo

User avatar
Panu
VLSI Staff. Currently on holiday.
Posts: 2697
Joined: Tue 2010-06-22 13:43

Re: VS1010 and eMMC

Post by Panu » Thu 2019-08-15 9:34

Hi!
Would it be helpful or possible for me to send one of the boards to VLSI for testing the communication between the eMMC and the VS1010
Yes, please do send it to us as soon as possible, I thought we already asked you to do this by email!
Toshiba asked to confirm that CMD1 is sent repeatedly until the most significant bit is 1 before moving on to CMD2.
Yes, it
- first tries 8 times to send CMD55_APP_CMD+ACMD41_SD_APP_OP_COND, which is CMD1 for SD cards
- then tries 8 times to send MMCCMD1_MMC_SEND_OP_COND, which is CMD1 for MMC cards
and repeats these steps until timeout occurs, maybe for 1 second or something like that. This can be seen in the function IDSDKard() in file devSdSd.c in the ROM source codes.

-Panu
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

User avatar
Panu
VLSI Staff. Currently on holiday.
Posts: 2697
Joined: Tue 2010-06-22 13:43

Re: VS1010 and eMMC

Post by Panu » Fri 2019-08-16 14:54

Found it. Or so it seems, at least.

Such a small bug, such bitter consequences.

Anyway, it turns out that the VSOS SD init doesn't set the proper device flags (PRESENT, OPEN, SEEKABLE, READABLE and WRITABLE) if it doesn't find a valid filesystem (e.g. FAT). This happens when the eMMC chip contains all zeros when it is shipped from the factory (we got a Toshiba eMMC and tested it). And the missing flags then prevent even the USB mass storage handler from using the disk. If one manually sets those flags and then calls the USB Mass Storage handler, it enumerates and works properly.

Ok, the problem is then: how to set it so that it works if the ROM cannot do it? And there's many possible ways. I already have one working: thru UART. I know you have UART at least in the test board from which you sent me the console output. So I wrote a small VSIDE program to invoke the USB so that it works.

Here's a screenshot of it working:
 
empty eMMC init with VS1010D.png
empty eMMC init with VS1010D.png (177.11 KiB) Viewed 663 times

How to run the code:
- Install and launch VSIDE.
- Extract to a folder and open the attached solution SDZeroIni.t
- Right-click "Solution 'SDZeroInit'" in the Solution Browser.
- Select "Properties" in the Pop-up menu to access the Solution Options (Not Project Properties):
 
VS1010D VSIDE autodetect COM port.png
VS1010D VSIDE autodetect COM port.png (204.29 KiB) Viewed 663 times
- From tab "Debugging", select "Autodetect". This will find the VS1010 and the UART cable. This Autodetection step must be done for this to work.
- Run the code by clicking the yellow triangle or from the menu: Debug -> Run (F5).
- Connect USB cable between your board and a PC.
- The PC will now allow you to format the disk to FAT, and after it is formatted, it should work normally without any further tricks.

-Panu
Attachments
arch-SDZeroInit-2019-08-16-15-21-InitEmptySdOrMMC.zip
VS1010D VSIDE Solution. Run with UART to enumerate an empty SD or eMMC card and allow it to be formatted using USB.
(14.92 KiB) Downloaded 6 times
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

User avatar
Panu
VLSI Staff. Currently on holiday.
Posts: 2697
Joined: Tue 2010-06-22 13:43

Re: VS1010 and eMMC

Post by Panu » Mon 2019-08-19 15:36

Hi!

Sorry, I am in a hurry, but here's a quick follow-up. I got your board and was able to run the formatter on it. I had to use the command line version of the debugger (VS3EMU) instead of the VSIDE because I had some problems connecting to the board and had to do it step by step. It may be due to the runlevel (2) or due to something else. Tomorrow I must check the voltages, if they are stable or not. Does the XTAL have the 1M resistor across XTALI,XTALO? The board is sometimes reluctant to start, it may be due to this, or due to reset or due to some voltage issues. But after successfully loading the flag patch, it formats and works correctly.
Loading with VS3EMU.png
Loading with VS3EMU.png (266.25 KiB) Viewed 625 times
Loading and running the patch... you might notice that I'm a little rusty when it comes to the command line debugger... :lol:

Next I wrote a small BOOT.DLX patch to boot the unit differently based on the button presses. I was able to detect S1 and S3 using the schematic Tuukka had. S1 forces it to mass storage, S3 forces it to player, others remain at default runlevel (2). This is what you would do in your product.. the SPI0 resistors set the default runlevel, but when the eMMC is formatted, the BOOT.DLX program is run and that program determines what the board does.
Playing with S3 pressed.png
Playing with S3 pressed.png (221.67 KiB) Viewed 625 times
Here's the board playing Life of Antarctica. Sounds good!

Right. So how to proceed? Since you're revisioning your board, there' s a couple of options on how to make it work with the current ROM version. What I can think of now, runlevel 1, Ramdisk mode, might be the easiest way to fix this. It would boot to USB ramdisk mode by default. There you can drop a hotpatch file that runs the formatting mode, and then work normally. Another possibility would be the USB Serial loader, runlevel 8. That boots to a mode where the VS1010 shows itself as a serial port which shows the VSOS prompt and a VSIDE compatible loader which can be used to load and run the formatter with VSIDE.

-Panu
Attachments
arch-boot-2019-08-19-16-35-Boot1.zip
BOOT.DLX for your board
(20.69 KiB) Downloaded 4 times
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

Post Reply