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!
-----------------------------------------------------------------------------------------------------------------------