1 Reply Latest reply on Jun 25, 2018 7:57 PM by ShipingW_81

    MB95f778L  SA0 ERASING and WRITTING

      Hello All,

      I need to Erase and Write the SA0 Sector in MB95F778L, but i am not able write the data into that,can any one help me on this please.

       

      below i mentioned my example code for erasing and writing the data.(This same code is working well for SA3 sector)

      Note::

      SSEN bit is enabled.

      SWRE0 = 0x0F;

       

      For Sector erasing::

      {

        __wait_nop();

        __wait_nop();

        FSR_WRE = 1;

        __wait_nop();

        __wait_nop();

      SWRE0 |= DUALFLASH_APPL_WEN_MASK;

        __DI();

        *((uint8_t*)((SectorStartAddress & 0xF000) | 0x0AAA)) = 0xAA;

        *((uint8_t*)((SectorStartAddress & 0xF000) | 0x0554)) = 0x55;

        *((uint8_t*)((SectorStartAddress & 0xF000) | 0x0AAA)) = 0x80;

        *((uint8_t*)((SectorStartAddress & 0xF000) | 0x0AAA)) = 0xAA;

        *((uint8_t*)((SectorStartAddress & 0xF000) | 0x0554)) = 0x55;

        *((uint8_t*)SectorStartAddress) = 0x30;

        __wait_nop();

        __wait_nop();

        __EI();

      }

       

      For Sector Writting:

      {

        __DI();

      FSR_WRE = 1;

        __wait_nop();

        __wait_nop();

        SWRE0 |= DUALFLASH_APPL_WEN_MASK;

        *((uint8_t*)((Address & 0xF000) | 0x0AAA)) = 0xAA;

        *((uint8_t*)((Address & 0xF000) | 0x0554)) = 0x55;

        *((uint8_t*)((Address & 0xF000) | 0x0AAA)) = 0xA0;

      *((uint8_t*)(Address)) = u8Data;

      __wait_nop();

      __wait_nop();

      while (!FSR_RDY);

      __EI();

      }

       

      Thanks

      Anil Kumar VEMULA

        • 1. Re: MB95f778L  SA0 ERASING and WRITTING
          ShipingW_81

          Hello,

           

          When you tried to update the SA0 location, which bootloader executed the erase/write commands, at SA1 or SA2?

          I expect that the bootloader at SA1 issued the erase/write commands to update SA3 and SA0.

           

          The dual operation flash memory of MB95770 consists of two banks and cannot be erased/programmed and read (instruction-fetched) at the same time in bank on the same side.

          SA0 and SA1 are located in the same bank, while SA2 and SA3 are located in another bank.

          So, the bootloader at SA1 can erase/write the SA3, but cannot do the SA0.

          The bootloader at SA2 can erase/write the SA0, but cannot do the SA3.

           

          Please try erase/write the SA0 from the bootloader at SA2.