something wrong with flashx

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

something wrong with flashx

990 Views
tifentan
Contributor I

i am using k60d100m with 512 flash.

const FLASHX_FILE_BLOCK _bsp_flashx_file_blocks[] = {
{ "bank0", BSP_INTERNAL_FLASH_BASE, BSP_INTERNAL_FLASH_BASE + (BSP_INTERNAL_FLASH_SIZE / 2) - 1 },
{ "bank1", BSP_INTERNAL_FLASH_BASE + (BSP_INTERNAL_FLASH_SIZE / 2), BSP_INTERNAL_FLASH_BASE + (BSP_INTERNAL_FLASH_SIZE ) - 1 },
// swap file definition according to the default value of BSPCFG_SWAP_INDICATOR_ADDR and sector size
{ "swap0", BSP_INTERNAL_FLASH_BASE, BSP_INTERNAL_FLASH_BASE + (BSP_INTERNAL_FLASH_SIZE / 2) - (1 + BSP_INTERNAL_FLASH_SECTOR_SIZE) },
{ "swap1", BSP_INTERNAL_FLASH_BASE + (BSP_INTERNAL_FLASH_SIZE / 2), BSP_INTERNAL_FLASH_BASE + (BSP_INTERNAL_FLASH_SIZE ) - (1 + BSP_INTERNAL_FLASH_SECTOR_SIZE) },
// flash space used by application
{ "code", BSP_INTERNAL_FLASH_BASE, (uint32_t)__FLASHX_START_ADDR - 1 },
// remaining free flash space
{ "", (uint32_t)__FLASHX_START_ADDR, (uint32_t)__FLASHX_END_ADDR },
{ NULL, 0, 0 }
};

i open the bank0 and write() the last sector(3F800 - 3FFFF),it is invalid.

error form  ftfl_flash_erase_sector(),error code FTFL_ERR_PVIOL,Seems to be protected.

also the bank1 last sector(7F800 - 7FFFF) is not working.

but i had try the next to last sector(3F000-3F7FF) is ok.

why is that happened?can i  use bank0  and bank1 as last sector?

0 Kudos
Reply
7 Replies

748 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Tifen:

Which MQX version you are using, 4.1, 4.2, or 4.2.0.2?

Regards

Daniel

0 Kudos
Reply

748 Views
tifentan
Contributor I

Thank you for your reply,Daniel.

It's 4.2

And I try in 4.1, the same results.

I found that for the first time the sector is blank(FF), you can write() correctly.

but after the restart it can not write.

0 Kudos
Reply

748 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Tifen:

You can use the last sector,  maybe your last sector is protected in your project, you need to unprotecting the FLASH before you do it

    /* Unprotecting the the FLASH might be required */
    ioctl_param = 0;
    ioctl(flash_file, FLASH_IOCTL_WRITE_PROTECT, &ioctl_param);

There is a flashx demo in the MQX installation folder, which writes string of  characters into the memory and reads it back. You can refer to it

C:\Freescale\Freescale_MQX_4_2\mqx\examples\flashx

Regards

Daniel

0 Kudos
Reply

748 Views
tifentan
Contributor I

Hi Daniel:

I had try the C:\Freescale\Freescale_MQX_4_2\mqx\examples\flashx demo.

here are the prints:

MQX Flash Example
Flash file flashx:bank0 opened
Size of the flash file: 0x40000 Bytes
Flash sector cache enabled.
Reading last 32 Bytes.
String found:
Type a string to be written to the end of file (31 chars max.):45454

Error writing to the file. Error code: 2563
Flash example finished.

I used to run  the Freescale_MQX_4_2\mqx\examples\flashx_swap,would that affected?

Regard!!

0 Kudos
Reply

748 Views
danielchen
NXP TechSupport
NXP TechSupport

I don't think it would affect. But I can't reproduce your issue in my side,  it seems there are some errors in the last sector, could you erase it and try it again?

I also suggest you patch with the latest MQX patch 4.2.0.2,  this patch fixed one issue for FTFL.

Regards

Daniel

0 Kudos
Reply

748 Views
tifentan
Contributor I

I update to 4.2.0.2 this morning.it seems not working.

I step into the write() code and find that it erase the sector by call _io_flashx_erase_sector() in _io_flashx_write_partial_sector().

And the error just come from the _io_flashx_erase_sector(),error code FTFL_ERR_PVIOL.

here is the call stack:

ftfl_flash_command_sequence

   ftfl_flash_erase_sector

      _io_flashx_erase_sector

           _io_flashx_write_partial_sector

              _io_flashx_write

                     _io_write

It seems can not erase the last sector.   -o-!

however,thank you!

QQ图片20160831172128.png

by the way,你会说中文吗

0 Kudos
Reply

748 Views
danielchen
NXP TechSupport
NXP TechSupport

The console print in my side is:

pastedImage_2.png

0 Kudos
Reply