1 Reply Latest reply on Sep 18, 2018 6:09 AM by SudheeshK_26

    Problem wirting data on CY15B104Q

      Dear all I'm using CY15B104Q memory controlled using a pearl gecko and I have noticed that in order to properly write the info on the memory some times I have to retry the procedure many times.

       

      The SPI driver is configured in mode 0 and the clock frequency of the processor is set @38 MHz and the clock speed of the SPI is set @5MHz.

       

      This is the code of the function that I use to write the data on to the F-RAM:

       

      int SHM_FRAM_WriteData(SPIDRV_Handle_t handle, uint32_t addr,uint16_t data)
      {
        uint8_t bufferTx[10] = {};

        bufferTx[0] = FRAM_WREN;
        SHM_Config_FRAM_SPI_CS_Enable(false);
        SPIDRV_MTransmitB(handle,bufferTx,1);
        SHM_Config_FRAM_SPI_CS_Enable(true);

        bufferTx[0]= FRAM_WRITE;
        bufferTx[1]=(addr&0x00070000)>>16;
        bufferTx[2]=(addr&0x0000FF00)>>8;
        bufferTx[3]=(addr&0x000000FF);
        bufferTx[4]=(data&0xFF00)>>8;
        bufferTx[5]=(data&0x00FF);

        SHM_Config_FRAM_SPI_CS_Enable(false);
        SPIDRV_MTransmitB(handle, bufferTx,6);
        SHM_Config_FRAM_SPI_CS_Enable(true);

        return 0;
      }

       

      Using this function if i try to read back immediately the data written what I read is different so in order to avoid this I have implemented a function that force the write operation until when I read back the data I got what I have wrote previously.

       

      This is the code of the function:

       

      int SHM_FRAM_WWriteData(SPIDRV_Handle_t handle, uint32_t addr,uint16_t data)

      {

        uint16_t rData;

        SHM_FRAM_WriteData(handle,addr,data);

        SHM_FRAM_ReadData(handle,addr,&rData);

        while(data!=rData)

        {

          SHM_FRAM_WriteData(handle,addr,data);

          SHM_FRAM_ReadData(handle,addr,&rData);

        }

        return 0;

      }

       

      With the SPI @5MHz I have measured that the 70% of the write attempt fail at first instance and the situation get worst if I try to increase the speed of the SPI.

       

      Any suggestion on the possible cause of this behavior?

        • 1. Re: Problem wirting data on CY15B104Q
          SudheeshK_26

          Hi Filipo,

           

          We would like to know some more details about this issue.

           

          1. How many devices are showing this issue? Are you observing it with all of the devices that you tested?

          2. Can you share the waveform (SPI signals: CS#, SCK, MOSI and MISO) for write operation (WREN + WRITE commands)?

          3. What is the data that you write and read back when this issue happens? Are you reading data as 0x00?

           

          Thanks and Regards,

          Sudheesh