FRDMK64F SPI pins

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

FRDMK64F SPI pins

1,791件の閲覧回数
ammadrehmat
Contributor I

Hi,

 

It has come to my attention that FRDMK64F has multiple revisions which have different pin connections. These pin connections effect the working of SPI protocols. It seems like the examples provided are for rev D. I would like to inquire if there is a way to configure the SDK for Rev E or if someone can point me in the right direction in SDK where I can update the pin configurations.

 

If anyone have a driver written for SPI frdmk64f rev E and ready to share , I would highly appreciate that.

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

897件の閲覧回数
ve3id
Contributor III

Dear jinjing,

I have asked this question somewhere else and received no reply, but I see you are knowledgeable in this matter so I ask you to please help me out. I have proven on the FRDM-K64F that the CE pin on the 8 pin header for the nRF24l01 is actually driven by PTB20, not PTC12 as it says in the documentation, by ohmeter between the CE pin of the header and pin 66 of the K64F 100 pin chip. The problem is, that it is not responding to my attempts to drive it. My code is simple:

SIM_SCGC5 |= SIM_SCGC5_PORTB_MASK;

PORTB->PCR[20] = 0x103;

GPIOB_PDDR |= (0x01 << 20);  for setup, and then

GPIOB_PSOR = nrf24l01_CE_PINMASK;  (which evaluates to 0x100000)

and I see when I run it that the pin is obviously not driven in any way so noise from my finger drives it to a HI!

In desperation I have tried setting the pin to all modes, alt 0 to 7, again to no avail.

If you or anybody else can cast your superior eyes on this and see my silly mistake, I will be forever indebted as this is holding up my project

 

Thanks,

Nigel

 

0 件の賞賛
返信

1,631件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Ammad Rehmat,

    I check the revD and revE schematic for FRDM-K64, both of them using the SPI0: PTD0-3 as the KSDK1.3.0 spi master test port.

   If you want to change the SPI port in the KSDK1.3.0, you can modify the board.h:

#define BOARD_DSPI_INSTANCE         0

   0  is the SPI0, 1 is the SPI1.

   If you want to change the pin, just  modify the function calling configure_spi_pins() in hardware_init:

void hardware_init(void) {

  /* enable clock for PORTs */

  CLOCK_SYS_EnablePortClock(PORTE_IDX);

  CLOCK_SYS_EnablePortClock(PORTD_IDX);

  CLOCK_SYS_EnablePortClock(PORTC_IDX);

  CLOCK_SYS_EnablePortClock(PORTB_IDX);

  CLOCK_SYS_EnablePortClock(PORTA_IDX);

  /* Init board clock */

  BOARD_ClockInit();

  dbg_uart_init();

  // Configure SPI pins

  configure_spi_pins(0);

}

function configure_spi_pins definition can be find in pin_mux:

void configure_spi_pins(uint32_t instance)

{

  switch(instance) {

    case SPI0_IDX:                       /* SPI0 */

      /* Affects PORTD_PCR0 register */

      PORT_HAL_SetMuxMode(PORTD,0u,kPortMuxAlt2);

      /* Affects PORTD_PCR3 register */

      PORT_HAL_SetMuxMode(PORTD,3u,kPortMuxAlt2);

      /* Affects PORTD_PCR1 register */

      PORT_HAL_SetMuxMode(PORTD,1u,kPortMuxAlt2);

      /* Affects PORTD_PCR2 register */

      PORT_HAL_SetMuxMode(PORTD,2u,kPortMuxAlt2);

      break;

    case SPI1_IDX:                       /* SPI1 */

      /* Affects PORTD_PCR4 register */

      PORT_HAL_SetMuxMode(PORTD,4u,kPortMuxAlt7);

      /* Affects PORTD_PCR7 register */

      PORT_HAL_SetMuxMode(PORTD,7u,kPortMuxAlt7);

      /* Affects PORTD_PCR5 register */

      PORT_HAL_SetMuxMode(PORTD,5u,kPortMuxAlt7);

      /* Affects PORTD_PCR6 register */

      PORT_HAL_SetMuxMode(PORTD,6u,kPortMuxAlt7);

      break;

    default:

      break;

  }

}

You can change the port to the pin which you want.

Wish it helps you!

If you still have question, please let me know!

Have a great day,

Jingjing

-----------------------------------------------------------------------------------------------------------------------

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

-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信

1,631件の閲覧回数
ammadrehmat
Contributor I

Hi Jingjing,

Thanks for the reply. What I am looking for is pin configuration of RF communication port. In rev D it has CE pin as PTC3 while in rev E it is PTB20. Where can i confirm this setting?

regards

Ammad

0 件の賞賛
返信

1,631件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Ammand Rehmat,

     Actually, our KSDK1.3.0 don't have the RF communication code, then the code didn't configure the RF CE pin.

    Now, it is really very easy for you to control it by yourself, you can configure PTC3 or PTB20 for the CE pin function by yourself in the main code.

    If you want to configure the according pin as the GPIO, just configure the PORT register and the GPIO register.

Wish it helps you!

If you still have question, please let me know!

Have a great day,

Jingjing

-----------------------------------------------------------------------------------------------------------------------

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

-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信