Hi Huy,
Of course you can use the KE02 to control the external spi flash w25q16.
But, to meet the external flash demand, you need to use the GPIO as the CS control pin instead of the hardware SPI CS pin.
About the KE02 SPI baudrate and clock configuration , you can refer to our KE driver code which can be downloaded from this link:
FRDM-KEXX Driver Library Package
Please refer to the SPI project.
void SPI_SetBaudRate(SPI_Type *pSPI,uint32_t u32BusClock,uint32_t u32Bps)
{
uint32_t u32BitRateDivisor;
uint8_t u8Sppr;
uint8_t u8Spr;
uint8_t u8ReadFlag;
u32BitRateDivisor = u32BusClock/u32Bps; /* calculate bit rate divisor */
u8ReadFlag = 0;
/* find best fit SPPR and SPR */
for (u8Spr = 0; u8Spr <= 8; u8Spr++)
{
for(u8Sppr = 0; u8Sppr <= 7; u8Sppr++)
{
if((u32BitRateDivisor>>(u8Spr+1))<=(u8Sppr+1))
{
u8ReadFlag = 1;
break;
}
}
if(u8ReadFlag)
{
break;
}
}
if(u8Sppr >=8)
{
u8Sppr = 7;
}
if(u8Spr >8)
{
u8Spr = 8;
}
/* set bit rate */
pSPI->BR = SPI_BR_SPPR(u8Sppr) | SPI_BR_SPR(u8Spr);
}
If your SPI can't work, I suggest you use the logic analyzer to check the SPI wave, whether the wave meet your external flash demand or not.
Wish it helps you!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------