Hello.
I am trying to write simple app that would write bytes to SPI Flash chip using eSPI controller.
However I am not able to send any data after I give write opcode and addr. I don't get DON bit to SPIE. Here is my sequence.
1. Write FFFF FFFFh to SPIE to clear any previous events.
2. Configure SPMODE = 8000 100Fh to enable normal operation, eSPI enabled.
3. Configure SPMODE0 = 2417 1108h—REV1 = 1, PM1 = 4 (divide eSPI input clock by 10),
LEN1 = 7, POL1 = 1, CS1BEF = CS1AFT = CS1CG = 1.
4. Configure SPCOM = 0800 0007h so TRANLEN = 1 opcode + 3 addr + 4 write bytes – 1.
5. Write SPITF = 02FF E000h (32-bit write, 8 bit opcode, 24 bit addr)
6. Write data to SPITF when TNF=1
7. Wait for DON on SPIE.
Anyone spot any errors from this sequence? This sequence works for other write commands like erase (0x52), write register (0x1), but not for page program (0x2). Major difference is that data follows after 4th byte.
This sort of follows reading sequence in app note pdf.
http://www.freescale.com/files/32bit/doc/app_note/AN3659.pdf
Thanks.
NVM, I got it working. To be noted that any write operation to SPMODn register is not allowed during data transfer since it pulls CS line up and then down corrupting transfer.