RAM to program Flash - ProcessorExpert IntFlash Bean

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

RAM to program Flash - ProcessorExpert IntFlash Bean

Jump to solution
2,836 Views
AJPinotti
Contributor II

Hello everybody.

 

I am developing an aplication, based on 56F8037 CPU, where I want to program some configurations into Flash, so that they will be there after a power down.

 

I've read posts and manuals and found it´s necessary to run from RAM to program the flash. I've ran into this PE bean, IntFlash, but I am having some troubles.

 

I allocated a specific part of flash to be written. But all functions I try to use, doesn´t work. The ACCERR (Access error) bit is being set.

This bean calls a "run_and_wait_in_RAM()" function, and it seems to be workful in runtime. Does anyone ever used this bean or have some tip to give?

Do you think it is possible to use them in runtime and in debug mode?

In the bean documentation (https://www.processorexpert.com/beans/IntFLASH/IntFLASH.html) is said some configurations should be done in CPU bean as well, but I don´t know what they are.

 

Thanks.

 

Alexandre

Labels (1)
Tags (1)
0 Kudos
1 Solution
528 Views
ProcessorExpert
Senior Contributor III

To avoid the problem with writing 0xFE to 0xFFB0 address you have to unprotect the whole flash for writing and to correct the paramter in SetByteFlash method according to method´s documentation.

 

For example to write 0x00 to address 0x7000 you have to use 0xE000 value as paramter in SetByteFlash method (for more detailed information please see hint of the method).

 

Example:

Flash_Lc = FlashConfigSetGlobalProtection(FALSE);

Flash_Lc = FlashConfig_SetByteFlash(0xFFB0,0xFE); // 0xFE will be written to 7FD0 address

 

Note:

Don´t forget to switch to the "p" page in debugger to view a correct memory area.

 

Best Regards,

Vojtech Filip

Processor Expert Team

View solution in original post

0 Kudos
4 Replies
528 Views
ProcessorExpert
Senior Contributor III

Hello Alexandre,

 

what  version of Code Warrior and Processor Expert are you using? How the IntFlash bean is set? Could you please provide us a project demonstrating the problem?

 

However, the problem could be that the FLASH memory is protected for writing. You don't unprotect it so it can work only when the flash is unprotected. There is a method SetGlobalProtection of the IntFlash bean. Calling this method with paramter FALSE will unprotect the whole flash for writing.

 

You can find some additional information about IntFlash bean for example here.

 

best regards
Vojtech Filip
Processor Expert Support Team

0 Kudos
528 Views
AJPinotti
Contributor II

Tks for the reply.

 

I am attaching a project that has the same configuration and has the Flash instructions I am tring to use.

The ACCERR bit is being set even when the function OutOfRange() is used, but I really don´t know why, because this function doesn´t access flash, at least I don´t think so.

Please I would appreciate if you could check the configurations of the project.

 

Someone know where I can get TN288 for 56F80xx? The technical note about getting a code from ROM to RAM, so it is possible to programa the Flash?

 

I didn´t understand as well, where PE does change the CTRL and DIVBY registers of OCCS, as mentioned in the Reference Manual. Should I do it before calling PE funtions?

 

I am using:

CodeWarrior Development Studio for DSC56800/E version 8.2.3, build 7, IDE Version: 5.6.1.1658

PE version the one that is installed with this version of CodeWarrior 

 

IntFLASH is configured as follows:

Write Method: WRITE

Wait in RAM: YES

Virtual page: DISABLED

 

Thank you for your help.

 

Alexandre

 

FlashTest.zip

Message Edited by t.dowe on 2009-10-29 09:50 AM
0 Kudos
529 Views
ProcessorExpert
Senior Contributor III

To avoid the problem with writing 0xFE to 0xFFB0 address you have to unprotect the whole flash for writing and to correct the paramter in SetByteFlash method according to method´s documentation.

 

For example to write 0x00 to address 0x7000 you have to use 0xE000 value as paramter in SetByteFlash method (for more detailed information please see hint of the method).

 

Example:

Flash_Lc = FlashConfigSetGlobalProtection(FALSE);

Flash_Lc = FlashConfig_SetByteFlash(0xFFB0,0xFE); // 0xFE will be written to 7FD0 address

 

Note:

Don´t forget to switch to the "p" page in debugger to view a correct memory area.

 

Best Regards,

Vojtech Filip

Processor Expert Team

0 Kudos
528 Views
AJPinotti
Contributor II

Yes. It was exactly that!

Doing a setReg(FM_PROT,0x7FFF) before the commandsI could unprotect the sector I am wishing to write.

It worked in Debug. I am gonna do some more tests, after that I post here again. So far, this is my solution.

 

Thanks a lot!

 

Alexandre

0 Kudos