MQX K66 FTFE access error

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

MQX K66 FTFE access error

1,404 次查看
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 回复数

971 次查看
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...

971 次查看
danielchen
NXP TechSupport
NXP TechSupport

Hi Ohad Benjamin:

Thank you very much for your input.

Regards

Daniel

0 项奖励
回复

971 次查看
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 项奖励
回复

971 次查看
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 项奖励
回复