Low level SD Card acces

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Low level SD Card acces

跳至解决方案
2,975 次查看
Kuroro
Contributor II

Hi

 

I take a look on the example provided with MQX who demonstrate how to use the board as a USB masse storage device, this example allow to read and write to a part of the ram from the computer like any other thumb drive.

My goal is to do the same thing but no from flash but from a sd card.

When i look on how the example work it look simple, the computer directly ask to the board to read a zone of memory by furnishing an offset to the start from the start of the memory.

The probleme is that MQX by default only provide Hight level function who only allow to acces to the file level of the SD card.

So i would like to know if low level function are available an how to use it, when i look into the MQX code i saw some sectore_read function but i can't make it work.

 

Thank's

Best regard 

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
2,007 次查看
PetrM
Senior Contributor I

Check mfs sdcard example.

You need to install sdcard driver, open the driver, so the sdcard gets initialized and then you can use functions like fseek, fread, fwrite that are 512B sector based - fread (buffer, 1, 1, sdcard_fd) reads 1 sector = 512B.

 

Regards,

PetrM

 

在原帖中查看解决方案

0 项奖励
回复
7 回复数
2,008 次查看
PetrM
Senior Contributor I

Check mfs sdcard example.

You need to install sdcard driver, open the driver, so the sdcard gets initialized and then you can use functions like fseek, fread, fwrite that are 512B sector based - fread (buffer, 1, 1, sdcard_fd) reads 1 sector = 512B.

 

Regards,

PetrM

 

0 项奖励
回复
2,007 次查看
Kuroro
Contributor II

Hi PetrM

 

Thank's for you're help, I used it on a mcd52259 and taht work fine i was able to used the usb msd with the SD card.

 

I tried to used the same code with a K60 and MQX 3.7 EAR V2 and that don't work , the fread function do not return data, did they have a special way to implement it on kinetis ?

 

Thank's 

Best regard

0 项奖励
回复
2,007 次查看
danielchai
Senior Contributor I

Hi,

When you did MSD on SD card, how did you solve the problem that read from SD card is 512 bytes and  read from USB is 64 bytes?

Thank you.

-Daniel

0 项奖励
回复
2,007 次查看
pramodk_g_
Contributor III

Hi,

               I have the code for USB SD card - MSD and it is working. My problem is data transfer speed over usb is very slow.How i can improve this?

Thanks,

Pramod.

0 项奖励
回复
2,007 次查看
PetrM
Senior Contributor I

The usage should be the same on all platforms, so it's more likely a bug in pre-release code.

Does the original sd card example work for you on K60?

BTW: It should use ESDHC low level communication and onboard sd slot by default...

 

PetrM

 

0 项奖励
回复
2,007 次查看
Kuroro
Contributor II

Thank's for you're answer

 

it was a mistake from my side (run a empty program on the mcf51 embedded on the lcd board solve the problem)

 

I do some test and i got a very low bandwitch (about 400 Ko/s) from SD to USB

 

Actually I have the ESDHC port runing a full speed (25Mhz) but i can't set the usb to Hight speed mode on K60, I had some compilation issue apparently the K60 HS is no supported on MQX 3.7 they have a solution to have USB hight speed on MQX with K60 ?

 

Best regard

2,007 次查看
PetrL
NXP Employee
NXP Employee

Hi,

current K60 processor supports only USB full speed.

 

PetrL

 

0 项奖励
回复