SDHC Problem with MK64

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

SDHC Problem with MK64

Jump to solution
5,620 Views
pedroortegasanz
Contributor I

We are developed system using a MK64FN1MOVL012, with Code Warrior 10.6.

 

The hardware and software are 100% tested using MK60. (Attached you can find the schematics)

 

The problem is that the method SDHC_GetCrdInfo() does not return nothing, there is  a time _out.

Perhaps, the problem  is in the previous method SDHC_SelectCard()… I don´t know.

 

Attached, there is a small project  (demo SDHC for K60, changed for K64) tested in the same board with mk60.

 

Do you have any idea?

 

Thanks in advance

 

0 Kudos
1 Solution
1,435 Views
BlackNight
NXP Employee
NXP Employee

Hi Pedro,

finally I have found the issue, and indeed somehow this is a 'déja vu' (USB CDC with the FRDM-K64F, finally! | MCU on Eclipse ): on the K64F the MPU needs to be disabled to have SDHC working.

You have to add the following (e.g. to main()):

  MPU_CESR = 0; /* K64F has memory protection unit, disable it! */

I have updated the component (subject of a next release) with an extra setting for this:

pastedImage_3.png

Attached is that updated component if you want to use it.

I have attached for you a CW for MCU 10.x project. You find the same project on GitHub: mcuoneclipse/Examples/CodeWarrior/FRDM-K64F/FRDM-K64F_FatFS at master · ErichStyger/mcuoneclipse · G... 

I hope this helps,

Erich

View solution in original post

0 Kudos
17 Replies
1,434 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

I checked attached schematics without any problem, which is quite similar with FRDM-K64F board.

The only difference is FRDM-K64F use PTE6 pin as SD_CARD_DETECT, you board use PTE28 instead.

I would recommend customer to refer MCUXpresso SDK software package for FRDM-K64F board, which is using MCUXpresso IDE software instead of CodeWarrior IDE.

The SD card demo could be found with below path:

..\FRDM-K64F\boards\twrk64f120m\driver_examples\sdcard\interrupt


Have a great day,
Mike

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
1,434 Views
pedroortegasanz
Contributor I

Hi Hui_Ma.

Thanks for your answer.

But I have a big project (with lot of lines of code) done and working with with Code Warrior (and ARM build tools FREESCALE), I need replace the current MCU with MK64 in order to have more memory, (needed for new functuanality) and will be very complicate change to another IDE, (The time to market is a critical pont in this project)


Do know any issue and workarround to fix this problem?


Thanks in advance for your help.

0 Kudos
1,434 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

I checked you attached [SDHC] project with below error info:

pastedImage_1.png

pastedImage_2.png

Customer could refer Processor Expert [SDHC] demo example at CodeWarrior installation folder with below path:

C:\nxp\CW MCU v10.7\MCU\CodeWarrior_Examples\Processor_Expert\Kinetis\TWR-K60N512\SDHC

Wish it helps.


Have a great day,
Mike

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
1,434 Views
pedroortegasanz
Contributor I

Hi Hui_Ma.

 

Attached you can find the proyect whitout errors, but the problem persist……

The example is copyed from

C:\Freescale\CW MCU v10.6.4\MCU\CodeWarrior_Examples\Processor_Expert\Kinetis\TWR-K60N512\SDHC

But adapted to MK64F

 

Do do have any idea?

 

Thanks in advance for your sure help.

 

Regards

 

 

0 Kudos
1,435 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Pedro,

First of all, sorry for the later reply.

I did a test and I also couldn't get the SD card info with Processor Expert [SDHC_LDD] SDHC_GetCardInfo() function.

There always mentioned "ERROR Demo application timeout".

pastedImage_1.png

I need to check this issue with Processor Expert software team.

While, as you know also, we put lots of resources on MCUXpresso SDK software package development for NXP MCU products so far.

We would recommend customer to select using MCUXpresso SDK package for K64 product to do SDHC application at first. There also provide the MCUXpresso IDE software as related IDE tool.

Thank you for the understanding.


Have a great day,
Mike

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
1,435 Views
pedroortegasanz
Contributor I

Hi Hui Ma.

Thank so much for your answer.

For me and my company would be a huge problem to migrate al design to MCUXpresso. For this reason it is very import that you and your colleges of Processor Expert Team, found the issue and propose a workaround in order to avoid this problem.

Only for your information, I want to tell you that a big project, with a big amount of devices are waiting for the fix. (30K unit per year)

One more time thanks for your effort and support.

Best Regards

De: Hui_Ma <admin@community.nxp.com>

Enviado el: jueves, 20 de septiembre de 2018 4:58

Para: Ortega Sanz Pedro <pedro.ortega@thyssenkrupp.com>

Asunto: Re: - Re: SDHC Problem with MK64

NXP Community <https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg>

Re: SDHC Problem with MK64

reply from Hui_Ma<https://community.nxp.com/people/Hui_Ma?et=watches.email.thread> in Kinetis Microcontrollers - View the full discussion<https://community.nxp.com/message/1059462?commentID=1059462&et=watches.email.thread#comment-1059462>

0 Kudos
1,435 Views
BlackNight
NXP Employee
NXP Employee

Hi Pedro,

I have SDHC working on the FRDM-K64F and Processor Expert working fine with Kinetis Design Studio and with MCUXpresso IDE. But as you are using CodeWarrior, I have ported a project to 10.7 (or 11.0 if you want).

I have put the project on GitHub: mcuoneclipse/Examples/CodeWarrior/FRDM-K64F/FRDM-K64F_FatFS at master · ErichStyger/mcuoneclipse · G... 

I don't understand why (I must be missing something?) SDHC fails with such a timeout on the K64F with CodeWarrior for MCU 10 (it works fine with the newer IDEs and with other targets. CodeWarrior is using an old compiler with an older Processor Expert, so it might be somehow a compiler issue too. I have compared the sources and not found any difference. But it works fine in SPI mode. I have attached for you the project just in case this helps (note that it is using some extra Processor Components (see McuOnEclipse Components: 1-July-2018 Release | MCU on Eclipse ), or have a look at Tutorial: Data Logger with the FRDM-K64F Board | MCU on Eclipse .

I hope this helps,

Erich

0 Kudos
1,435 Views
pedroortegasanz
Contributor I

Hi Erich.

I prefer to use the SDHC controller of MCU because I suppose that speed will be higher than using SPI.

Is there any possibility to make work the MCU using processor Expert and CW 10.x?

Best regards

De: BlackNight <admin@community.nxp.com>

Enviado el: domingo, 23 de septiembre de 2018 15:29

Para: Ortega Sanz Pedro <pedro.ortega@thyssenkrupp.com>

Asunto: Re: - Re: SDHC Problem with MK64

NXP Community <https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg>

Re: SDHC Problem with MK64

reply from Erich Styger<https://community.nxp.com/people/BlackNight?et=watches.email.thread> in Kinetis Microcontrollers - View the full discussion<https://community.nxp.com/message/1060379?commentID=1060379&et=watches.email.thread#comment-1060379>

0 Kudos
1,435 Views
BlackNight
NXP Employee
NXP Employee

Hi Pedro,

yes, I believe this is possible. It is all about to find the detail what is different and does not make it work.

Erich

0 Kudos
1,435 Views
pedroortegasanz
Contributor I

Hi Erich.

I have tested the Project (FatFS on FRDM-K64F) and the speed achieved is not enough for our system. Attached you can find the benchmark performed over SD card.

Any idea in order to work using the SDHC controller of MK64 and processor expert?

Thanks in advance.

Best Regards.

De: BlackNight <admin@community.nxp.com>

Enviado el: lunes, 24 de septiembre de 2018 19:26

Para: Ortega Sanz Pedro <pedro.ortega@thyssenkrupp.com>

Asunto: Re: - Re: SDHC Problem with MK64

NXP Community <https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg>

Re: SDHC Problem with MK64

reply from Erich Styger<https://community.nxp.com/people/BlackNight?et=watches.email.thread> in Kinetis Microcontrollers - View the full discussion<https://community.nxp.com/message/1060608?commentID=1060608&et=watches.email.thread#comment-1060608>

0 Kudos
1,435 Views
BlackNight
NXP Employee
NXP Employee

Hi Pedro,

what magnitude of speed did you had in mind? I did not look at how to optimize the SPI speed (I believe it woudl be faster with the SPI_LDD component, but I have not checked).

Erich

0 Kudos
1,435 Views
pedroortegasanz
Contributor I

Hi Erich.

In the previous design (with MK60), we achieved up to 400 Kbytes per second (SDHC @ 25 MHz and using 4-bit mode).

In order to avoid this problem, (SDHC with PE and MK64), Do you think that if we use MK63 instead MK64, the problem will be solved?

(There is a MK63 with the same memory 256 KB / 1M and same speed that MK64 and perhaps will be valid for our system)

Regards

De: BlackNight <admin@community.nxp.com>

Enviado el: martes, 25 de septiembre de 2018 17:26

Para: Ortega Sanz Pedro <pedro.ortega@thyssenkrupp.com>

Asunto: Re: - Re: SDHC Problem with MK64

NXP Community <https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg>

Re: SDHC Problem with MK64

reply from Erich Styger<https://community.nxp.com/people/BlackNight?et=watches.email.thread> in Kinetis Microcontrollers - View the full discussion<https://community.nxp.com/message/1061096?commentID=1061096&et=watches.email.thread#comment-1061096>

0 Kudos
1,436 Views
BlackNight
NXP Employee
NXP Employee

Hi Pedro,

finally I have found the issue, and indeed somehow this is a 'déja vu' (USB CDC with the FRDM-K64F, finally! | MCU on Eclipse ): on the K64F the MPU needs to be disabled to have SDHC working.

You have to add the following (e.g. to main()):

  MPU_CESR = 0; /* K64F has memory protection unit, disable it! */

I have updated the component (subject of a next release) with an extra setting for this:

pastedImage_3.png

Attached is that updated component if you want to use it.

I have attached for you a CW for MCU 10.x project. You find the same project on GitHub: mcuoneclipse/Examples/CodeWarrior/FRDM-K64F/FRDM-K64F_FatFS at master · ErichStyger/mcuoneclipse · G... 

I hope this helps,

Erich

0 Kudos
1,435 Views
pedroortegasanz
Contributor I

Hi Erich.

Adding MPU_CESR = 0 to my code, the SD cards works perfectly.

Thank so much for your help and support.

Pedro.

De: BlackNight <admin@community.nxp.com>

Enviado el: domingo, 30 de septiembre de 2018 11:26

Para: Ortega Sanz Pedro <pedro.ortega@thyssenkrupp.com>

Asunto: Re: - Re: SDHC Problem with MK64

NXP Community <https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg>

Re: SDHC Problem with MK64

reply from Erich Styger<https://community.nxp.com/people/BlackNight?et=watches.email.thread> in Kinetis Microcontrollers - View the full discussion<https://community.nxp.com/message/1063041?commentID=1063041&et=watches.email.thread#comment-1063041>

0 Kudos
1,435 Views
BlackNight
NXP Employee
NXP Employee

Hi Pedro,

I have to spend time on the weekend to investigate to find the issue or difference. I don't have a K63 so I don't know if the same problem exists. Somehow I have a deja-vu as I was bumping into a very similar strange thing on the K64F in the past, so I have to dig into this a bit. I'll let you know or maybe contact you directly if I find out something.

Erich

0 Kudos
1,435 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Pedro,

Thank you for the info.

I will let you know when the software team with feedback.


Have a great day,
Mike

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
1,435 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Pedro,

I will using CW V10.7 with TWR-K64F120M board to do a SDHC test next week.

I will let you know the test result later.

Thank you for the patience.


Have a great day,
Mike

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos