0

Metro M4 SD card
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Metro M4 SD card

by lond on Sun Jul 08, 2018 8:22 am

I'm planning to move one of my current project to the "M4"-flavor and I have the following questions:

Can I increse the speed of the R/W on a SD-card? Can I use DMA?
Can I instead of a SD-card increase the size of the onboard SPI memory? Or replace the SPI memory with a SD-card?
What is the R/W speed of the onboard SPI memory? What is the expected lifetime of the SPI memory?

/// Marcus

lond
 
Posts: 2
Joined: Sat Jul 07, 2018 8:26 am

Re: Metro M4 SD card

by adafruit_support_mike on Tue Jul 10, 2018 3:53 pm

SD cards have two data interfaces: the high-speed one that you have to be a dues-paying member of the SD Association to use (and then can only use under the terms of an NDA), and a basic SPI interface.

The SPI interface has gotten faster as the cards have evolved, mostly because the Flash arrays and microcontrollers inside the cards have gotten faster. It takes more work to slow those pieces down, and isn’t worth the effort.

The maximum transfer rate varies from one manufacturer to the next, but the ultimate limit will be the SPI speed of either the microcontroller you program or the one in the card. The M4’s maxium SPI rate is pretty fast, so you should probably see some improvements when you do lots of large reads.

The maximum rate for writes is limited by the Flash array, and will be at least a couple orders of magnitude slower than the SPI rate. Speeding up the communication between the microcontroller and the card will have a negligible effect there.

You can try doing DMA if you want to go past the M4’s SPI rate, but you’ll have to configure the output as an SPI channel.

adafruit_support_mike
 
Posts: 52085
Joined: Thu Feb 11, 2010 2:51 pm

Re: Metro M4 SD card

by westfw on Thu Jul 12, 2018 3:07 am

the SAMD51 has a SD/MMC Host Controller (SDHC) peripheral. Does that mean that Atmel (Microchip) has "paid the dues", or does each end-product that wants to use have to join up as well?
(It looks like it uses the same pins as the QSPI interface (plus more?), so it wouldn't be available on the Metro M4 anyway, but I curious about the licensing issues.)
User avatar
westfw
 
Posts: 1420
Joined: Fri Apr 27, 2007 1:01 pm
Location: SF Bay area

Re: Metro M4 SD card

by adafruit_support_mike on Thu Jul 12, 2018 3:46 am

From what I can tell, you still have to pay to play.

The Simplified Specification is available here:

https://www.sdcard.org/downloads/pls/

and while they say it's the non-confidential version, the document you download is full of sections like this:

8.1.3 Interrupt Period Definition
This section is not included in the Simplified Specification.

Figure 8-1 : Continuous Interrupt Cycle
8.1.4 Interrupt Period at the Data Block Gap in 4-bit SD Mode (Optional)
This section is not included in the Simplified Specification.

8.1.5 End of Interrupt Cycles
This section is not included in the Simplified Specification.

8.1.6 Terminated Data Transfer Interrupt Cycle
This section is not included in the Simplified Specification.

The SAMD51 contains the registers listed in the spec (they'll tell you what those are), but to develop or distribute code that uses the registers, it looks like you need the complete/confidential spec.

In that sense, it would be like the Bluetooth Classic features of the ESP32: the hardware is there, but to use it you have to pay the working group for a vendor ID number.

adafruit_support_mike
 
Posts: 52085
Joined: Thu Feb 11, 2010 2:51 pm

Re: Metro M4 SD card

by alkire on Sat Jul 28, 2018 9:17 pm

I rewrote the SDHC driver for the SAMD51 and have FatFS working. It does work reliably but... it was slow.
The data sheet is vague on the SDHC and missing crucial performance data. Requiring an NDA might explain a lot.

Even at full clock rate, Read 512 byte block Transfers was 637KB/s. That is, the measurement was from the time the command to read a block is sent to when the buffer is ready to read was 784usec. I used the TCC register with software events for timestamp on a custom board to measure this. It probably would be better to use the SERCOM as SPI master for talking to a MicroSD than the SDHC.
I asked Microchip about the performance with a similar timed example from their FatFS example on the E54 dev board. Microchip is usually pretty good at getting back to me although this question was asked in May and is still at the MCHP Internal Feedback stage of response.
So we decided to drop the MicroSD from our product.
Bob

alkire
 
Posts: 5
Joined: Mon Feb 12, 2018 3:04 pm

Re: Metro M4 SD card

by lond on Mon Aug 06, 2018 7:14 am

I would like to share my current design of my 10-DOF data logger:
It's currently based on the M0 platform.

Image

Image

Image

Image

And now the new design based on the M4 that I'm working on:

v9_a.png
v9_a.png (82.12 KiB) Viewed 45 times


Due to the speed limit of the SD-card, my thought is to use the SPI-memory in the M4-design as a buffer for the data and after the measurement is complete move the information to the SD-card. Or is the the SPI-memory in a formated state and it also suffer speed limitations? Can I increase the size of the SPI-memory? Should I add a extra SPI-memory to the "normal" SPI-bus?

/// Marcus

lond
 
Posts: 2
Joined: Sat Jul 07, 2018 8:26 am

Re: Metro M4 SD card

by alkire on Mon Aug 06, 2018 5:34 pm

I wrote an article on the SDHC on the D5x and E5x processors here -> http://alkgrove.com/index.php/2018/08/0 ... md51-sdhc/

You can try out the SDHC on the E54 Xplained development board with the FatFS example on start.atmel.com and see if it performs as you would like. Adafruit added external memory using the QSPI interface on their dev boards. Since it can do execute in place (ala ESP32), the performance is probably decent. I haven't tried it yet, but would look there for an external memory interface.


Bob

alkire
 
Posts: 5
Joined: Mon Feb 12, 2018 3:04 pm

Please be positive and constructive with your questions and comments.