1 2 3 Previous Next 34 Replies Latest reply on Aug 9, 2019 4:15 AM by SudheeshK_26 Go to original post
      • 30. Re: S29GL256S10DHV020  is not writing to the FLASH .
        CHKA_4329876

        Hi Sudheesh ,

         

        I have implemented Read Device ID using Common FIash Interface  and also to ERASE SECTOR and Write data to FLASH .

        For all these I have used Delay mechanism and would like to know how to get the status bit read correctly done .

         

        I tried to use Status bit read while writing to NOR FLASH but it never returns correct status .

         

        Following is the implementation with delays that work.

         

        // SECTOR ERASE

        // COMPLETE CHIP ERASE COMMAND REQUIRES 70 SECODNS

        {

        (*(( (volatile unsigned short*)((0x60000000)) )  + ((0)))) = (((0xF0)*0x00000001));

        (*(( (volatile unsigned short*)((0x60000000)) ) + ((0x00000555)))) = (((0xAA)*0x00000001));

        (*(( (volatile unsigned short*)((0x60000000)) ) + ((0x000002AA)))) = (((0x55)*0x00000001));

        (*(( (volatile unsigned short*)((0x60000000)) ) + ((0x00000555)))) = (((0x80)*0x00000001));

        (*(( (volatile unsigned short*)((0x60000000)) ) + ((0x00000555)))) = (((0xAA)*0x00000001));

        (*(( (volatile unsigned short*)((0x60000000)) ) + ((0x000002AA)))) = (((0x55)*0x00000001));

        (*(( (volatile unsigned short*)((0x60000000)) )  )) = (((0x30)*0x00000001)); // SECTOR ERASE

        //(*(( (volatile unsigned short*)((0x60000000)) ) + ((0x00000555)))) = (((0x10)*0x00000001)); // CHIP ERASE

        for(delay=0;delay<65535;delay++);

        for(delay=0;delay<65535;delay++);

        for(delay=0;delay<65535;delay++);

        for(delay=0;delay<65535;delay++);

        for(delay=0;delay<65535;delay++);

        for(delay=0;delay<65535;delay++);

        for(delay=0;delay<65535;delay++);

        for(delay=0;delay<65535;delay++);

        for(delay=0;delay<65535;delay++);

        for(delay=0;delay<65535;delay++);

        for(delay=0;delay<65535;delay++);

        for(delay=0;delay<65535;delay++);

        for(delay=0;delay<65535;delay++);

        for(delay=0;delay<65535;delay++);

        for(delay=0;delay<65535;delay++);

        (*(( (volatile unsigned short*)((0x60000000)) )  + ((0)))) = (((0xF0)*0x00000001));

        }

         

        for(Read=0;Read<19;Read++) // read DEVICE ID by CFI

        {

        (*(( (volatile unsigned short*)((0x60000000)) ) + ((0x00000555)))) = (((0xAA)*0x00000001));

        (*(( (volatile unsigned short*)((0x60000000)) ) + ((0x000002AA)))) = (((0x55)*0x00000001));

        (*(( (volatile unsigned short*)((0x60000000)) ) + ((0x00000555)))) = (((0x90)*0x00000001));

        Device_ID[Read] = (unsigned char)((*(( (volatile unsigned short*)((0x60000000)) ) + ((0x0080+Read)))) & 0x000000FF) ;

        (*(( (volatile unsigned short*)((0x60000000)) )  + ((0)))) = (((0xF0)*0x00000001));

        }

         

         

        //lld_ProgramCmd(base_address_nor_flash,offset++,source_address++);

        for(Write_Nor=0;Write_Nor<65535;Write_Nor++)

        {

        (*(( (volatile unsigned short*)((0x60000000)) ) + ((0x00000555)))) = (((0xAA)*0x00000001));

        (*(( (volatile unsigned short*)((0x60000000)) ) + ((0x000002AA)))) = (((0x55)*0x00000001));

        (*(( (volatile unsigned short*)((0x60000000)) ) + ((0x00000555)))) = (((0xA0)*0x00000001));

        ((*(( (volatile unsigned short*)((0x60000000)) ) + ((Write_Nor)))))= Write_Nor;

        for(delay=0;delay<5000;delay++);

        (*(( (volatile unsigned short*)((0x60000000)) )  + ((0)))) = (((0xF0)*0x00000001));

        }

         

        NOR FLASH READING CFI COMPLTED FULL WRITE.png

         

         

        I am using following to check the status of write process :-

         

        #define DEV_RDY_MASK      (0x80*0x00000001) /* Device Ready Bit */

         

        FLASHDATA lld_Poll

        (

        FLASHDATA * base_addr,          /* device base address in system */

        ADDRESS offset                 /* address offset from base address */

        )

        {      

          unsigned long polling_counter = 0xFFFFFFFF;

          volatile FLASHDATA status_reg;

         

         

          do

          {

            polling_counter--;

            lld_StatusRegReadCmd( base_addr );    /* Issue status register read command */

            status_reg = FLASH_RD(base_addr, offset);       /* read the status register */

            if( (status_reg & DEV_RDY_MASK) == DEV_RDY_MASK  )  /* Are all devices done bit 7 is 1 */

              break;

         

         

          }while(polling_counter);

         

          return( status_reg );          /* retrun the status reg. */

        }

        • 31. Re: S29GL256S10DHV020  is not writing to the FLASH .
          CHKA_4329876

          Hi Sudheesh ,

           

          I need help with Buffer Writing to Flash algorithm Page 43 of CYPRESS S29GL256S NOR FLASH .

           

          Following code is as per LLD driver I am using and for 1st time the 512 Bytes is getting written to FLASH .

          second time the write fails to write the 512Bytes so on .

           

          for(Write_Nor=0;Write_Nor<0x100;Write_Nor++)

          {

              (*(( (volatile unsigned short*)((0x60000000)) )  + ((0)))) = (((0xF0)*0x00000001));             // Reset Command

          // Write to Buffer

          (*(( (volatile unsigned short*)((0x60000000)) ) + ((0x00000555)))) = (((0xAA)*0x00000001));

          (*(( (volatile unsigned short*)((0x60000000)) ) + ((0x000002AA)))) = (((0x55)*0x00000001));

          (*(( (volatile unsigned short*)((0x60000000)) ) + ((Count_Words)))) = (((0x25)*0x00000001));

          (*(( (volatile unsigned short*)((0x60000000)) ) + ((Count_Words)))) = 128; // writing 128 bytes at a time to buffer

          for(Write_Buffer=0;Write_Buffer<256;Write_Buffer++)

          {

          ((*(( (volatile unsigned short*)((0x60000000)) ) + ((Write_Buffer))+((Count_Words)))))= 0xABCD;

          }

           

          (*(( (volatile unsigned short*)((0x60000000)) )  + ((0)))) = (((0xF0)*0x00000001));             // Reset Command

          // Write from Buffer to NOR Flash 512 Bytes

          (*(( (volatile unsigned short*)((0x60000000)) ) + ((0x00000000))+((Count_Words)))) = (((0x29)*0x00000001)); // program buffer to flash

          for(delay=0;delay<5000;delay++); // 4000 * 30 ASM instructions * 5.55 nano seconds = 660000 nano seconds

          (*(( (volatile unsigned short*)((0x60000000)) )  + ((0)))) = (((0xF0)*0x00000001));             // Reset Command

          Count_Words+=512;

          (*(( (volatile unsigned short*)((0x60000000)) )  + ((0)))) = (((0xF0)*0x00000001));             // Reset Command

          }

           

           

          Attached is the NOR FLASH data written details .

           

           

          buffer writing.png

          • 32. Re: S29GL256S10DHV020  is not writing to the FLASH .
            SudheeshK_26

            Hi,

             

            As per my understanding, you were able to perform write buffer program operation twice successfully and it failed from third time onward. Is my understanding correct? Are you polling status register after every write to buffer program operation to make sure device is not busy before next program operation? Can you please let me know the value in status register when this failure happens?

             

            Thanks and Regards,

            Sudheesh

            • 33. Re: S29GL256S10DHV020  is not writing to the FLASH .
              CHKA_4329876

              Hi ,

               

              Yes your Understanding is Correct .

              I am confirming to write 256 Bytes from buffer to Flash  2 time total of 512 Bytes  are written to NOR FLASH , The third time the device gets locked or some status that I HAVE to recover the device only with power restart  .

              Does Cypress provide and API that has the Buffer based programming implemented .

              I must be doing wrong with API implementation . could not verify if the polling method I implemented is correct

               

              The source code is as follows .

              for(Write_Nor=0;Write_Nor<0x10000;Write_Nor++)

              {

                  (*(( (volatile unsigned short*)((0x60000000)) )  + ((0)))) = (((0xF0)*0x00000001));             // Reset Command

               

              // Write to Buffer

              (*(( (volatile unsigned short*)((0x60000000)) ) + ((0x00000555)))) = (((0xAA)*0x00000001));

              (*(( (volatile unsigned short*)((0x60000000)) ) + ((0x000002AA)))) = (((0x55)*0x00000001));

              (*(( (volatile unsigned short*)((0x60000000)) ) + ((Count_Words)))) = (((0x25)*0x00000001));

              (*(( (volatile unsigned short*)((0x60000000)) ) + ((Count_Words)))) = 128; // writing 128 bytes at a time to buffer

              for(Write_Buffer=0;Write_Buffer<128;Write_Buffer++)

              {

              ((*(( (volatile unsigned short*)((0x60000000)) ) + ((Write_Buffer))+((Count_Words)))))= 0xABCD;

              }

               

              (*(( (volatile unsigned short*)((0x60000000)) )  + ((0)))) = (((0xF0)*0x00000001));             // Reset Command

               

              // Write from Buffer to NOR Flash 256 Bytes

              (*(( (volatile unsigned short*)((0x60000000)) ) + ((0x00000000))+((Count_Words)))) = (((0x29)*0x00000001)); // program buffer to flash

              // Keep Polling for status Do not know if the polling method I implemented is correct

              while((((Status_read=((*(( (volatile unsigned short*)((0x60000000)) ) + ((Write_Buffer))+((Count_Words))))))) & 0x80) == 1);

              while((((Status_read=((*(( (volatile unsigned short*)((0x60000000)) ) + ((Write_Buffer))+((Count_Words))))))) & 0x40) == 1);

              while((((Status_read=((*(( (volatile unsigned short*)((0x60000000)) ) + ((Write_Buffer))+((Count_Words))))))) & 0x02) == 1);

              while((((Status_read=((*(( (volatile unsigned short*)((0x60000000)) ) + ((Write_Buffer))+((Count_Words))))))) & 0x80) == 1);

               

              // additional delay time if polling fails

              for(delay=0;delay<10000;delay++); // 10000 * 30 ASM instructions * 5.55 nano seconds = 1665000 nano seconds

               

              // Reset command

              (*(( (volatile unsigned short*)((0x60000000)) )  + ((0)))) = (((0xF0)*0x00000001));             // Reset Command

              Count_Words+=128;

              }

               

              Image step 1 after full CHIP ERASE FUNCTION:

              first iteration.png

               

              Image step 2 after 1st time 256 bytes writing:

              second iteration.png

               

              Image step 3 after 2nd time 256 bytes writing:

               

              third iteration.png

              Image step 4 after device gets locked:

               

              • 34. Re: S29GL256S10DHV020  is not writing to the FLASH .
                SudheeshK_26

                Hi,

                 

                Sorry for the delay. Implementation of polling doesn't look correct. Please check the table "Table 5.3 Data Polling Status" given on page 39 of the datasheet, https://www.cypress.com/file/177976/download . You have to read continuously and check the data lines (DQ7, DQ6, DQ5, DQ3, DQ2, DQ1) to know the device status.

                 

                Error conditions for write buffer programming operations are given in the last row of this table.

                 

                Thanks and Regard,s

                Sudheesh

                1 2 3 Previous Next