How to use DFlash in MQX4.1?

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

How to use DFlash in MQX4.1?

637 Views
wangpengchengwa
Contributor I

How to use DFlash in MQX4.1?My hardware platform is TWR-K20D72M DEMO V1.0! Flashx drive contains only the PFalsh with FlexRAM, I added a block address DFlash inside,and changes the ftfl_flash_erase_sector and ftfl_flash_write_sector function in command_array [1] = (uint8_t) (write_addr >> 16) | (uint8_t) (((write_addr >> 21) & 0x00000080)); but now the situation is that to read and write is no problem, but it does not erase Falsh sector !MyPlase help me!

Tags (2)
0 Kudos
4 Replies

388 Views
RadekS
NXP Employee
NXP Employee

For allow FlashX write into D-Flash you should:

  1. Edit _flashx_kinetisX_block_map[] in flash_ftfl.c file and add there D-Flash block(s)
  2. Edit _bsp_flashx_file_blocks[] in init_flashx.c file and add there D-Flash block(s)
  3. Set BSPCFG_ENABLE_FLASHX to “1” in user_config.h
  4. Define FlashX addresses in twrk20d72.h file

Attached files with modifications are for twrk40d100. You can take it as inspiration.

Note: unused command “#define __FLASHX_START_ADDR    ((void *)Image$$USEDFLASH_END$$Base)” is special “magic” command which will cause that __FLASHX_START_ADDR will be filed by address where your code ends = FlashX region will be placed just behind you code. In our case we want place FlashX region to FlexNVM therefore we define __FLASHX_START_ADDR directly.

0 Kudos

388 Views
wangpengchengwa
Contributor I

thanks!

0 Kudos

388 Views
neoxiong
NXP Employee
NXP Employee

Thanks for your code, Have you tested program & erase operation?

I agree with wangpengcheng that flash_ftfl.c should be changed, to make address meet FTFL's requirement.  I don't see it in your code.

    write_addr = (_mem_size) from_ptr;

    if(write_addr & 0x10000000)

         write_addr |= 0x00800000;

0 Kudos

388 Views
wangpengchengwa
Contributor I

看你名字应该也认识中文,谢谢你啦,我搞定了,呵呵,你说的那个很实用!

0 Kudos