Problems reading SDCard with MFS on Kinetis K60 tower board

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

Problems reading SDCard with MFS on Kinetis K60 tower board

Jump to solution
2,250 Views
BrianH
Contributor I

I have been working on adding the ability to serve webpages off of the SDCard and have run into trouble with files that are over a certain length.  The larger files such as the HTML and .GIF files are getting corrupted.  I am trying to run from the code I got from a Kinetis seminar last week.  It is based on Lab 5 - Kinetis Webserver.  I was using a web proxy to see what the server was returning for each file so I could see the exact contents of what was returned for each file.

 

To take the webserver out of the picture I went in through the shell and did a copy of one of the .GIF files.  I can remove the SDCard from the tower board and view the original file normally with a card reader on my PC but the copied file shows up the same as the corruption through the webserver so I figure it must be in the MFS portion of the code.  It seems to be corrupting a few bytes at a time approx 512 bytes apart throughout the file.   The corruption is not consistent although seems to follow the same basic trend.  The file size seems to always come out right but bytes in the middle are corrupted.

 

I am using IAR 6.10.2 with MQX  3.6.2.

 

Thanks for any help in advance...

Brian Haupt

Labels (1)
Tags (1)
0 Kudos
1 Solution
644 Views
PetrL
NXP Employee
NXP Employee

Hi Brian,

 

MQX 3.6.2 SD Card driver for Kinetis (SDHC) has set very high communication speed. This speed can be a problem for some slower SD card . Please try to decrease the speed in the sdhc conf structure (mqx/bsp/<board>/init_sdhc0.c file).

 

const ESDHC_INIT_STRUCT _bsp_esdhc0_init = {

    0,                          /* ESDHC device number */

    25000000,                   /* ESDHC baudrate      */  >>>>>>>>>>>>>>> change this to the 4000000 <<<<<<<<<<

    BSP_SYSTEM_CLOCK            /* ESDHC clock source  */

};

 

In future MQX versions we are planing to add automatic SD card speed setting to the driver (driver would negotiate the speed with card and set the highest supported)

Regards,

PetrL

 

 

 

View solution in original post

0 Kudos
3 Replies
645 Views
PetrL
NXP Employee
NXP Employee

Hi Brian,

 

MQX 3.6.2 SD Card driver for Kinetis (SDHC) has set very high communication speed. This speed can be a problem for some slower SD card . Please try to decrease the speed in the sdhc conf structure (mqx/bsp/<board>/init_sdhc0.c file).

 

const ESDHC_INIT_STRUCT _bsp_esdhc0_init = {

    0,                          /* ESDHC device number */

    25000000,                   /* ESDHC baudrate      */  >>>>>>>>>>>>>>> change this to the 4000000 <<<<<<<<<<

    BSP_SYSTEM_CLOCK            /* ESDHC clock source  */

};

 

In future MQX versions we are planing to add automatic SD card speed setting to the driver (driver would negotiate the speed with card and set the highest supported)

Regards,

PetrL

 

 

 

0 Kudos
644 Views
athies
Contributor II

HI PetrL,

 

Please could you let me know if there is any baremetal driver for the SDHC to supply to a customer that just wants to see how it works and possibly use in there application. This is on a K60 device.

 

He needs to port his filesystem to run on the K60 and thus he needs to write a driver for the Secure Digital Host Controller peripheral. 

 

Having a proper example driver will help tremendously with this task, but I see that there is no driver for the SDHC in the example code that is  provided by Freescale on the web.  In fact there seems to be quite a lot of peripherals for which there is no example driver?

 

What would you recommend as they are not using the MQX OS they have their own OS.  

 

 

Thanks

 

Andrew

0 Kudos
644 Views
BrianH
Contributor I

Thanks for your help.  It worked great.

0 Kudos