QSPI erase/program when booting XIP

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

QSPI erase/program when booting XIP

1,105 次查看
pato3
Contributor III

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

标签 (2)
0 项奖励
回复
0 回复数