eSPI Flash Write sequence (P1010)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

eSPI Flash Write sequence (P1010)

887 Views
juhalaukkanen
Contributor III

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.

Labels (2)
Tags (4)
0 Kudos
2 Replies

390 Views
Pavel
NXP Employee
NXP Employee

I have tested you command sequence. Your command sequence is correct.

This code sends data and set DON bit is the SPIE.

See attached file. It is simple eSPI program example. It is CodeWarrior 8.8 project for the p2020 eSPI.

This code can be used on the P1010 also.

0 Kudos

390 Views
juhalaukkanen
Contributor III

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.

0 Kudos