Use external XIP flash both as eeprom

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

Use external XIP flash both as eeprom

900 Views
MKlem
Contributor III

Hi all,

Is it possible to use an i.MX RT1010 with an adesto XiP nor flash memory, which is also used as emulated EEPROM? For instance, the first 100kbyte of the flash is actual code, and the last 10kbyte of the flash is functioning as EEPROM to store variables. 

I feel like it conflicts with the CPU which uses the FlexSPI to load the instructions, but then again, if the CPU knows how to write to the flash it should be possible, right?

 

Thanks for any help!

 

Marcel

0 Kudos
5 Replies

852 Views
MKlem
Contributor III

Hi Diego,

 

Many thanks for your replies! I've looked into the Application Note and found that for me the best way to RWW is to use a flash that would support this natively. I am using the same Adesto Flash as on the RT1010 EVK (AT25SF128A-SHB-T). Would it be possible? I guess not scrolling through it's datasheet.

 

So as mentioned in the AN, writing a page can take a while and disabling interrupts for such a long time might not be a good idea, but what if my application does permit it? Can I still do the steps you wrote in the first comment?

Basically that is done, except for the application functions linked to ram. That might also be the issue. I'll try to get them linked into RAM, make sure the MPU allows it and then let you know the results. 

 

Thanks!

 

Marcel

 

0 Kudos

824 Views
diego_charles
NXP TechSupport
NXP TechSupport

Hi @MKlem 

I agree with you I do not see how the AT25SF128A-SHB-T supports RWW. But, in any case it is better to check with manufacturer.

If you application does permit to disable interrupts for several ms, while you write/read the flash I think there is no problem. I recall a customer application that was not working properly on this way. His application was an USB audio speaker, when he disabled interrupts for writing the flash, the audio was terribly chopped, since the USB stack required periodic interrupts.

I hope you do not get any issues while linking functions to SRAM. For me the easiest way is to use the custom linker script (like our SDK examples do)

Best regards, 

Diego

0 Kudos

882 Views
diego_charles
NXP TechSupport
NXP TechSupport

Hi @MKlem 

Happy holidays!

Certainly you can use the Adesto Memory (and any external XIP flash memory) to store variables! You can even pull up a file system in your external flash.

As you mention there are certain conflicts to Read/write the on the same memory that the processor is fetching durin XIP.  For example there are several considerations, the most basic ones that come to my mind are:

- Application functions that read/write the XIP memory, shall be executed somewhere else. For example you write_flash function can is typically linked to be executed from  SRAM.

- During memory write/read if the processor shall not be halted by an interrupt. Otherwise you may get a processor fault.

-Specify a section in the linker  file for store variables. 

In our RT SDKs we have FlexSPI examples that have functions linked to SRAM ( using custom Linker) scripts, and write several sectors. The examples take care for the i.MX RT10xx flash memories configuration and initialization.  

Talking further about this topic  and providing a solution for the above complications we have this application note  AN12564 Implement RWW on i.MX RT Series . 

I hope this information could help you!

Diego

0 Kudos

889 Views
MKlem
Contributor III

After looking into my problem I found two ways of writing to the connected flash, either with IP commands or using the AHB bus. Using the AHB bus would ofcourse be the best solution here, because I'd be able to create an EEPROM struct and locate it in the right position, creating a perfect way of reading and writing this part of the flash. 

After doing some testing, I found out this was not so easy. Reading does work, but writing seem to result in an AHBCMDERRCODE of value 3 (There is unkown instruction opcode in the sequence), with AHBCMDERRID containing a value of 0x9 (the write page command LUT index). 

I double checked this value in the Flash Configuration Block (0x60000400) on offset 0x80 the LUT begins, and every LUT contains 16 bytes, so index 9 would be at offset 0x90 and the value is equal to the value set in evkmimxrt1010_flexspi_nor_config.c (duh). But in here no strange opcodes are found.

After running into this trouble, I tried ip commands, but then got the same result, only in IPCMDERRCODE and IPCMDERRID registers.

What could be the issue here? 

 

Thanks!

 

Marcel

0 Kudos

881 Views
diego_charles
NXP TechSupport
NXP TechSupport

Hi @MKlem 

You can perform reading operations with ease. For writing to the flash memory, I would prefer to call FlexSPI driver functions or bootROM fuctions. How are you are actually implementing code for writing?

Best regards, Diego

 

0 Kudos