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.

SM28VLT32 read-write problem using ArduinoUno SPI

Hi all,

I am trying to read and write from SM28VLT32 bare-die memory Via SPI communication, and I am using Arduino Uno for that. Following the datasheet, timing diagrams and the command codes that are given in datasheet, I modified the available SM28VLT32 API to suit with Arduino. 

I am getting always 0 when I am trying to read from the memory whether its a quick status register or normal read operation. I have copied the write and read APIs here for reference. Any help and suggestions are welcome.

I am trying to write 0x1212 at address 0x00000100. 

void FRAM_Write(uint32_t FRAM_address, uint16_t FRAM_data)
{
           uint16_t error ;

// F-RAM WRITE OPERATION

digitalWrite(CS,LOW);                   //chip select
SPI.transfer(WRITE);                     //transmit write opcode   0x17
SPI.transfer(MSB_ADDR_BYTE(FRAM_address));               //send MSByte address first
SPI.transfer(MSB2_ADDR_BYTE(FRAM_address));            //send MSByte2 address middle
SPI.transfer(LSB_ADDR_BYTE(FRAM_address));              //send LSByte address
SPI.transfer((uint8_t)MSB_DATA_BYTE(FRAM_data));      //send MSB data
SPI.transfer((uint8_t)LSB_DATA_BYTE(FRAM_data));       //send 1 byte data
SPI.transfer(0);                                                                             //dummy byte

digitalWrite(CS,HIGH);                                                                //release chip, signal end of transfer

// Send 0xFF to get Quick status
error = Flash_SendFF();


// If SPI frame error or Invalid data or Command Error , return
if(((uint8_t)error & FLASH_QS_COMMAND_ERROR) ||
((uint8_t)error & FLASH_QS_INVALID_DATA_ERROR) ||
((uint8_t)error & FLASH_QS_SPI_FRAME_ERROR))
{
   Serial.print("\n error in code is \t"); 
   Serial.print(error, HEX);
}


// Poll till Write busy bit is reset
while((uint8_t)error & FLASH_QS_WRITE_BUSY)
{
    error = Flash_SendFF();
}
// error status comes only after Write busy bit is reset
error = Flash_SendFF();
Serial.print("\nQuick register status after writing is \t");
Serial.print(error, HEX);

}

uint16_t FRAM_SPI_Read(uint32_t FRAM_address)

{

uint16_t data;
uint16_t error;

//FRAM READ OPERATION

digitalWrite(CS,LOW);                                                        //chip select
SPI.transfer(READ);                                                           //transmit read opcode 0x15
SPI.transfer(MSB_ADDR_BYTE(FRAM_address));    //send MSByte address first
SPI.transfer(MSB2_ADDR_BYTE(FRAM_address));  //send MSByte2 address first
SPI.transfer(LSB_ADDR_BYTE(FRAM_address));     //send LSByte address
SPI.transfer(0);                                                                    //dummy byte

// Data byte on SO - MSB
data = SPI.transfer(0);
data = data << 8;
//Data byte on SO - LSB
data |= SPI.transfer(0);                                                 //get data byte from F-RAM

digitalWrite(CS,HIGH);                                                 //release chip, signal end of transfer

// Send 0xFF to get Quick status
error = Flash_SendFF();

// If SPI frame error or Invalid data or Command Error , return

if(((uint8_t)error & FLASH_QS_COMMAND_ERROR) || 

((uint8_t)error & FLASH_QS_INVALID_DATA_ERROR) ||
((uint8_t)error & FLASH_QS_SPI_FRAME_ERROR))
{
   Serial.print("\n error in code is \t");
   Serial.print(error, HEX);
   return error;
}

// error = Flash_SendFF();
Serial.print("\nQuick register status after reading is \t");
Serial.print(error, HEX);

return data;             // Return data byte

}

Thanks and regards,

Sohail

  • Sohail,
    I apologize for delay, as I was out on vacation without backup.
    Can you provide captures of the spi bus to help determine what the 28vlt32 is seeing?

    What are the clock rates? FCLK and SCLK?
    Have you confirmed power is as expected?
    Reset de-asserted?
    Regards,
    Wade
  • Dear Wade,

    Thanks for your reply. I was having troubles with getting the required voltage and current specifications initially I suspect. Since I could see the Tx LED glowing on Arduino Uno board while Rx was not showing. Additionally, we have observed the snaps looks very noisy and maybe they were not correct.
    I am providing 12MHz FCLK now which I did not provide in earlier case.
    I understood that SM28VLT32 can be tested using Evaluation board for it, and I wonder how do we test that using GUI only having Cheetah SPI host adapter? In this case, we are providing the required values of Vio and Vcore having current limiting values as mentioned in evaluation board datasheet.
    What I observed is that the DC power supply is unable to reach the 1.8V and 3.3V values at current limiting supply, which means that flash is driving/sinking large currents. Can you suggest what could be the reason?
    Also, is there any way to read/write the flash using Cheetah SPI adapter or Arduino in an easier way?

    I am following the exact instructions provided in the SM28VLT32 evaluation board kit to program it and found that when I press Read word from address, the GUI says pass, then I perform write word at the same address- GUI says pass. Now, I read the word back from same address and expect that the data should be seen what I wrote, the GUI displays pass but the data received is 00 but not what I wrote.

    Thanks.

  • Sohail,

    are you providing adequate power to the board?  What is current draw on VDD and Vcore after power up?

    When first powered, the current will be low, until it sees FCLK.  This will enable the device out of reset state.

    A TotalPhase Cheetah board can be used to test the device with the software gui that is available in the product folder.

    If you are exceeding 100mA on VCCIO, and over 200mA on Vcore with no other loads on these other than the EVM, then the device or board was damaged.  Or some other short circuit on the supplies.

    When you did this test, what voltages were obtained?  

    What is current/voltage prior to applying FCLK?


    Not sure what you mean by "easier way"  You can send commands directly to device via device capable of communicating via SPI.  The Cheetah, and GUI handle the protocol and commands for you.   This should be the easiest way.


    On your last statement, you are indicating that the board is up and running?   Did you resolve the excessive current issue?   Or operating with supplies current limited.  If the power supplies are not within range, proper operation cannot be expected.

    Assuming you have proper power:

    What are results when you read Quick Status?

    What are results of status register?

    Regards,

    Wade

  • I just noticed that you are using KGD version.
    Can you provide schematic for SM28VLT32? If you cannot post schematic to external forum, I can email you to exchange that way.
    Do you have the EVM for validation?
    Regards,
    Wade
  • Hi Wade,

    Thanks again for your prompt response

    Here I am providing much more details.

    At the very first step before my first post here, I have wire-bonded the SM28VLT32KGD (bare die) on a PSB and wanted to test the device using Arduino. I connected the 3.3V and 1.8V power supplies and was using 10MHz SPI CLK from Arduino board while I did not have an external FCLK at that moment. Obviously, it did not work possibly due to no clock higher current requirements of up to 120mA which Arduino can not provide.

    I switched to the EVM board, where I am supplying 3.3V Vccio (current limited to 100mA) and 1.8V Vcore (current limied to 200mA) using a DC power supply. I use a function generator to provide a 12MHz FCLK to the SM28VLT32. 

    I have followed the exact same sequence as mentioned in the user guide document of EVM slvu805.pdf and tried measuring currents at Vccio and Vcore. I have noticed that currents were very low as you also mentioned but another thing that I observed was- the dc power supply does not reach the voltages level while it have reached the limited current set to 100mA and 200mA for Vccio and Vcore. This happens when the device is connected through Cheetah Adapter to PC while the voltages read 3.3V and 1.8V without connecting the device. Maybe you can explain why?

    As far as damaged SM28VLT32 is concerned, I don't think it would be damaged since I used it when I had Arduino connected to it and power was supplied from it meaning that there is no way an Arduino supplies currents more than limited values of the die. And also, I am using second die just to be on safer side.

    Thanks and looking for further comments on it.

    Sohail

  • Dear Wade,

    Will you please provide the email ID for further discussions on this topic.  I can share schematic with you there.

    In addition, I would like to know about the crystals present on the EVM board and I am somehow not getting the clear idea about it.

    Can we discuss these issues on email?

    Thanks and looking forward to your personal response to the concerned issues and your sincere support.

  • Hi Wade,
    I have once again tried connecting the new die after wire-bonding it. I connect this device on EVM and follow the sequence as mentioned below.

    1. I connect flying lead sets from Cheetah to the EVM board pins as SCL-RST#, GND-GND, MISO-SO, SCLK-SCK, MOSI-SI and SS-CS#.
    2. With Power disabled I set the voltage and current values on DC power supply as 3.3V, current limited to 100mA for Vccio and 1.8V, current limited to 200mA for Vcore. These are supplied from a single DC power supply AGILENT E3631a Triple output DC power supply.
    3. I connect GND of both supply that is -ve of 1.8V and COM of 3.3V to a common GND on EVM.
    4. I have a crystal on the EVM which gives 12MHz clock to FCLK.
    5. I first turn on the 1.8V Vcore and then turn on 3.3V Vccio.

    Once I turn the power ON, it reads values of 0.419V, 0.199A (const current) on 1.8V supply while 0.74V, 0.099A (const current) on 3.3V supply.
    The current measured between (Vcore and GND ) as well as ( Vccio and GND) is less than 1mA on digital multimeter.

    I see these supply voltage variations/values only when the device is connected, and if the device is not connected on the EVM then it provides required values.
    Expecting some detailed discussion here or through email for further support as soon as possible.

    Thanks.
    Sohail
  • These efforts and analysis are ongoing via email.
    Closing post.