Porting SPI Driver to Keil RL-ARM System: RecBuf

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

Porting SPI Driver to Keil RL-ARM System: RecBuf

580 次查看
tfrauenrath
Contributor III

My task is to port a NXP SPI driver delivered with Keil RL-ARM to my Kinetis K60 system. Finlay I want to talk to SD cards in SPI mode. I do this step by step. My next task is the Send routine.

RL-ARM User's Guide: spi.RecBuf Library Routine

This is the original NXP Send:

/* Receive SPI data to buffer. */

static BOOL RecBuf (U8 *buf, U32 sz) {

  U32 i;

  for (i = 0; i < sz; i++) {

  SSPDR = 0xFF;

  while (!(SSPSR & RNE)); /* Wait while Rx FIFO is empty. */

  buf[i] = SSPDR;

  }

  return (__TRUE);

}

This my first trial for the Kinetis RecBuf

/*--------------------------- RecBuf ----------------------------------------*/

/* Receive SPI data to buffer. */

static BOOL RecBuf (U8 *buf, U32 sz) {

  U32 i;

  for (i = 0; i < sz; i++)   buf[i] = SPI2->POPR;

  return (__TRUE);

  }

Do you think this is applicable for SD card access via SPI?

I will discuss the other routines in other threads because of a better overview. I will post the final driver, because Keil provides only samples for SDHC mode for memory cards for the Kinetis system.

Thank you





标签 (1)
0 项奖励
0 回复数