chipKIT® Development Platform

Inspired by Arduino™

Sdcards with pic32mx/mz- CMD6 - HighSpeed SPI mode

Created Wed, 11 Nov 2015 15:25:41 +0000 by pito


pito

Wed, 11 Nov 2015 15:25:41 +0000

FYI - tried with CMD6 sdcard "switch" command on Fubarino SD and SDZL boards. Applicable for current CL10 (UHS-I) mainstream sdcards. SDZL worked 50MHz SPI, Fubarino 40MHz SPI (overclocked SPI) with Samsung Evo 8GB CL10 UHS-I. Needs more research and finetuning, the CMD6 allows to set: max SPI speed, max card power, sdcard's io drivers strenght and more. P.


majenko

Wed, 11 Nov 2015 15:41:51 +0000

This is looking stunningly amazing! I must try this out with my part-written Filesystem library for chipKIT - see what blistering speeds I can get with that...

How / where are you setting this CMD6 command? Any chance you can share your hack?


pito

Wed, 11 Nov 2015 17:08:52 +0000

Lazy programmers :lol: http://retrobsd.org/viewtopic.php?f=5&t=37313&p=42448#p42448 Mind it is just a quick naive hack I did, without knowing too much about what needs to be done, for verifying the today's $5 sdcards can run such speeds.

A full implementation means (my current naive understanding) - check with CMD6 (bit31=0) the sdcard's params (it returns R1 and 64bytes=512bits of data mess - see the SDcard Specification 4.1 - http://retrobsd.org/viewtopic.php?f=5&t=37313&p=42448#p42261 ), then only if the card is capable to run such speeds you may set max SPI (only 50MHz for 3.3V signalling allowed, up to 204 with 1.8V), set power (up to 2.88W!!), set card's drivers strengths, etc. Also mind the messing with sdcard's inner seems to be rocket science..

Then go with CMD6 (bit31=1) and set the highspeed mode and other stuff, ie. :

card_cmd(unit, 0x06, 0x80000001);

it shall return the R1 response and 512bits of statuses. Check the new statuses.

After additional 8 clocks (issued after reception of the 64bytes of statuses) the actual switch occurs and you may set ie. 50MHz SPI at pic32mz's side (or 25-30MHz at pic32mx's side) and go on.

For example your great pic32mz SDZL board under LiteBSD running a $5 sdcard (CL10 and up, but maybe CL6 too) @50MHz SPI:

# diskspeed
Testing 4-kbyte block size.
Write speed: 8 Mbytes in 3.725 seconds = 2199 kbytes/sec
 Read speed: 8 Mbytes in 2.398 seconds = 3416 kbytes/sec

The Fubarino SD worked @40MHz with the same sdcard, but not fully stable yet.

PS: anybody up there knowing the sdcard's driver's strength values? Seems the SD Spec Simplified does not want to disclose those params :cry: P.