56f827xx flash driver problem

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

56f827xx flash driver problem

861 Views
dynapb
Contributor IV

Hi PE Group,

I moved this from the DSC Community to the PE Community to see if someone here my have a better idea on how to fix this PE Driver problem or work around it better.

I made a Support Request and they put in a Ticket to PE Dev Team to maybe fix it some day.  Not sure how long that might take.  I added the info from the support request to the end of the exchange.

Thanks,

Pete

 

Hi All,

I am using a 56F82746 and set up the flash driver IntFLASH from the Components Library and having problems with the required running mode.

It needs to be set for the 'Wait In RAM' mode since the device only has one Flash area.

The problem is that when it calculates the location for the Wait In RAM code it uses the pRAM word start address but then the offset is calculated as a Byte offset which puts it in the wrong location, beyond memory and processor restarts at beginning.

I can see what is happening but cannot see how it is happening or why.

Let me know if there is a setting I am missing or if this is a bug in the driver.

Thanks,

Pete

Here is some information and I also attached a test project that it relates to. Just Added Attachment, 9/26/2017.

194871_194871.pngFlashBug-DriverSettings2.png

Fig 1. Driver is set to Wait In RAM.  Also shows simple program being run to test it.

 

194872_194872.pngFlashBug-HeapSizeSmall2.png

Fig 2. Heap size is set to a small value to show problem but code still works. Stack ends at 0xF838 in pRAM.

 

194891_194891.pngFlashBug-HeapSmall_SafeBeyondStack2.png

Fig 3. Heap size is small but "Safe Routine" is beyond the Stack, 0xF8D2 vs 0xF838.  Code still runs since it is in RAM yet.

 

194892_194892.pngFlashBug-HeapSizeBig2.png

Fig 4. Heap size set to a large value to show problem and code fails. Stack ends at 0xFC38 in pRAM.

 

194893_194893.pngFlashBug-HeapBig_SafeBeyondMemory2.png

Fig 5. Heap size is larger and "Safe Routine" is beyond the Memory, 0x100D2 vs 0xFFFF for end of memory vs 0xFC38 for end of stack.  Code fails and restarts at beginning.

Original Attachment has been moved to: Test82746FlashSave.zip

0 Kudos
4 Replies

412 Views
dynapb
Contributor IV

Hi All,

Just wanted to update anyone that is interested that I made a workaround for this issue a while back that I have not had problems with.

Change the code as shown below in IntFlashLdd1.c (or whatever your driver IntFlashLdd... is named).

static void SafeRoutineCaller(void)

orig ver

  SafeRoutineInDataPtr = (LDD_FLASH_TSafeRoutinePtr)&SaveRoutineStackSpace;

new ver

  //NOTE: Fix for Bad Flash Driver - Divide by 2 to get word address so does not get put past stack/RAM, pjb014.
  SafeRoutineInDataPtr = (LDD_FLASH_TSafeRoutinePtr)((UInt16)((LDD_FLASH_TSafeRoutinePtr)(&SaveRoutineStackSpace)) / 2);

After making the change just do a "Build Project" not a "Build All" or the code change will be overwritten..

"Don't Write" does not seem to work right, it still rewrites the driver file.  - - After building it, set the Flash Bean to not generate code to keep the changes.

Anyone know how to keep the bean from rewriting a driver file?

CodeGenDisable.png

Thanks,

Pete

0 Kudos

412 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

It seems taht the address is okay. i have tried to use the TWR-8200 board, the variable is written to the correct location.

pastedImage_1.png

Hope it can help you

BR

Xiangjun Rong

0 Kudos

412 Views
dynapb
Contributor IV

Hi Xiangjun Rong,

- Thanks for doing some testing but as I outlined in Fig 2 and Fig 3 it does work to program the flash location but the location of the Safe 'Wait in RAM' function is still beyond the Stack area where it is supposed to be copied to.

- Fig 4 and Fig 5 show that when the Heap is increased in size (to simulate my larger .bss area) then it does not work since the Safe 'Wait in RAM' function is trying to be copied beyond the RAM area.

- Please try changing the Heap size to 600 as in Fig 4 and running it.  I am sure it will not work.  If it does you may have to bump up the Heap a little.

  - When if fails you can see what is happening by placing a breakpoint at the locaiton shown in the following code snippet and then check the location of either SafeRoutineInDataPtr for an xRAM location beyond 0x0FFF or SafeRoutineInCodePtr for a pRAM location beyond 0xFFFF.

File is: IntFlashLdd1.c

Function is:

static void SafeRoutineCaller(void)
{
...

EnterCritical();
SafeRoutineInCodePtr();  /* Run the Safe routine */   PLACE BREAKPOINT HERE
ExitCritical();
}

Thanks,

Pete

0 Kudos

412 Views
dynapb
Contributor IV

Here is the info from the Service Request.

__________________________________________________________

Dear Peter Becher, 
Thank you for the bug report, I will report it to PE team and suggest they pop up a warning or error message when the 'Wait in RAM' function is written beyond the end of RAM.

Best regards,

X.j.
Technical Support

NXP Semiconductor

__________________________________________________________

Hi X 

Please do not suggest that they have a pop up warning!

That is not good enough.

Have them fix the bug so I can use the driver. 

There is enough information in my posts to let them know what the problem is and fix it. 

Please let me know when I can expect a bug fix. 

Thanks,

Pete

____________________________________________________________

Hi, Pete,
I am sorry, what I can do is to report bug to PE team, it is upon PE team to fix the bug, launch new release. Because of lack of resource, we can not guarantee when we can  fix it.
I hope you can understand.
BR
XiangJun Rong

0 Kudos