[solved]Protecting SPI flash sectors using lib (spifi_drv_m4) LPC43

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by cyrilfougeray on Tue May 28 07:57:12 MST 2013

Hello everyone,

I'm porting U-Boot on SPI Flash and I'd like to protect sectors. I'm working on the Hitex LPC4350. My SPI Flash is the S25FL064P.

As I understood, there is no function provided to do this in the spifi lib. 

I try to send commands one by one but without success, here how I proceed :

<li>Switch to commande mode (cancel_mem_mode())</li>
<li>pSpifi-&gt;cmd(0x06, 0, 0, 0); // WREN</li>
<li>pSpifi-&gt;cmd(0x01,0, 0, (*data_buf)); // write registers   /!\ Here, data is 8 bits long but cmd() use uint16_t as data. Maybe I'm configuring the config register instead of the status register...</li>
<li>Wait operation is complete</li>
<li>Write Disable</li>

Reading the SPIFI command register after WREN returns 0xEBD30001. The most significant byte (0xEB) stands for :  Quad I/O High Performance Read. I think the pSpifi-&gt;cmd doesn't work because the cancel_mem_mode is working (I'm not able to read data then).

Is there anyone who succeed to protect sectors ? Or maybe I'm missing something ?

Thanks in advance,