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.

CC2652R: EEPROM returns 0 while trying to read anything using SPI

Other Parts Discussed in Thread: CC2652R

I'm using a CC2652r to try to read and write to an MX25R8035F EEPROM using SPI.

I'm using the build in SPI driver to try and communicate with the EEPROM but while the drivers says it succeeded the transfer of data, the data I get back seems to be 0 at all times.

For example if I try to use the REMS (read electronic
manufacturer & device ID) to get the manufacturer & device ID I send 4 bytes containing 0x90, 0xFF, 0xFF, 0x00. But instead of getting 0xC2, 0x14. I'm getting 0x00 and 0x00.

I initialize my SPI with:

/* Open SPI as master (default) */
SPI_Params_init(&spiParams);
spiParams.dataSize = 8;
spiParams.bitRate = SPI_BIT_RATE; //(4000000)
spiParams.frameFormat = SPI_POL0_PHA0;
masterSpi = SPI_open(MX25_EEPROM_SPI, &spiParams);
if (masterSpi == NULL) {
System_abort("Error initializing SPI\n");
}

Then in a Task I try to get the electronic manufacturer & device ID with:

//BLS_CODE_MDID = 0x90
uint8_t wbuf[] = { BLS_CODE_MDID, 0xFF, 0xFF, 0x00 };
SPI_Transaction transaction;

// Configure the transaction
transaction.count = sizeof(wbuf);
transaction.txBuf = wbuf;
transaction.rxBuf = NULL;
extFlashSelect();
uint8_t ret = (uint8_t) (!SPI_transfer(masterSpi, &transaction));

// Configure the transaction
transaction.count = sizeof(infoBuf);
transaction.txBuf = NULL;
transaction.rxBuf = infoBuf;

ret = (uint8_t) (!SPI_transfer(masterSpi, &transaction));
extFlashDeselect();

Where extFlashSelect put the slave select pin low and extFlashDeselect put it to high.

I tried specifying the frame format in the parameters passed to SPI_open. 
According to the documentation of MX25R8035F, CPOL 0, CPHA 0 and CPOL 1, CPHA 1 together should be supported but the result is still the same.

I also tried setting the rxBuf and the txBuf in the same transaction but got the same result.

I'm using the simplelink_cc13x2_26x2_sdk_3_40_00_02 SDK 

I hope someone is able to help me with this.

  • Hi Frank, 

    Assigning an expert to comment. 

    Thanks, 
    Elin

  • I am not familiar whit the MX25R8035F EEPROM at all.

    What I think you should do is to monitor the SPI bus from the CC2652R with a logic analyzer and have someone from Macronix verify that what you are transmitting on the SPI is according to the MX25R8035F spec.

    When you are not receiving any response from the device, I would assume that you are not sending what it is expecting.

    BR

    Siri

  • Sadly we don't own a logic analyzer but I tried some more stuff. Eventually I tried to read the REMS using an arduino that worked after sending a dummy byte while trying to retrieve data.

    I now tried the same with the TI board and it returned data.

    Updated function for retrieving the REMS is now:

    /BLS_CODE_MDID = 0x90
        uint8_t wbuf[] = { BLS_CODE_MDID, 0xFF, 0xFF, 0x00 };
    
        SPI_Transaction transaction;
        uint8_t dummy[] = { 0 };
        uint8_t infoBuf[2];
    
        // Configure the transaction
        transaction.count = sizeof(wbuf);
        transaction.txBuf = wbuf;
        transaction.rxBuf = NULL;
    
        extFlashSelect();
    
        if (!SPI_transfer(masterSpi, &transaction)) {
            return 1;
        }
    
        // Configure the transaction
        transaction.count = sizeof(infoBuf);
        transaction.txBuf = dummy;
        transaction.rxBuf = infoBuf;
    
        uint8_t ret = (uint8_t) (!SPI_transfer(masterSpi, &transaction));
        extFlashDeselect();