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.

LAUNCHXL-CC2650: extFlashOpen() fail in CC2650 Simple BLE peripheral example

Part Number: LAUNCHXL-CC2650

Hello,

I am using LAUNCHXL-CC2650 Rev 1.3.0

BLE SDK 2_02_07_06

CCS7.4

Compiler TI v5.2.6

I want to store large data in External flash memory.(data is about 150KBytes).

My main goal is to add Ext flash functions to simple peripheral project Since in this example I have done changes as per my project requirement.

I am referring to ExtFlash.c and ExtFlash.h files in middleware folder of Simple peripheral project example. 

    bool Flash_status = 0;
    Flash_status = ExtFlash_open();
    if (Flash_status)
    {
        System_abort("Flash initialized OK\n");
        System_flush();
    }
    else
    {
        System_abort("Error in Flash\n");
        System_flush();
    }

I am calling function extFlashOpen() (refer code snippet).

But Ext Flash initialization fails.

  hFlashPin = PIN_open(&pinState, BoardFlashPinTable);

    if (hFlashPin == NULL)
    {
        return false;
    }

When I stepped in by using single step in debugging mode, I came to know that     hFlashPin is also returning false.

Please help to solve this problem
  • Hello,

    Thanks for creating a separate thread on this and helping keep our forums clean for readability.

    The call that is failing looks like a failure to open Board_SPI_FLASH_CS. Has this pin already been opened somewhere else in your application? In other words, have you made any modifications to the example project?

    Similar to the last step, perhaps you can try by enabling the OAD build configuration on this project as well to see if you have success. Although in this case, I'm not sure this will fix the issue.

  • Hello,

    Similar to the last step, perhaps you can try by enabling the OAD build configuration on this project as well to see if you have success. Although in this case, I'm not sure this will fix the issue.

    I tried by selecting with option right click on project Name then, Build configuration-> Set Active -> Flashonly_OAD_ExtFlash.

    But this did not worked.

    The call that is failing looks like a failure to open Board_SPI_FLASH_CS. Has this pin already been opened somewhere else in your application? In other words, have you made any modifications to the example project?

    yes. I have made changes to the code.

    Before main(), this is the code.

    #define EPD_BUSY_PIN PIN_ID(12)
    #define EPD_RST_PIN PIN_ID(6)
    #define EPD_DC_PIN PIN_ID(7)
    #define EPD_SCK_PIN PIN_ID(10)
    #define EPD_MOSI_PIN PIN_ID(9)
    #define EPD_CS_PIN PIN_ID(14)
    
    PIN_Config epdPinTable[] = {
    EPD_CS_PIN | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MAX,
    EPD_MOSI_PIN | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW| PIN_PUSHPULL | PIN_DRVSTR_MAX,
    EPD_SCK_PIN | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
    EPD_DC_PIN | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW  | PIN_PUSHPULL | PIN_DRVSTR_MAX,
    EPD_RST_PIN | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
    EPD_BUSY_PIN | PIN_INPUT_EN | PIN_PULLUP,
    PIN_TERMINATE };

    In the main(), this is the code

    My e-paper display work fine with above code

    //    PIN_init(BoardGpioInitTable);
          Board_initGeneral();
    
        /* Open LED pins */
        epdPinHandle = PIN_open(&epdPinState, epdPinTable);
        if (!epdPinHandle)
        {
            System_abort("Error initializing board EPD pins\n");
            System_flush();
        }

    Please guide

  • Hi,

    Can you clarify if you are using a Launchpad, or an STK? I see that you have mentioned Launchpad in the original post. If you are using an STK, then that pin by default uses PIN 14 for the SPI FLASH CS. This could be why you are unable to open the flash.

  • Hello,

    As I have already mentioned in my question on the top, I am using LAUNCHXL-CC2650 Rev 1.3.0.

    Which is using 


    /* SPI */
    #define Board_SPI_FLASH_CS IOID_20
    #define Board_SPI0_MOSI IOID_9
    #define Board_SPI0_CLK IOID_10

    So I guess its not the CS pin causing problem.

    Is is due to the 


    #define EPD_SCK_PIN PIN_ID(10)
    #define EPD_MOSI_PIN PIN_ID(9)

    which are also use by 

    Board_SPI0_MOSI IOID_9
    Board_SPI0_CLK IOID_10

    should I use different pins for E-paper display?

    Will it solve my problem of "hFlashPin is also returning false" ?

  • Hello, Ammar

    I have an update.

    const PIN_Config BoardGpioInitTable[] = {
    
        Board_RLED   | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,         /* LED initially off             */
    
        Board_GLED   | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,         /* LED initially off             */
    
        Board_BTN1   | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS,            /* Button is active low          */
    
        Board_BTN2   | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS,            /* Button is active low          */
    
    //    Board_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN,  /* External flash chip select    */
        Board_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN,                                              /* UART RX via debugger back channel */
        Board_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL,                        /* UART TX via debugger back channel */
    //    Board_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN,                                            /* SPI master out - slave in */
    //    Board_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN,                                            /* SPI master in - slave out */
    //    Board_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN,                                             /* SPI clock */
        PIN_TERMINATE
    };
    

    SPI pins were mentioned in by default in code as shown above.

    So I commented them as shown in above code snippet.

    So now "hFlashPin is not returning false.

    /* Make sure SPI is available */
    f = Spi_open(SPI_BIT_RATE);

    System_printf("Value of f=%d\n",f);
    System_flush();

    this also printing

    f=1;

    means Spi_open(SPI_BIT_RATE); is successful .

    But control does not come out of function,        

    f = extFlashPowerStandby();            (IMPORTANT)

    When I debug using single stepping,

    This function gets called after


    static int Spi_write(const uint8_t *buf, size_t len)
    {
    SPI_Transaction masterTransaction;

    masterTransaction.count = len;
    masterTransaction.txBuf = (void*)buf;
    masterTransaction.arg = NULL;
    masterTransaction.rxBuf = NULL;

    return SPI_transfer(spiHandle, &masterTransaction) ? 0 : -1;
    }

    ------------------------------------------------------------------------------------------

    THEN


    bool SPI_transfer(SPI_Handle handle, SPI_Transaction *transaction)
    {
    return (handle->fxnTablePtr->transferFxn(handle, transaction));//here is the problem
    }

    So actually Control does not come out of "SPI_transfer" function.

    Please help me to get this thing working, we have our project deadline

  • Hello,

    I apologize for the delay. Can I ask that you create a new thread with the information in this last reply?

    You have resolved the original issue and the new question diverges from that topic.

    I appreciate your patience and helping keep our forums readable for anyone looking to reference past threads.

  • Hello Ammar,

    The original question is extFlashOpen() fail.

    and only  "hFlashPin" is started returning true And not the extFlashOpen().

    As everything is mentioned above. Also image is attached for clarity, where you can see control is still inside  extFlashOpen().

    By the way, I had created the new thread.

    In new thread my problem is solved.

    For anyone looking to reference, here is the full resolution.

    link shown below,

    e2e.ti.com/.../launchxl-cc2650-unable-to-add-new-files-to-simple-ble-peripheral-example-code

    Thank you Ammar for your help.