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.

CC2652P: Communicate with winbond external flash

Part Number: CC2652P
Other Parts Discussed in Thread: CC2592

Hello,

I am trying to read chip id from external flash winbond W25X40CL from master CC2592 in my application.
Followed SPI master example and flash datasheet for instruction set. I have integrated sample code in my application to read/write data on external flash.

I am getting 0 in response of get chip id (0x90) command. How can I read read/write data successful?

Please, find the code snippet below.

    SPI_Handle      masterSpi;
    SPI_Params      spiParams;
    SPI_Transaction transaction;
    bool            transferOK;

    /* Open SPI as master (default) */

    SPI_init();
    GPIO_setConfig(CONFIG_GPIO_1, 1);

    SPI_Params_init(&spiParams);
    spiParams.frameFormat = SPI_POL0_PHA1;
    spiParams.bitRate = 4000000;
    spiParams.mode = SPI_MASTER;

    masterSpi = SPI_open(CONFIG_SPI_0, &spiParams);
    if (masterSpi == NULL) {
        debug_uart_write_str("Error initializing master SPI\n");
        while (1);
    }
    else {
        debug_uart_write_str("Master SPI initialized\n");
    }

    masterTxBuffer[0] = 0x90;
    masterTxBuffer[1] = 0x00;
    masterTxBuffer[2] = 0x00;
    masterTxBuffer[3] = 0x00;

    transaction.count = 4;
    transaction.txBuf = (void *) masterTxBuffer;
    transaction.rxBuf = (void *) masterRxBuffer;

    GPIO_write(CONFIG_GPIO_1, 0);

    /* Perform SPI transfer */
    transferOK = SPI_transfer(masterSpi, &transaction);
    if (transferOK) {
        debug_uart_write_str("SPI status = %d\n", transaction.status);
        if(transaction.rxBuf != NULL)
            debug_uart_write_str("Master received: %02x\n", masterRxBuffer[0]);
        else
            debug_uart_write_str("RX buff is NULL\n");
    }
    else {
        debug_uart_write_str("Unsuccessful master SPI transfer");
    }

    GPIO_write(CONFIG_GPIO_1, 1);

Regards,
Ankit S

  • Hi Ankit,

    This appears to be an issue with the expected SPI packet format for the third-party W25X40CL, please reference its datasheet and compare the communication line differences with a logic analyzer.  Common mistakes include missing physical connections, an unsupported bit rate, incorrect phase/polarity, or wrong power-up/initialization sequences.

    Regards,
    Ryan