Read and write bytes less than 512 in K66 SD card

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Read and write bytes less than 512 in K66 SD card

1,050 Views
nikita_k
Contributor I

Hello,

I am using SDHC interface on K66 board ,where micro SD card has been inserted.

Sample application without any file system is working fine with 512 bytes block size.

I read in a K66 reference manual  that we can set block size anything from 1 byte to 4096 bytes in SDHC_BLKATTR register. 

When tried with setting block size as 4 bytes ,I am able to see write function returns success. However read to same 4 bytes block returns no data .

My queries are:

1. why setting block size other than 512 bytes does not work even though SDHC has support  (There is no file system)?

2.  Can I really change block size from 512 bytes ? If not why?

Please correct if my understanding is wrong, I am new to SD card drivers.

Thank you,

Nikita

Labels (1)
Tags (1)
0 Kudos
1 Reply

749 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi  Nikita:

Please refer to the comments from file sdcard_polling.c.

/* @brief decription about the read/write buffer
* The size of the read/write buffer should be a multiple of 512, since SDHC/SDXC card uses 512-byte fixed
* block length and this driver example is enabled with a SDHC/SDXC card.If you are using a SDSC card, you
* can define the block length by yourself if the card supports partial access.
* The address of the read/write buffer should align to the specific DMA data buffer address align value if
* DMA transfer is used, otherwise the buffer address is not important.
* At the same time buffer address/size should be aligned to the cache line size if cache is supported.
*/

Regards

Daniel

0 Kudos