Hi Zhihui Liu,
I don't have the directly sample code which use the SDK to communicate with the W25Q64 for your reference.
But, from your description, you already make read works, so your hardware connection should don't have problems, then you have write problems, the main problem should still in the software side. Actually it is easy to check it.
From the W25Q64 datasheet, we can know this information:
Before do the page program instruction, you need to write enable instruction at first, then use the following wave to send the data:

From your attached code for page write, after the write enable function, you are calling:
LPSPI3_ReadWriteByte((u8)WriteAddr);
Do you send the 0X02 write instruction at first? Besides, your write addr is u8, but from my above figure, you can find it is the 24 bit address.
So, the useful method to check your problem is find a logic Analyzer tool to check your page write wave, whether it is meet he W25Q64 demand, then modify the code, actually it is very simple, please try it on your side.
If you still have question about it, please send me your SPI bus wave for page write.
On my side, there has some bare metal function for other MCU, you can refer the flow:
int w25qxx_write_page(uint32_t addr, uint8_t *buf, uint32_t len)
{
w25qxx_write_enable();
spi_xfer(W25X_PageProgram, W25QXX_CS_LOW);
spi_xfer((uint8_t)((addr)>>16), W25QXX_CS_LOW);
spi_xfer((uint8_t)((addr)>>8), W25QXX_CS_LOW);
spi_xfer((uint8_t)addr, W25QXX_CS_LOW);
w25_dev.ops.xfer(NULL, buf, len, W25QXX_CS_HIGH);
while(w25_dev.ops.get_reamin() != 0)
{
w25_dev.ops.delayms(10);
}
while((w25qxx_read_sr() & 0x01) == 0x01)
{
w25_dev.ops.delayms(1);
}
return 0;
}
Wish it helps you!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------