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.

RTOS/LAUNCHXL-CC2640R2: Getting Minimal External (non-built in) Flash to work

Part Number: LAUNCHXL-CC2640R2

Tool/software: TI-RTOS

I'm attempting to attach an external SPI memory chip to the LaunchXL platform to log data collected via other external devices.

The chip comes from Micron, who provides a low-level driver in which the developer only needs to implement certain functions (like SPI transfer, for instance).

As a first order of business, I would at least like to see if I can observe the SPI_CLK, and see if I can set the chip select pin to low.  Which, as of right now, I'm unable to accomplish.

I'm following the ExtFlash.* files, which are part of the OAD sample application, which communicate with the off-chip NOR memory.  I'm only taking relevant parts to the actual SPI protocol itself, and trying to avoid code that is related to the Macronix chips that you guys are using.

Here is what I have, but it is not working:

static PIN_Config board_flash_pin_table[] =
{
 Board_SPI0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MIN,
 PIN_TERMINATE
};

bool extDataFlash_open(void)
{
    PIN_Handle hFlashPin;
    PIN_State pinState;
    SPI_Params spiParams;
    SPI_Handle spiHandle;

    bool f;

    if ((hFlashPin = PIN_open(&(pinState), board_flash_pin_table)) == NULL) {
        return false;
    }

    SPI_init();

    SPI_Params_init(&spiParams);
    spiParams.bitRate = 1000000;
    spiParams.mode = SPI_MASTER;
    spiParams.transferMode = SPI_MODE_BLOCKING;

    spiHandle = SPI_open(Board_SPI0, &spiParams);

    if (!spiHandle) {
        return false;
    }


    PIN_setOutputValue(hFlashPin, Board_SPI0, Board_FLASH_CS_ON);
    sleep(1);
    PIN_setOutputValue(hFlashPin, Board_SPI0, Board_FLASH_CS_OFF);

    return true;
}

I've tried Board_SPI0 as well as Board_SPI1, but nothing is working.  When I probe the GPIOs of the LaunchXL board and set a breakpoint at the sleep call, I can see that the SPI_CS pin is high (3.3v) and it never goes low.

What am I forgetting to do?

  • Hello,

    It's possible you don't have the pins mapped correctly in your board file. I would use the debugger to go through the PIN and SPI driver APIs (we provide source) and look for any non-expected return codes inside the driver(s).

    Best wishes