Flex SPI read write issue after change in .icf file

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

Flex SPI read write issue after change in .icf file

564 Views
Ananth96
Contributor I

Hi support team,

I am working with IMXRT1062 and facing issue with flex SPI  nor flash API There are 2 scenarios one is working and other is not working. made changes in .icf file after increasing the bin size we changed  m_data_start to m_data2_start.

Working - In this scenario  my bin size is less then 80k  .icf file for this is MIMXRT1062xxxxx_flexspi_nor.icf(working with this .icf file)

Not Working - In this scenario my bin size is 200k so that changed my .icf file  MIMXRT1062xxxxx_flexspi_nor_1.icf file in attachment.

 

The only change in code is we are using different MIMXRT1062xxxxx_flexspi_nor.icf file

i am attaching the both .icf file

 

uint8_t bin_data[32678]; //globle data to collect UART ISR data

int state_machine(const unsigned char* dataPtr, const unsigned int dataLen)
{

memcpy(bin_data+(index * dataLen, dataPtr,  dataLen);  this is used to fill 32k data and further stored in flash ignore the copy logic


flexspi_nor_flash_init(FLEXSPI);
flexspi_nor_enable_quad_mode(FLEXSPI);

 

for(sector = 0; sector <= 0x7; sector++){

flexspi_nor_flash_erase_sector(FLEXSPI, 0x00600000 + (0x00001000*sector),,  (void *)(bin_data+(256*page));

}

for(page = 0; page <= 0x7F; page++){

flexspi_nor_flash_page_program(FLEXSPI, 0x00600000 + (256*page),  (void *)(bin_data+(256*page)));

}

dfu_eflash_addr_fl = 0x00600000 +(0x8000);
dfu_eflash_addr_er = 0x00600000 +(0x8000) ;

}

0 Kudos
Reply
5 Replies

554 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @Ananth96 ,

  Thank you for your interest in the NXP MIMXRT product, I would like to provide service for you.

  Do you download your app bin to the external flash directly? What's the external flash you are using?

  As I know, some external flash higher than 16MB need to use 4 bytes address command to do the operation. So, please check whether your operated area is higher than 16MB or not?

 You can find more details in this post:

https://www.cnblogs.com/henjay724/p/13374775.html

  If you still have issues about it, can you reproduce the issues on the NXP MIMXRT1060-EVK board or not? It's better to reproduce the issue on the nxp board at first.

I checked your attached icf, you just do the DATA region change:

kerryzhou_0-1709633247011.png

 

Do you want to use this RAM?

define symbol m_data2_start = 0x20200000;
define symbol m_data2_end = 0x202BFFFF;

 

Best Regards,

Kerry

 

  

0 Kudos
Reply

538 Views
Ananth96
Contributor I

hi kerryzhou,

Yes i used IAR to flash in flexspi_nor_hyper_debug mode, and i  am using  qspi external flash (W25Q128JVBJQ) which is not more then 16M/bytes.

Do you want to use this RAM? - yes 

if i am using RAM space below 

define symbol m_data_start = 0x20000000;
define symbol m_data_end = 0x2001FFFF;

flex_spi is able to erase and flash completely.  

0 Kudos
Reply

519 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @Ananth96 ,

 If you are using the QSPI flash, you need to use the QSPI flash demo, not the hyperflash demo, otherwise, the LUT commander is not matches your flash.

This demo:

\SDK_2_15_000_EVKC-MIMXRT1060\boards\evkmimxrt1060\driver_examples\flexspi\nor\polling_transfer

About the read, you need to use the 4bytes address method, you need to check your used flash datasheet to find the related commander, eg, 

https://www.cnblogs.com/henjay724/p/13374775.html

Wish it helps you!

Some use the EB for the Quad mode read, but you need to use the EC

FCB modification:

.sflashA1Size = 32u * 1024u * 1024u,//8u * 1024u * 1024u,

.lookupTable =

{

// Read LUTs

// [0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB, RADDR_SDR, FLEXSPI_4PAD, 0x18),

[0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEC, RADDR_SDR, FLEXSPI_4PAD, 0x20),

Best Regards,

Kerry

0 Kudos
Reply

461 Views
Ananth96
Contributor I

Hi kerryzhou

We tried your suggestion it does not work for me.

Issue seems after change in MIMXRT1062xxxxx_flexspi_nor.icf RAM section from m_data to m_data2. because when i was using m_data section it was able to flash 32k data in loop but after changing to m_data2 not able to flash complete some times Stucks on

flexspi_nor_enable_quad_mode(FLEXSPI);  

In previous code we used to use m_data_start(ITCM) space now using m_data2 space because of linker issue insufficient memory for global data and also if we are increasing the m_data_end code is going for hard fault.

I am suspecting, my issue is relevant to below link 

Using NonCached Memory on i.MXRT - NXP Community 

please suggest what scenarios effect to external flash R/W after change of m_data RAM section  to m_data2 in .icf file

define symbol m_data2_start = 0x20200000;
define symbol m_data2_end = 0x202BFFFF;

0 Kudos
Reply

458 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @Ananth96 ,

  You mentioned: Issue seems after change in MIMXRT1062xxxxx_flexspi_nor.icf RAM section from m_data to m_data2

 m_data is the DTCM, m_data2 is the OCRAM.

  Do you enable the cache or not? You can try to disable the cache, whether it have improvement or not, as the TCM won't be influenced by the cache, but the OCRAM will.

 You also mentioned:In previous code we used to use m_data_start(ITCM) space now using m_data2 space because of linker issue insufficient memory for global data and also if we are increasing the m_data_end code is going for hard fault.

Do you already try to modify the flexRAM with higher TCM data size? Normorally, it needs to reallocated the flexRAM.

You can refer to this application note:

https://www.nxp.com/docs/en/application-note/AN12077.pdf

If you still have issues about it, please kindly let me know.

 

Best Regards,

Kerry

 

 

0 Kudos
Reply