Hi Christopher
Before the W25q chip is checked, its interface to it is configured (in kinetis.c
// Power up the SPI interface, configure the pins used and select the mode and speed
//
POWER_UP_SPI_FLASH_INTERFACE();
CONFIGURE_SPI_FLASH_INTERFACE(); // configure SPI interface for maximum possible speed (after TICK has been configured due to potential use of delay routine)
The hardware definitions are in the file app_hw_kinetis.h. For example, the FRDM-K22F board used the following as default:
#define SPI_FLASH_FIFO_DEPTH SPI0_FIFO_DEPTH
#define CS0_LINE SPI_PUSHR_PCS0
#define CS1_LINE
#define CS2_LINE
#define CS3_LINE
#define SPI_CS0_PORT ~(SPI0_PUSHR)
#define SPI_TX_BYTE SPI0_PUSHR
#define SPI_RX_BYTE SPI0_POPR
#define CONFIGURE_SPI_FLASH_INTERFACE() _CONFIG_PERIPHERAL(D, 0, (PD_0_SPI0_PCS0 | PORT_SRE_FAST | PORT_DSE_HIGH));\
_CONFIG_PERIPHERAL(D, 1, (PD_1_SPI0_SCK | PORT_SRE_FAST | PORT_DSE_HIGH));\
_CONFIG_PERIPHERAL(D, 2, (PD_2_SPI0_SOUT | PORT_SRE_FAST | PORT_DSE_HIGH));\
_CONFIG_PERIPHERAL(D, 3, (PD_3_SPI0_SIN));\
SPI0_MCR = (SPI_MCR_MSTR | SPI_MCR_DCONF_SPI | SPI_MCR_CLR_RXF | SPI_MCR_CLR_TXF | SPI_MCR_PCSIS_CS0 | SPI_MCR_PCSIS_CS1 | SPI_MCR_PCSIS_CS2 | SPI_MCR_PCSIS_CS3 | SPI_MCR_PCSIS_CS4 | SPI_MCR_PCSIS_CS5);\
SPI0_CTAR0 = (SPI_CTAR_DBR | SPI_CTAR_FMSZ_8 | SPI_CTAR_PDT_7 | SPI_CTAR_BR_2 | SPI_CTAR_CPHA | SPI_CTAR_CPOL);
#define POWER_DOWN_SPI_FLASH_INTERFACE() POWER_DOWN_ATOMIC(6, SPI0)
#define FLUSH_SPI_FIFO_AND_FLAGS() SPI0_MCR |= SPI_MCR_CLR_RXF; SPI0_SR = (SPI_SR_EOQF | SPI_SR_TFUF | SPI_SR_TFFF | SPI_SR_RFOF | SPI_SR_RFDF);
#define WRITE_SPI_CMD0(byte) SPI0_PUSHR = (byte | SPI_PUSHR_CONT | ulChipSelectLine | SPI_PUSHR_CTAS_CTAR0)
#define WRITE_SPI_CMD0_LAST(byte) SPI0_PUSHR = (byte | SPI_PUSHR_EOQ | ulChipSelectLine | SPI_PUSHR_CTAS_CTAR0)
#define READ_SPI_FLASH_DATA() (unsigned char)SPI0_POPR
#define WAIT_SPI_RECEPTION_END() while ((SPI0_SR & SPI_SR_RFDF) == 0) {}
#define CLEAR_RECEPTION_FLAG() SPI0_SR |= SPI_SR_RFDF
#define SET_SPI_FLASH_MODE()
#define REMOVE_SPI_FLASH_MODE()
The pins and SPI used can be changed here to suit the HW in the project.
This is the low level driver which allows flash operations, used by various parameter and file systems in the uTasker project where the user automatically has these capabilities to choose from. Since you don't use the uTasker project you will have to see whether the middle ware in your environment can support such things and/or allows such hooks to be added. If not you will either need to develop the file system on top of it or accept that what the environment allows.
Regards
Mark