This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
I use Bank 7 for storing calibration data on RM48 and RM57. We have used our software stack, including F021 API on RM48 for several years with success. After erasing a sector I manually check that is blanked by checking for 0xFFFFFFFF at each address.
During programming on RM57 I opt to Erase Bank7 Sector 1. After the program has loaded I inspect the address 0xF0200000 in CCSV7 and notice that the data is 0xFFFFFFFF, 0xFFFFF7FF, etc.
I would expect the FLASH to erase to 0xFFFFFFFF even in the instance that ECC is enabled, which I think it always is on RM57? The ECC should be at 0xF0100000.
When I use the F021 API and follow the described sequence (same sequence used on RM48) I always get a Fapi_success for every command, yet my FLASH does not erase.
Can anyone indicate what would cause both the CCSV7 programmer and the F021API NOT to erase Bank7, despite success codes being returned?
Thanks
Stomp.
The thread Why my RM57L843 can't be erased by clearly? seems to explain that that isn't the case.stomp said:I would expect the FLASH to erase to 0xFFFFFFFF even in the instance that ECC is enabled
After the erase, what happens if you attempt to then program the 0xFFFFFFFF value along with a valid ECC?
By default when a HALCoGen project is created the cache is enabled and the MPU region for the flash is set to type NORMAL_OIWTNOWA_NONSHARED "Memory type normal outer and inner-write-through, no write allocate and non-shared".stomp said:After erase, lets just assume I program 0xF0200000 with 0xAAAA5555 I would expect to see some of the bits change from a 1 to 0. This is not the case, the memory does not change.
The CPU might have therefore cached the erased flash values - see CCS/TMS570LC4357: Issue in Flash programming using F021 Flash library
[I haven't tested this myself]
Hi Stomp
I will see if I can write a simple example. Before that I want to clarify few things.
1) What is the wait State configured for Bank7.
2) After Erase you mention that few locations read 0xFFFFF7F. If you disable ECC did you still read the same?
3) You mentioned that after Erase, you performed Blank check. Did Blank check pass.To confirm that your erase was successful you can perform Read Margin1 Test.
Hi,
Thanks very much for your help.
We are on RM57L843.
1. 3 Wait states
2. To my knowledge ECC can't be disabled from RM57's FLASH. If this is wrong please advise.
3. To do a blank check I use my own algo (which looks for 0xFFFFFFFF) and obviously does not work due to the ECC. I also use the Fapi_doBlankCheck() function, which can't work due to the ECC limitation.
I'm not sure what you mean by Read Margin1 test. Do you have a link to that?
I think the trouble I am having is related to a few things.
1. Cache. Often after I reset the device I see *SOME* of my programmed memory there, sometimes the memory contents are duplicated in adjacent memory addresses.
2. ECC.
3. Something else quite random. I notice that if I set Fapi_setActiveFlashBank(7); and then while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy); The while loop may never exit in about 3/10 program runs.
My process is like this:
I don't think I am doing anything particularly wrong, as this works well on RM48.
Thanks
Stomp!
Thanks Chuck,
Just to clarify I have Bank 0,1 as 3WS and Bank7 as 9WS.
//Setup flash read Mode, address wait states and data wait states flashWREG->FRDCNTL = (Luint32)0x00000000U | ((Luint32)3U << 8U) | (Luint32)3U; //Setup flash access wait states for bank 7 FSM_WR_ENA_HL = 0x5U; EEPROM_CONFIG_HL = (Luint32)0x00000002U | ((Luint32)9U << 16U) ; //Disable write access to flash state machine registers FSM_WR_ENA_HL = 0x2U; //Setup flash bank power modes flashWREG->FBPWRMODE = (Luint32)0x00000000U /* Bank 7*/ | ((Luint32)SYS_ACTIVE << 14U) /* Bank 1*/ | ((Luint32)SYS_ACTIVE << 2U) /* Bank 0*/ | (Luint32)SYS_ACTIVE;
I should have been a bit more clear.
Regards
Stomp!.
Hi Stomp,
Sorry I forgot to ask.
What is the return value from the function Fapi_initializeFlashBanks(HCLK_FREQ); Is it Fapi_Status_Success(0) or Fapi_Error_InvalidHclkValue(8)?
Make sure to proceed with any Flash operation only when Fapi_initializeFlashBanks returns zero (Fapi_Status_Success).
Hi,
On RM57 we have 150MHZ HCLK, 300MHZ GCLK and the rest of the clocks are 75MHZ, which the exception of the EMAC (VCLK4A_DIV) at 37.5MHZ.
Our code calls Fapi_initializeFlashBanks(150U);
And we check the status, which is always Fapi_Status_Success. If it is not success, our driver reports back.
We have also checked that Fapi_initializeFlashBanks(300U); returns with Fapi_Error_InvalidHclkValue to ensure the function is just not returning 0 without doing anything.
If its any help, I have also been digging through the HalCoGen supplied FEE driver. We can't use this driver in our system due to compatibility with our upper layers, and also the verification effort needed. But I did notice this:
FLASH_CONTROL_REGISTER->FrdCntl.FRDCNTRL_BITS.RWAIT = 0x3U; FLASH_CONTROL_REGISTER->FsmWrEna.FSM_WR_ENA_BITS.WR_ENA = 0x5U; FLASH_CONTROL_REGISTER->EepromConfig.EEPROM_CONFIG_BITS.EWAIT = 0x4U; FLASH_CONTROL_REGISTER->FsmWrEna.FSM_WR_ENA_BITS.WR_ENA = 0x2U;
By default, the FEE driver also sets EEPROM wait to 4, not 8??
Thanks.!
Hi Stomp,
Please find an attached simple Bank7 Erase and program routines on RM57x Device.
Some options to find out if the cache is causing the issue:Is this simply a cache issue that I am seeing?
1) After the Memory Watch window has shown the FLASH contents have NOT changed in the Cortex-R5 CPU context, try and view the same FLASH address in the Debug Access Port (DAP) context. This is because the DAP context reads the memory directory, bypassing the Cortex-R5 CPU cache. If FLASH as viewed by the Cortex-R5 CPU and DAP differ, it is a sign that the CPU has cached "stale" contents of the cache. See Manual launch for a link to accessing memory using the DAP.
2) In the HALCoGen PMU configuration for the FEE address space try changing the type to "DEVICE_SHAREABLE", to prevent the contents of the FEE from being cached:
Hi Stomp,
Let me confirm again.
Your problem is, after programming Bank 7 you cannot see the data in memory Window, but after reset you can see it. Is that right?
I did a similar experiment as yours reading BANK7-sector0 and store data, erase Bank7 - Sector 0, and write with new set of data. It works fine and I am able to see the new data in the memory window, able to read it through code.
For my code MPU Type for Bank 7 is NORMAL_OINC_NONSHARED. ( This is Non-Cacheable configuration).
Only point to note is for RM57x device F021 API - Blankcheck routine uses DiagMode7, which is not the case with RM48x devices.
Hi Stomp,
/cfs-file/__key/communityserver-discussions-components-files/312/6840.F021_5F00_Sample_5F00_v2.zip
I have attached HALCoGen + CCS project. Which does Bank7 erase, write and verify.
There is two options running Blankcheck from RAM and Flash. This can be controlled by pre-processor macro RUN_FROM_RAM ( must change in Compiler and Linker option in ccs project properties) .
For MPU setting please refer HALCoGen project that I attached.
Note : I configured RAM to be non cacheable just to execute code from it. If running from Flash This setting is not needed.
Hope this Helps.