FRDMK64F SPI pins

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FRDMK64F SPI pins

535 Views
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.

Labels (1)
0 Kudos
3 Replies

375 Views
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 Kudos

375 Views
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 Kudos

375 Views
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 Kudos