PEx SDHC is broke

cancel
Showing results for 
Search instead for 
Did you mean: 

PEx SDHC is broke

471 Views
audi_mcavoy
Contributor IV

Using Processor Expert to setup SDHC under KDS 3.0 with KSDK 1.2 is broke.

 

Steps to reproduce. . .

 

Create a new project

1) File > New > Kinetis Project

2) Project Name: sdhc_broke, next

3) Boards > Kinetis > FRDM-K64F, next

4) KSDK 1.2.0 (absolute path), Processor Expert (standalone), next

5) GNU C Compiler, finish

 

Add SD Card component

1) Add component from: Components Library > KSDK 1.2.0 > Peripheral Drivers/HAL > Memories > fsl_sdcard

 

Build Project

1) Generate PEx Code

2) Edit Sources | main.c

3) Uncomment the "for(;;) { }" statement on line 52, save

4) Build Debug version

 

Debug project and observe behavior

1) Insert Transflash card

2) Debug project (wait for automatic pause at PE-low_level_init())

3) Resume (see Thread #1 running in Debug window)

4) wait a few seconds, then Pause

 

You will notice that the processor never reaches our for(;;) loop.  It is always stuck at SDHC_HAL_GetCurState() in fsl_sdhc_hal.c .

 

- Audi

Labels (1)
4 Replies

126 Views
audi_mcavoy
Contributor IV

Okay, so if you're still reading this thread then you're probably interested in reading the steps to make this work.  Here's my notes. . .

  Adding an "*:fsl_sdcard component will also add a referenced "*:fsl_sdhc" component

  HOWEVER, neither component fully configures the SDHC pins to be functional

    Add an "*:Init_PORT" component

    Select the PORTE device

    Configure pins 1 through 5 as pull-ups with high drive strength

  ALSO!  You have to guarantee that the "*:fsl_sdcard" component is initialized before any dependent components

  For example, if an SD card is going to be used by an OS_Task then perform the following steps

    Go to Window > Show view > Other > Processor Expert > Initialization Sequence

    Enable the initialization order for the "*:fsl_sdcard" and the "*:OS_Task"

    Ensure "*:fsl_sdcard" is first and "*:OS_Task" is second

I hope that helps someone else.

And again, thanks to everyone that helped me!

126 Views
ivadorazinova
NXP Employee
NXP Employee

Hello Audi  McAvoy,

I tried on my side and it works without problems. I have 8GB microSDHC Card and is formatted as FAT file system,

please, try

  • again format the SD Card
  • try another card.

I hope this helps,

Iva

0 Kudos

126 Views
audi_mcavoy
Contributor IV

Thanks for the reply.

Did you follow my steps exactly?  Or did you do some "value added" work?  Because I repeated my steps exactly using my custom board with a FAT formatted 1GB SD card (actual SD, not microSD) and I get exactly the same bad behavior as I observed on my FRDM-K64F with an 8GB microSD.

Are you making any changes to the fsl_sdcard component in PEx?

0 Kudos

126 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Audi McAvoy:

Please try with my suggestion in your other thread: Re: fsl_sdhc_driver Stuck at SDHC_HAL_GetCurState()

Let us know if that helps.

Regards!

Jorge Gonzalez