Pato Three

QSPI erase/program when booting XIP

Discussion created by Pato Three on May 13, 2014

When starting manually the app from QSPI XIP (i.e. quadspi_init(); asm("b 0x20000800");) everything was working fine. However when booting instead with QSPI RCON, the app was running ok but any QSPI erase/program operations failed (erase/program routines in ram and interrupts disabled since running XIP).

 

Turned out it was necessary to insert a QSPI software reset during QSPI initialization. But then I found out that this would work with 1N02G but NOT with 2N02G.

 

Here's the piece of code I'm now using which so far seems to be working fine in both cases (CA5):

 

  unsigned int *version = (unsigned int *)0x80; // read Vybrid chip version
  switch (*version) {
  case 0x11:  // 1N02G
    QuadSPI0->MCR = QuadSPI_MCR_SWRSTSD_MASK | QuadSPI_MCR_SWRSTHD_MASK; // QSPI software reset
    QuadSPI0->MCR = QuadSPI_MCR_DDR_EN_MASK | QuadSPI_MCR_MDIS_MASK;
    break;

  case 0x13:  // 2N02G
  default:
    QuadSPI0->MCR |= QuadSPI_MCR_DDR_EN_MASK | QuadSPI_MCR_MDIS_MASK;
    break;
  }

 

Tested with both flash parallel and single mode

Outcomes