MQX K66 FTFE access error

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

MQX K66 FTFE access error

1,407 Views
ohadbenjamin
Contributor III

This is to inform anyone else that encounters this problem.

I was trying to read the program once registers located in the FTFE device.

When I tried accessing the FTFE device from a bareboard application I could read the registers without a problem, but when I tried accessing them from a MQX application I couldn't.

After debugging this problem for a few days it turns out the the FTFE device cannot be accessed when the MCU is set to run in HSRUN mode.

The FlashX driver does not have any mechanism to work around this problem so every access to the FTFE device in HSRUN mode will end up in error.

4 Replies

974 Views
ohadbenjamin
Contributor III

It turns out there is a function to set a different operation mode called _bsp_set_operation_mode.

There is one problem with it. It will only set HSRUN mode correctly, but not RUN mode.

In the HSRUN case there is this line:

SMC_PMCTRL |= (uint8_t)0x60UL;

There should be a similar line in the RUN case clearing those same bits:

SMC_PMCTRL &= (uint8_t)~0x60UL;

Finally, there is another problem I found in the FTFE device that won't let you write single bytes to it.

In the K60 there is a FTFL device. I could write single bytes to it (assuming those bytes are erased). With the K66 there is no way of writing single bytes.

The only way to write to the FTFE device is in blocks of 8 bytes. When trying to write a single byte the driver tries to set that byte to whatever value chosen. If there are bytes written in that block of 8 before it, the write will fail and lockup the device.

I think this sums up my last few days of working on the new K66 with the FTFE device...

974 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Ohad Benjamin:

Thank you very much for your input.

Regards

Daniel

0 Kudos
Reply

974 Views
nitinharish
Contributor V

SO what is the action on this ? I am also facing the same difficyulty.

The way I got around it is to define "#define MQX_ENABLE_HSRUN 0"

Is it OK to go ahead like this ?

0 Kudos
Reply

974 Views
yoramshacham
Contributor III

I wouldn't disable the HSRUN altogether - that may impact the overall performance of your system.

You should just disable HSRUN for the period of flash access.

{

    LPM_OPERATION_MODE  curmode;

   

    curmode = _lpm_get_operation_mode();

    _lpm_set_operation_mode(LPM_OPERATION_MODE_RUN);

   

     // Do your flash operations here

   

    _lpm_set_operation_mode(curmode); //return to previous run mode

}

0 Kudos
Reply