Hello,
please take a look at main BSP header file of some coldfire 51xx and the MQX SPI example itself.
You need to add some more defines to your K60 BSP to make GPIO chip selects working:
#define BSP_SPI1_GPIO_CS1 (GPIO_PORT_B | GPIO_PIN7)
#define BSP_SPI1_GPIO_CS2 (GPIO_PORT_B | GPIO_PIN8)
#define BSP_SPI_MUX_GPIO (LWGPIO_MUX_B7_GPIO)
#define BSP_SPI_MEMORY_GPIO_CS (BSP_SPI1_GPIO_CS1)
#define BSP_SPI_MEMORY_SPI_CS (SPI_PUSHR_PCS(1 << 2))
As you can see, LWGPIO driver is used in CS callback to drive chip select on pin PTB7.
Your new CS is mapped to DSPI HW chip select 2.
You can switch between chip selects using ioctl call to IO_IOCTL_SPI_SET_CS:
chip_select = SPI_PUSHR_PCS(1 << 0);
ioctl (spi_fd, IO_IOCTL_SPI_SET_CS, &chip_select);
fwrite ();
fflush ();
...
chip_select = SPI_PUSHR_PCS(1 << 1);
ioctl (spi_fd, IO_IOCTL_SPI_SET_CS, &chip_select);
fwrite ();
fflush ();
...
chip_select = BSP_SPI_MEMORY_SPI_CS;
ioctl (spi_fd, IO_IOCTL_SPI_SET_CS, &chip_select);
fwrite ();
fflush ();
...
Regards,
PetrM