3 Replies Latest reply on Apr 18, 2018 9:28 AM by e.pratt_1639216

    Any way to software reset executed when the power is turned on?

    ueda-r_2674311

      Hello everyone.

      I'm using CYBLE-012011-00, can I execute software reset when the power is turned on?

      I wrote program that control NAND flash memory(LSM330TR) but I couldn't execute block erase command without execute software reset, CySoftwareReset() after the power is turned on.

      The NAND is in un protected mode.

      Can anyone help me solve this problem?

        • 1. Re: Any way to software reset executed when the power is turned on?
          e.pratt_1639216

          I can only find the chip you listed as: iNEMO inertial module: 3D accelerometer and 3D gyroscope from STM.

          My guess is that the CySoftwareReset() is causing some pins/hardware to toggle/change which in turn finishes the erase cycle from your NAND. The flash chip for the NAND should have a datasheet describing how to finish the erase sequence: power cycle probably?

          • 2. Re: Any way to software reset executed when the power is turned on?
            ueda-r_2674311

            Thank you for your reply, e.pratt. 

            Sorry I made a mistake. I'm using W25M02GV, not LSM330TR.

            https://www.winbond.com/resource-files/w25m02gv%20revb%20070115.pdf

             

            I checked the delete sequence and the electrical characteristics.

            This block erase program sends erase command on SPI connection, and it continue to read the erase failure bit while erase isn't complete.

            I don't know why this erase program runs completely only after a software reset.

            I inserted enough delay after NAND power is turned on.

             

            If there are some mistakes in English, I'd like to apologize.

             

             

            void W25M02G_128kbBlockErase(uint16 pageAddr)

            {

                W25M02G_WriteEnable();                          //disable write protect

                CyDelay(1);

                SPIM_SpiUartClearRxBuffer();                    //clear RX buffer

                SPIM_SpiUartClearTxBuffer();                    //clear TX buffer

               

                uint8 pageH = pageAddr >> 8;                    //page address

                uint8 pageL = (pageAddr & 0x00ff);            //page address

                CyDelay(1);

                MEM_CS_Write(0);     //NAND SPI Chip Select Signal Low

                CyDelay(1);

                SPIM_SpiUartWriteTxData(W25M02G_128KB_BLOCK_ERASE); //block erase command

                SPIM_SpiUartWriteTxData(0x00);                    //dummy clock

                SPIM_SpiUartWriteTxData(pageH);                 //page address

                SPIM_SpiUartWriteTxData(pageL);                  //page address

                while(SPIM_SpiUartGetRxBufferSize() != 4){}     //wait for send complete

                MEM_CS_Write(1);     //NAND SPI Chip Select Signal High

                while(1)

                {

                    uint8 sts3 = 0x00;                         

                    sts3 = W25M02G_ReadStatusRegister(0xC0);    //read status register3 for erase failure bit

                    if((sts3&0x01)==(0 << 0))

                    {

                        ERR_LED_Write(1);

                        CyDelay(20);

                        if((sts3&0x04)==(1 << 2))   //if delete failure bit is 1

                        {

                                //go to infinity loop to wait erase complete

                                //continue staying here if not execute software reset!!

                        }

                        else                        //else if delete is finished

                        {

                            return;

                        }

                    }

                }

            }

            • 3. Re: Any way to software reset executed when the power is turned on?
              e.pratt_1639216

              My guess is that it is working properly for the erase and your method of checking the RX byte count getting to 4 or the W25M02G_ReadStatusRegister(0xC0); command are not working, causing the chip to sit in an infinite wait. A reset will then exit out of the infinite loop and go back to main with the "erase" being "completed" before you even reset the chip.

               

              THE CS going high triggers the erase, and resetting the cypress chip will cause the CS pin to go high. Thus, that would be my direction of inquiry

               

              SPIM_SpiUartGetRxBufferSize() has slightly different behavior with or without the RX software buffer enable. Try turning that on/off?

              If you enable the SPI interrupts and set the RX FIFO level to 4, then use an interrupt, you can verify that the SPI is sending all of the bytes properly. Most likely the SPI RX buffer is properly returning 4 however, but it doesn't hurt to double check.

              Try replacing:

              if((sts3&0x04)==(1 << 2))

              with:

              if(!(sts3 & 0x02))

              to make sure the bits are lining up in the status register.

              Also, it could be your code in the function: W25M02G_ReadStatusRegister(0xC0);

              is not working correctly and returns invalid data.

               

               

              1 of 1 people found this helpful