K81 QSPI XiP fails

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

K81 QSPI XiP fails

Jump to solution
1,321 Views
deniscollis
Contributor V

I'm having trouble getting QSPI XiP working on a K81 with Cypress (Spansion) S25FL128S flash.  The project builds and programs without error.

When function   __TEXT(Flash3) myTestFunc()   is called, I get a core exception (hardfault).


 

1 Solution
1,011 Views
deniscollis
Contributor V

Solved:

The debug probe's flash loader programs the Flash in 32-bit LE mode.  However NXP drivers assume 64-bit LE mode.


This is not a problem if the flash is exclusively dedicated for data storage (64LE), or XiP code (32LE). But it becomes an issue when the flash is used for both, simultaneously. For this to work correctly, changes must be made to the NXP QSPI driver code (fsl_qspi) so that it is endian-aware.

Note: This issue was reported to Segger, who have indicated that they will support 64LE in a future release of J-Link software.

View solution in original post

0 Kudos
4 Replies
1,012 Views
deniscollis
Contributor V

Solved:

The debug probe's flash loader programs the Flash in 32-bit LE mode.  However NXP drivers assume 64-bit LE mode.


This is not a problem if the flash is exclusively dedicated for data storage (64LE), or XiP code (32LE). But it becomes an issue when the flash is used for both, simultaneously. For this to work correctly, changes must be made to the NXP QSPI driver code (fsl_qspi) so that it is endian-aware.

Note: This issue was reported to Segger, who have indicated that they will support 64LE in a future release of J-Link software.

0 Kudos
1,011 Views
deniscollis
Contributor V

To avoid duplication, please follow related thread: https://community.nxp.com/thread/478799 

0 Kudos
1,011 Views
deniscollis
Contributor V

Another board with Micron MT25QL128 flash also fails.  For either board I can write data to flash, and can perform direct memory reads.  So the flash itself works well.  I don't have a bootloader, but instead initialize the QSPI and populate the LUT as per document How to use QuadSPI on KL8x Series. I've verified that the J-Link has programmed the external flash.  So everything except XiP is working as expected.

0 Kudos
1,011 Views
deniscollis
Contributor V

The endianness configuration in the demo code was kQSPI_64LittleEndian.  This worked for normal data erase, write and read operations, but not for XiP.  When changed to kQSPI_32LittleEndian, XiP worked perfectly, but normal data write and read operations has 32bit-word-order swapped, i.e. wrote {(uint32_t)Word0, (uint32_t)Word1}, but read  {(uint32_t)Word1, (uint32_t)Word0}