This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

FLASH API REFERENCE UNDERSTANDING

Hi

I have already posted a question regarding flash api.

Unfortunately I am not able to get the appreciable answer.

I need few help regarding the api.

I have attached the reference code provided

  UINT32 k;
      /* enable CLEAN macro (if applicable) */
      ENA_CLEAN;
      /* retrieve MAC2 value and enable the appropriate core */
      k=cntl[MAC2];CLEAN(k);cntl[MAC2]=(k&~0x7)|core;
      /* disable level 1 sector protection */
      k=cntl[MAC1];CLEAN(k);cntl[MAC1]=(k|0x8000);
      /* 0x2fc0 = TCR=0 */
      cntl[TCR]=0x2fc0;
      /* start VNV steps at 0, Max programming pulses */
      cntl[MAXPP]=0x0000+MAX_PROG_PLS;
      /* 16 pulses per VNV step, Max compaction pulses */
      cntl[MAXCP]=0xf000+MAX_CMPCT_PLS;
      /* retrieve MAXEP */
      k=cntl[MAXEP];CLEAN(k);
      /* disable CLEAN macro (if applicable) */
      DIS_CLEAN;
      /* Check for Baseline 4 material */
      if ((k&0xf000)==0xf000) {
      /* VHV = 9.0v during erase */
      cntl[PTR3]=0x9964;
      /* Max VNV step = 0xf */
      cntl[MAXEP]=(0xf000+MAX_ERASE_PLS);
      } else { /* Baseline > 4 */
      /* VHV = 9.0v during erase */
      cntl[PTR3]=0x9b64;
      /* Max VNV step = 0xa */
      cntl[MAXEP]=(0xa000+MAX_ERASE_PLS);
      }
      /* Set Vread to 5.0v */
      cntl[PTR4]=0xa000;
      /* Program setup = 500nS, Erase setup = 8uS */
      cntl[PESETUP]=((delay<<8)|(delay<<4));
      /* ProgVer access = 1us, ErsVer access = 1us */
      k=(delay<<8|delay)<<1;
      cntl[PVEVACCESS]=k;
      /* Program hold = 1us, Compaction hold = 1us */
      cntl[PCHOLD]=k;
      /* PrgVer hold = 1us, ErsVer hold = 1us */
      cntl[PVEVHOLD]=k;
      /* PrgVer setup = 1us, ErsVer setup = 1us */
      cntl[PVEVSETUP]=k;
      /* CmpctVer access = 8us */
      cntl[CVACCESS]=(delay<<4);
      /* Compaction setup = 10us */
      k=(delay*20);
      cntl[CSETUP]=(0x3000|k);
      /* Erase hold = 40us */
      cntl[EHOLD]=(k<<2);
      /* Program pulse width */
      cntl[PWIDTH]=(delay*PROG_PLS_WIDTH);
      /* Compaction pulse width */
      cntl[CWIDTH]=(delay*CMPCT_PLS_WIDTH);
      /* Erase pulse width */
      cntl[EWIDTH]=(delay*ERASE_PLS_WIDTH);

Kindly let me know does the flash really needs 9 volts pump charger for erasing the flash!
On what basics that is calculated. I am not able to find calculation and what could be done
My board is getting reset exactly after the commands are executed

init_state_machine_D(core,delay,cntl);
 /* clear status register */
          *(volatile UINT16 *)start=0x40;
      /* Validate Sector command */
          *(volatile UINT16 *)start=0x1000;
      /* Dummy data value */
          *(volatile UINT16 *)start=0xffff;
      /* track compaction pulses */
Not sure what is causing the issue
Kindly request you to help out with appreciable answer!

Thank you
Deepak R




  • Deepak,
    You should not be modifying the source code to the API. These parameters are set for proper operation and reliability. Modification will void warranty and may cause FLASH array corruption.
    You should only be calling the API routines from your code without modification.

    As mentioned earlier, please reference the Software Peripheral Drivers and the API release documents for proper use.
    Regards,
    Wade
  • Hi

    wade

    I am trying to use the api as provided ,But when I try to do step execution debugging.

    I am able to see the erase and write content to flash,

    But when I try downloading the code and I run it by rest board. The board exactly resets at the clear status instruction repeatedly.

    This I am able to find by debugging through prints.

    I have attached the code part for reference

     sleep(1);
            *(volatile UINT16 *)start=0x40;
            sleep(1);
            *(volatile UINT16 *)start=0x1000;                         /* Validate Sector command */
            //sleep(10);
            *(volatile UINT16 *)start=0xffff;                         /* Dummy data value */
            sleep(1);
             send_str("<-----sending command---------->\n");
            /* track compaction pulses */   

    When clear status is executed the boars resets itself.

    I have my code in the flash address 0x00000080 BANK1 and I am trying content to BANK2 0X00080000

    My device is SM470R1B1M

    Let me know the tips I have already gone through the document of the peripheral you have specified,

    Hope this is not tried by many users!

    WADE HELP ME OUT WHAT CHANGES COULD BE DONE!!!!

    Thanks

    Deepak R