Skip to main content
Pooja WANI
Associate III
November 20, 2019
Question

I am using DFLASH for storing data at multiple locations. Code is attached below. "READ MEMORY BLOCK FAILED" error.

  • November 20, 2019
  • 1 reply
  • 1560 views

#include "components.h"

unsigned int i, location_no, data[9];

int main(void)

{

/* Memory Unlock */

DFLASH.LML.R = 0xA1A11111;  //write password

DFLASH.LML.R = 0x00000000;  //unlock all 4 16k blocks

DFLASH.SLL.R = 0xC3C33333;  //write password

DFLASH.SLL.R = 0x00000000;  //unlock all 4 16k blocks

/* Read */

for(location_no=0; location_no<9; location_no++)

{

data[location_no] = *(unsigned int *)(0x00800000 + (location_no << 2));

}

/* Erase */

DFLASH.MCR.B.ERS = 1;   //erase operation

DFLASH.LMS.R = 0xF;     //select all 4 block for erase

*(unsigned int *)0x0080FFFC = 0xFFFFFFFF;  //interlock write

DFLASH.MCR.B.EHV = 1;

while((DFLASH.MCR.B.DONE != 1) && (DFLASH.MCR.B.PEG != 1));

DFLASH.MCR.B.EHV = 0;

DFLASH.MCR.B.ERS = 0;

/* Program */

DFLASH.MCR.B.PGM = 1;   //Program operation

//*(unsigned int *)0x00800000 = 0xAABBCCDD;  //interlock write

for(location_no=0; location_no<9; location_no++)

{

*(unsigned int *)(0x00800000 + (location_no << 2)) = 0xAABBCC*location_no;

DFLASH.MCR.B.EHV = 1;

while((DFLASH.MCR.B.DONE != 1) && (DFLASH.MCR.B.PEG != 1));

DFLASH.MCR.B.EHV = 0;

}

DFLASH.MCR.B.PGM = 0;

  return 0;

}

When I am trying to write word by word to multiple locations, while writing 4th word, an error is occured.. READ MEMORY BLOCK FAILED. However, next 5 locations are written successfully.

Screenshot is attached below.

I am looking forward for the reply.

Thanks and Regards,

Pooja WANI

    This topic has been closed for replies.

    1 reply

    Erwan YVIN
    ST Employee
    November 28, 2019

    Hello ,

    Could you tell more details of your Program Counter (By Assembler) ?

    we do not know where the program is.

    Best Regards

    Erwan

    Pooja WANI
    Associate III
    December 2, 2019

    Some screenshots from PLS UDE window are attached herewith. Please help me to find out the solution. I am blocked here since last two weeks.

    0690X00000At9nvQAB.png0690X00000At9nqQAB.png0690X00000At9nlQAB.png

    Thank you.