flexspi_nor_flash_erase_sector is not working.

cancel
Showing results for 
Search instead for 
Did you mean: 

flexspi_nor_flash_erase_sector is not working.

147 Views
Contributor I

I am using MIMXrt1020 evk .I want to erase sector number 593. But whenever I enter in this instruction flexspi_nor_flash_erase_sector(EXAMPLE_FLEXSPI, 593 * SECTOR_SIZE); my controller goes into fault. Please suggest me the solution

0 Kudos
3 Replies

54 Views
Specialist V

Hi

Have a go with this reference:
https://www.utasker.com/iMX/RT1020.html

It shows the board using its QSPI flash as parameter, file system and firmware upload storage.

In order to test your sector number 593 you can use the command line menu (on UART, USB or Telnet) as follows:

 Input/Output menu
===================
up             go to main menu
md             Memory Display [address] [<l>|<w>|<b>] [num]
mm             Memory Modify [address] [<l>|<w>|<b>] [val]
mf             Memory Fill [address] [<l>|<w>|<b>] [val] [num]
sd             Storage Display {as md}
sm             Storage Modify {as mm}
sf             Storage Fill {as mf}
se             Storage Erase [address] [len-hex]
sr             Status read
sw             Status write
set_ddr        Set port type [1..4] [<i>|<o>
get_ddr        Get data direction [1..4]
read_port      Read port input [1..4]
write_port     Set port output [1..4] [0/1]
out            output value [hex]
save           Save port setting as default
help           Display menu specific help
quit           Leave command mode

#sd 60251000 b 100
Memory Display
0x60251000     ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
0x60251010     ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
0x60251020     ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
0x60251030     ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
0x60251040     ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
0x60251050     ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
0x60251060     ff ff ff ff  ....

sm 60251000 b 55
Write - OK

sd 60251000 b 10
Memory Display
0x60251000     55 ff ff ff ff ff ff ff ff ff  U.........

#sf 60251001 b 77 17
Fill - OK


sd 60251000 b 30
Memory Display
0x60251000     55 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77  Uwwwwwwwwwwwwwww
0x60251010     77 77 ff ff ff ff ff ff ff ff ff ff ff ff  ..............

#se 60251000 1
Erased

sd 60251000 b 30
Memory Display
0x60251000     ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
0x60251010     ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ..............


I am wondering whether your command should use
flexspi_nor_flash_erase_sector(EXAMPLE_FLEXSPI, (0x60000000 + (593 * SECTOR_SIZE)));
or whether your problem is that you have XIP code running in the spi flash device when you try to erase it, which would also fail.

Regards

Mark
[uTasker project developer for Kinetis and i.MX RT]

0 Kudos

54 Views
Contributor I

flexspi_nor_flash_erase_sector(EXAMPLE_FLEXSPI, 593* SECTOR_SIZE); I am using this instruction to erase flash as described in example code. But I don't know fault still occurs

0 Kudos

54 Views
NXP TechSupport
NXP TechSupport

Hello, 

Could you please confirm that you are not running this code as XIP in the SPI flash? Keep in mind that you cannot erase the flash while running from it. 

Regards, 

Victor 

0 Kudos