Porting SPI Driver to Keil RL-ARM System: BusSpeed

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Porting SPI Driver to Keil RL-ARM System: BusSpeed

922件の閲覧回数
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 Bus speed routine.

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

This is the original NXP Bus Speed Routine:

/* Set an SPI clock to required baud rate. */

static BOOL BusSpeed (U32 kbaud) {

  U32 div;

  div = (__PCLK/1000 + kbaud - 1) / kbaud;

  if (div == 0) {

  div = 0x02;

  }

  if (div & 1) {

  div++;

  }

  if (div > 0xFE) {

  div = 0xFE;

  }

  SSPCPSR = div;

  return (__TRUE);

}

I am not able to write a Kinetis Routine, because there is no PreScaler in the K60 registers. What else can I do to full fill the requirements of this routine?


ラベル(1)
0 件の賞賛
返信
0 返答(返信)