FEE driver for MC9S12XF512

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

FEE driver for MC9S12XF512

Jump to solution
2,726 Views
sravanithatha
Contributor II

Hi,

 

currently I am trying to understand Flash EEPROM Emulation module to implement it. when i am going through Autosar specification document, i found some term like internal management operation. There are many requirements which are related to this internal management operation.

 

One more thing, From FLS driver implementation i have the address locations for Block 0, Block 1N, Block 1S and D Flash. Here in FEE module i could see the naming conventions like Block Number and Offset. I am not able to understand how and what values to be given for those so that finally it will redirect to the physical location.

 

If anyone knows it, please clarify.

 

Thank you.

 

with Regards,

Sravani T

Labels (1)
Tags (1)
1 Solution
1,860 Views
RadekS
NXP Employee
NXP Employee

Hi sravani,

Could you please point me to document which you refers (with terms like internal management operation)?

Please be careful when in using drivers for emulated EEPROM. Some of drivers are written generally and you have to configure it properly. In fact, EEPROM could be emulated by software on almost any suitable flash memory.

On opposite side, S12XF already contains hardware feature for emulating EEPROM at internal D-Flash. This emulating is executed on hardware side and you have to only configure system for emulated EEPROM (only once) and enable/disable according your needs (EEEPROM functionality is disabled after reset).

In attachment you can find short description about emulated EEPROM at S12XE (the same is valid for S12XF), include example code.


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
11 Replies
1,861 Views
RadekS
NXP Employee
NXP Employee

Hi sravani,

Could you please point me to document which you refers (with terms like internal management operation)?

Please be careful when in using drivers for emulated EEPROM. Some of drivers are written generally and you have to configure it properly. In fact, EEPROM could be emulated by software on almost any suitable flash memory.

On opposite side, S12XF already contains hardware feature for emulating EEPROM at internal D-Flash. This emulating is executed on hardware side and you have to only configure system for emulated EEPROM (only once) and enable/disable according your needs (EEEPROM functionality is disabled after reset).

In attachment you can find short description about emulated EEPROM at S12XE (the same is valid for S12XF), include example code.


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
1,859 Views
sravanithatha
Contributor II

Hi Radek,

Thank you for sharing the detailed information about EEPROM Emulation.

The document which contains information about internal management operation is FEE SWS document from Autosar website.

With Regards,

Sravani T

0 Kudos
1,860 Views
RadekS
NXP Employee
NXP Employee

Hi sravani,

Thank you for point to Autosar document. I suppose that you mean this document:

http://www.autosar.org/fileadmin/files/releases/4-2/software-architecture/memory-stack/standard/AUTO...

In this case “internal management operation” means internal routines for emulated EEPROM driver.

As I already wrote, emulated EEPROM could be implemented by software driver or by hardware module (as in case of S12XE).

The flash could be erased only by sector, sector size could be quite big (1kB in case of P-Flash at S12XE) and number of write cycles is limited (typically 10k), therefore emulated EEPROM driver hast to manage many tasks for achieve behavior as “EEPROM” – it means ability update data per bits/bytes/words with high endurance (typically 100k cycles and more).

As “internal management operation” we could understand for example operation where EEEPROM driver collect latest data, copy it into new sector and erase some of older already used sectors for future use…


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
1,860 Views
sravanithatha
Contributor II

Hello RadekS,

i have tried the DFlash partition for EEPROM Emulation in my controller board.

Now i have reflashed a new software where i am not requesting any partition, as I wanted to use the DFlash normally.

But when i am trying to do erase sector it is giving the ACCESS_ERROR,

if((FSTAT & (FSTAT_ACCERR_MASK | FSTAT_FPVIOL_MASK)) != 0) return ACCESS_ERROR;

i have given address as 0x100000 (DFlash), to the below function:

unsigned char FLASH_Erase_Sector(unsigned long int address)

{

  //size of sector is 256B

  

  while(FSTAT_CCIF == 0);   //wait if command in progress

  FSTAT = 0x30;             //clear ACCERR and PVIOL

  FCCOBIX = 0x00;

  FCCOB = 0x1200 | ((address & 0x00FF0000UL)>>16);

  FCCOBIX = 0x01;

  FCCOB = (address & 0x0000FFF8UL);

 

  Send_Command();

  if((FSTAT & (FSTAT_ACCERR_MASK | FSTAT_FPVIOL_MASK)) != 0) return ACCESS_ERROR;

  if(FSTAT_MGSTAT != 0) return VERIFICATION_FAILED;  

  return OK;

}

So could you please help me in solving this issue. I am not sure why now it is giving error, maybe because of previous partitioning done or something else.

I tried to flash multiple times with few changes, and finally i am getting BDM error. please see the attachement. i am not able to flash and not even able to unsecure.

please help me.

0 Kudos
1,860 Views
RadekS
NXP Employee
NXP Employee

Hi sravani,

this is normal, that you cannot erase D-Flash sector when you partitioned that D-Flash for EEEPROM.

Debugger erases flash per sectors, but (part of) D-Flash is protected now against this kind of access.

So, you will have to use Erase All Blocks (mass erase) for discard partition information in D-Flash IFR.

Simplest way how to execute Erase All Blocks command is using Unsecure procedure.

For complete mass erase by BDM device(in special mode). In Code Warior debugger menu ->MultilinkCyclonePro->Unsecure…

If not work you can use unsecure12 from P&E:

http://www.pemicro.com/downloads/download_file.cfm?download_id=16

Unsecure_12 Help Files:

http://www.pemicro.com/downloads/download_file.cfm?download_id=14

Note: For downloading is necessary registration.

After Unsecure procedure, MCU will be blank again and you could use D-Flash as data flash.


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
1,860 Views
sravanithatha
Contributor II

Hi RadekS,

Thank you for the reply.

i have registered and downloaded the tool "unsecure_12_install".

Here now the issue is not ACCESS_ERROR.

Now i am not able to connect with the board. Its giving error like communication with target failed.

The target MCU has no clock or wrong BDM clock speed is used or derivate is secured.

actually i tried the unsecure in Code Warior debugger menu ->MultilinkCyclonePro->Unsecure.

that didnt work.

please help me.

Thank you.

0 Kudos
1,860 Views
RadekS
NXP Employee
NXP Employee

Hi sravani,

As recommendation says, please check power supply voltages, and clock settings.

Additionally please disable internal or external watchdogs:

  1. If you use EVB9S12XF512 board, please remove jumper J27. This will disconnect reset signal from SBC (MC33742, power supply + CAN PHY). Unfortunately we cannot trigger watchdog trough SPI in this SBC during programming.
  2. If you use internal watchdog and you initialize it by write FOPT value at address 0xFF0E, please edit reset cmd file (like P&E_Multilink_USB_Reset.cmd) and add there command “wb 0x03c 0x00 //disable cop”. This command will disable internal watchdog during every reset by debugger probe.

Of course, Unsecure12 could work only with PEmicro debugger tools like various Multilinks, CyclonePro or OSBDM.

One more recommendation: If you have more than one debugger connected to your PC, please disconnect all except one which you use for debugging.


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
1,860 Views
sravanithatha
Contributor II

Hello Radek,

I have checked the power supply, its fine. Jumper J27 is removed already.

The same code when i am trying to flash in some other working board its getting flashed.

but in the problem board that BDM error I got when i tried to connect. and when tried the unsecure option in P&E debugger, I got below error.

error.png

Even I tried the tool: unsecure_12_install from the link:

http://www.pemicro.com/downloads/download_file.cfm?download_id=16

when i tried to unsecure with this i got below error:

error3.png

please help me to recover the board.

Thank you.

With regards,

Sravani T

0 Kudos
1,858 Views
RadekS
NXP Employee
NXP Employee

Hi sravani,

CW told you that debugger cannot found command file for unsecure.

Please check whether your project contains file P&E_Multilink_USB_Erase_unsecure_hcs12.cmd in this path:

"..\<YOUR_PROJECT>\cmd\P&E_Multilink_USB_Erase_unsecure_hcs12.cmd"

For Unsecure12, please select XExxx/XSxxx in HC12 Type option.

Please double check your clock settings on board and enter into CW/Unsecure12 real oscillator clock frequency.


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,859 Views
sravanithatha
Contributor II

Hello Radek,

CW debugger has the correct path from the project, but still it shows the same error when i do unsecure command.

However with the unsecure tool which i installed in that i have selected the option of XExxx/XSxxx, It worked MCU is unsecured and could flash new s/w successfully.

Thank you so much for the quick replies which helped me alot.

With Regards,

Sravani T

0 Kudos
1,859 Views
RadekS
NXP Employee
NXP Employee

Hi sravani,

You're welcome.

I am glad that the problem has been resolved.

I wish you good luck in the future development.

Best Regards

RadekS

0 Kudos