I am currently working on a device with ATSAME70Q21 what measures 144 channels of ADC values on an SD card (MCI interface). Each measurement takes up a 512Byte block data on the SD.

I do not use a filesystem on the SD card. I am using a micro SDHC card with UHS speed class 3 and video speed class mark 30.

For the SD card handling I am using the sd_mmc.c library (http://asf.atmel.com/docs/latest/samc20/html/sd__mmc_8c.html)

Currently it is working with 1kHz sampling time, but I need 10kHz with the possibility to make 10-12 hours long measurements. The measuring of the channels takes about 50us, the SD card write of a block should take the same amount (under 100us measure and save time needed for the 10kHz samping)

Currently I am using the:

sd_mmc_init_write_blocks(uint8_t slot, uint32_t start, uint16_t nb_block) To start a measurement

sd_mmc_start_write_blocks(const void *src, uint16_t nb_block) To write the block values on the SD after a measurement

sd_mmc_wait_end_of_write_blocks() To end a measurement.

My problem is that this init write block has to be called after every 65535. data has been written, but it takes up too much time and does not make the 10kHz sampling avaible.

As I investigated further in the hpl_hsmci.c file I found that in the

_mci_sync_adtc_start(struct _mci_sync_device *const mci_dev, uint32_t cmd, uint32_t arg, uint16_t block_size, uint16_t nb_block, bool access_block)

Function there is an SD command next to the Single Block write and Multi Block write called Stream.

I did not found any information on the internet regarding how this streaming command can be used and with what argument should be sent to the SD card.

Can someone point me to a detailed documentation regarding the commands and usage of the SD card commands? Or maybe send an example of the SD card data streaming?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.