I am trying to use the drivers included with the SDK to add support for an SD card on the SPI bus. However, sdmmc, which is a dependency of the sdspi driver, will not build. Ultimately, I believe it comes down to the fact that the MK12DN512VLH5 does not have an SD host controller, and necessary header files are not provided in the SDK for the sdmmc libraries to build.
I presume that this is because the drivers were provided to support MCUs with host controllers, and not for just hanging an SD card on the SPI bus. However, I feel like I am missing something. I would certainly prefer not to spend time reinventing the wheel if I can just use the libraries already provided. I would think that I should be able to use the sdmmc libraries just for accessing the SD card, even if I don't have dedicated MCU pins for an SDHC.
Anyone have any experience with this?
Thanks!
Phil
Thanks for the suggestion, Felipe. I have several examples from other SD SPI implementations on other processors and found that they just don't marry up with the MK12 SPI drivers. Even when you manage to get them to compile and run, the MISO and MOSI (and possibly the PCS) lines aren't controlled properly. I did manage to work out the winning combination from the MK12 SDK code.
Only 3 files are needed from the SDSPI code in the MK12DN512 SDK (in addition to the SPI drivers): fsl_sdspi.c, fsl_sdspi.h, fsl_sdmmc_spec.h. Then, use sdspi.c as an example for initializing the SD card.
Do not include the sdmmc code because the MCU doesn't have a SD host controller.
Cheers!
Phil
Hi Phil,
As you mention K12 MCUs don't have SD Host controller.
However, if you want to give it a try, you could take the following documents as reference.
https://www.nxp.com/docs/en/application-note/AN10406.pdf
https://community.nxp.com/docs/DOC-330958
Please let us know your results.
Best regards,
Felipe
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------