SPI INTERFACING WITH KL25Z

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

SPI INTERFACING WITH KL25Z

跳至解决方案
2,742 次查看
arthshah
Contributor II

i want to just know about spi interfacing with kl25z.

anybody have code for this?

given in the ksdk 1.3.0 example code i can't understand it properly.

0 项奖励
回复
1 解答
2,099 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Arth Shah,

That code is the mdk project.

system_init() is:

void System_init(void)
{
    #ifdef CMSIS  // If we are conforming to CMSIS, we need to call start here
   start();
  #endif
    _UartTXreset();
    _UartRXreset();
}   

This function also in the kl26_sdfatfs.c.

If you don't use the CMSIS, you can just add:

    _UartTXreset();
    _UartRXreset();

This code is not important to the sd spi control.

Have a great day,
Kerry

 

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

在原帖中查看解决方案

0 项奖励
回复
24 回复数
2,015 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

HI Arth Shah,

    I have wrote a KL25 SPI code based on the register control, after you refer to the KL25 reference manual register description, it will more easy to understand.

   Please check my attachment, it include the KL25 SPI master and slave code, and includes both interrupt mode and polling mode.

   Wish it helps you!

  


Have a great day,
Kerry

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

0 项奖励
回复
2,015 次查看
arthshah
Contributor II

i am using kinetis Design studio.

Do you have any code for KDS?

0 项奖励
回复
2,015 次查看
BlackNight
NXP Employee
NXP Employee

Hi Arth,

I did something here with FatFS and the FRDM-KL25Z using KDS:

FatFS with Adafruit MicroSD Breakout Board and NXP FRDM-KL25Z | MCU on Eclipse 

Code is on GitHub (link at the end of the article).

I hope this helps,

Erich

0 项奖励
回复
2,015 次查看
arthshah
Contributor II

thanks Erich for the reply.

i refer your link.

thank you..!!

0 项奖励
回复
2,015 次查看
arthshah
Contributor II

hii Erich ..!

I think you are create a project using processor expert, when i select component and set them to our requirement, then code is generated automatically? 

0 项奖励
回复
2,013 次查看
BlackNight
NXP Employee
NXP Employee

Hi Arth,

yes, it is a Processor Expert project, the additional components are available from SourceForge, see McuOnEclipse Releases on SourceForge | MCU on Eclipse 

Erich

0 项奖励
回复
2,013 次查看
arthshah
Contributor II

thank you so much for instant response.

i edit new component from your provided link.

now my question is that from where i start for interfacing SD card to KL25Z because i am totally new in this controller.

any help would be appreciate.

0 项奖励
回复
2,013 次查看
BlackNight
NXP Employee
NXP Employee

Best if you start with that example project on GitHub.

0 项奖励
回复
2,013 次查看
arthshah
Contributor II

screen shot of github.github.png

0 项奖励
回复
2,012 次查看
arthshah
Contributor II

Here i attached screen shot of github project file list.

from t hat which file i open?

when i opened any file its show html file.

how can i use your project in my KDS?

thank you in advance.

0 项奖励
回复
2,015 次查看
arthshah
Contributor II

thank you kerry,

i want also file create ,file close in SD card using FAT is this possible ?

0 项奖励
回复
2,015 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Arth Shah,

    About the SD FATfs, you can refer to my post:

Porting FatFs file system to KL26 SPI SD card code 

Wish it helps you!


Have a great day,
Kerry

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

0 项奖励
回复
2,015 次查看
arthshah
Contributor II

hii kerry,

i tried your code for porting FATFS to KL25 SD card.

but there are some error that i cant solve,i need your help to solve that error.

 there are one function call system_init() in main.c. 

where is the definition of this function?

0 项奖励
回复
2,100 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Arth Shah,

That code is the mdk project.

system_init() is:

void System_init(void)
{
    #ifdef CMSIS  // If we are conforming to CMSIS, we need to call start here
   start();
  #endif
    _UartTXreset();
    _UartRXreset();
}   

This function also in the kl26_sdfatfs.c.

If you don't use the CMSIS, you can just add:

    _UartTXreset();
    _UartRXreset();

This code is not important to the sd spi control.

Have a great day,
Kerry

 

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

0 项奖励
回复
2,015 次查看
arthshah
Contributor II

hii kerry,

according to your provided link i have some confusion regarding header file.

header file's name kl26_sdfatfs.h there are some more header file is defined,

//#include "start.h"

//#include "sysinit.h"
//#include "hal_i2c.h"
//#include "pit.h"
//#include "ftfa.h"
//#include "pmc.h"

these files are important in SD FATFS project?

currently i comments this files then build again there is no errors right now.

but one more question is there In common.h header file i am getting error like "No valid platform defined". 

0 项奖励
回复
2,015 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Arth Shah,

    I am a little overloaded now.

    When I have time, I will help you to create the KDS project, then reply you in your new post.

  Please wait patiently now.

#include "start.h", this is the head file for start.c, used for the mcu start configuration. If you already add the according code, just comment it.

/#include "sysinit.h", this is the head file for sysinit.c, used for the mcu initialization. if you already add the according code, comment it.
//#include "hal_i2c.h", you don't need to care about it, just comment it.
//#include "pit.h", comment it, no use for SD card.
//#include "ftfa.h", flash head file, no use for SD card, comment.
//#include "pmc.h", no use for SD card, comment it.

Actually, you can refer to the CW project, if the CW project include it, you can add it, otherwise, just comment it.


Have a great day,
Kerry

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

0 项奖励
回复
2,015 次查看
arthshah
Contributor II

thank you kerry,

no problem ..!!

whenever you free reply to my new post.

thanks once again for the help..

0 项奖励
回复
2,015 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hello Arth Shah,

   Check your another post, I already reply you in that post.

SD card interfacing with KL25Z 

  You can use my attached KDS project.

Wish it helps you!


Have a great day,
Kerry

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

0 项奖励
回复
2,015 次查看
arthshah
Contributor II

hii

i have other problem in common.h file, in this header file there is a include of platform specific header file, i dont have specific header file.. i add freedom.h but stil i get an error "No valid platform defined"

what should i do?

0 项奖励
回复
2,015 次查看
arthshah
Contributor II

hii kerry,

thanks for the reply.

i found that system init() in kl26fatfs.c.

As you said this code is not important to the Sd Spi control,so please tell me which header file i m use in my project?

In main function system init() is called, so i comment this fun call??

0 项奖励
回复