SPIFI change memory mode to command mode

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

SPIFI change memory mode to command mode

681 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by cojanprins on Wed Feb 25 07:07:53 MST 2015
Hello,

I'm using the keil MCB1800 demoboard with LPC1857. I have made a special bootloader, it copies the userimage from SPIFI to SDRAM and execution works fine.

Now I want to use a part of the SPIFI to read/write some datablocks. How can I get the SPIFI flash out of memory mode? I tried it by doing:

  if (LPC_SPIFI->STAT & 0x01)
  {
    printf("SPIFI in memory mode!\n\r");
    LPC_SPIFI->STAT = 0x10;
    while(LPC_SPIFI->STAT & 0x01);
  }

but the program freezes completely.

but also a direct "reset" :

  LPC_SPIFI->STAT = SPIFI_STAT_RESET;
  for(t0 = TimerMsCnt; TimerMsCnt - t0 < 128; )
  {
    stat = LPC_SPIFI->STAT;
    if ((stat & SPIFI_STAT_RESET) == 0)
      return 1;
  }

it completely freezes.

What am I doing wrong?

Thanks in advance.
Labels (1)
0 Kudos
6 Replies

466 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by cojanprins on Thu Mar 12 08:38:22 MST 2015
Thanks very much MC. It's working now.  :)
0 Kudos

466 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Sat Mar 07 10:37:51 MST 2015
Hi,
Yes using both statements, should take device out of XIP as well as from quad mode. Please run the example, I have attached in my previous post.
0 Kudos

466 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by cojanprins on Fri Mar 06 08:09:44 MST 2015
Will this work while SPIFI is still in QUAD mode and in XIP mode? At least in my case it is not working at all.

In the library example I see:

/* Make sure we are not in mem mode and turn off QUAD for now */
spifiDevSetOpts(pSpifi, SPIFI_OPT_USE_QUAD, false);
spifiDevSetMemMode(pSpifi, false);

So in that version, it looks like that QUAD mode will be disabled first before changing from memory mode into command mode.

Could that be the solution? Remember, that my application has booted from SPIFI and copied into SDRAM from which execution is done. I assume that the LPC18xx boots in quad mode and remains in quad mode even after execution continues in SDRAM. So I'm not sure, which commands will be accepted by the SPIFI while in XIP/QUAD mode.

The problem is also, that I cannot get a correctly filled handler because of the fact the SPIFI is still in XIP/QUAD mode.
0 Kudos

466 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Thu Feb 26 12:16:44 MST 2015
Hi cojanprins
Just call spifiDevSetMemMode(pHandle, 0) with second parameter 0. See below example
http://www.lpcware.com/system/files/lpcopen_2_12_lpcxpresso_keil_mcb_1857_SPIFI_23Feb15.zip
0 Kudos

466 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by cojanprins on Thu Feb 26 08:01:16 MST 2015
Hello,

I think the problem is, that the LPC1857 and SPIFI flash are still in XIP mode. How can I stop this?

I am using the SPIFI library, and as far as I see, the way to do this is to write 0xff into the SPIFI intermediate data register (cancelling XIP) and then write 0x0000 into the SPIFI memory command register. Is this correct?

Thanks in advance.
0 Kudos

466 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Wed Feb 25 09:55:05 MST 2015
Hi,
That may be  because the serial flash device is still in XIP mode. You also need to make sure that comand is completed.   Please look SPIFI library at
http://www.lpcware.com/SPIFI
0 Kudos