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/CC2640R2F: 5X5 OFF Chip OAD?

Part Number: CC2640R2F
Other Parts Discussed in Thread: CC2640

Tool/software: TI-RTOS

Hi 

I'm using R2F CC2640, 5x5 Off-Chip OAD.

But I have some errors while setting my flash for the OFF-Chip OAD.

Some questions:

    In the BIM project, I'm okay for making my flash for Off-CHIP.

    The SPI function works well for the 5x5.

    It invokes the "ext_flash.c.

   Now, I switch to the simple_peripheral project.

   It invokes the "extflash.c".   (This one is not the same with the BIM ext_flash.c).

  How to set this "extflash.c" to reference the 5X5 board.h?

  I have tried modified the CCS include path, but, It still invokes the 7x7 lanuch pad's Board.h...

  Will the 5x5 OAD off-chip working? Any one ever made the Off-Chip OAD with 5x5?

BR Rio

  • Hi Rio,

    Refer to the TI Provided Board Files section of the BLE User Guide.
    software-dl.ti.com/.../custom-hardware.html

    This details how to adapt an SDK BLE application to run on custom hardware.

    -Sy Su
  • Hi Sy:

      in the extflash.c, I got the "hFlashPin" = NULL, so, the OAD with External flash will not work, Is my understanding correct?

      But I check my code with the SPI Falsh pin setting, it should be correct.

      What's the possible root cause to cause the SPI flash cannot access?

      I check my setting for the SPI Flash of BIM (ext_flash.c), it can read the device ID.

      But, my (extflash.c), it cannot access the Falsh. so, this function will not work: ExtFlash_open

    BR Rio

    /* See ExtFlash.h file for description */
    bool ExtFlash_open(void)
    {
    bool f;

    hFlashPin = PIN_open(&pinState, BoardFlashPinTable);

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

    /* Initialise SPI. Subsequent calls will do nothing. */
    SPI_init();

  • Hi Rio,

    You need to modify the SPI pin outs at board files of BIM and App. See, Off-Chip OAD Guide.

    - kel
  • e2e.ti.com/.../535788

    Hi.
    I'm using 5x5 + Off chip OAD / External flash.

    Can I use the IDIO5 as the flash CS pin?
    If I set the Board_SPI_FLASH_CS to CC2640R2DK_5XD_SPI0_CSN, then set this "CC2640R2DK_5XD_SPI0_CSN" to IOID_5.

    Do I need to change the below setting?

    static PIN_Config BoardFlashPinTable[] =
    {
    Board_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* Ext. flash chip select */

    PIN_TERMINATE
    };
    BR Rio
  • Hi Rio,

        If IOID_5 does not conflict to anything else to your board then you can use it as CS for External Flash. If you are using the 5XD board files you need to make your modification similar to the CC2640R2 Launchpad board files with regards to the SPI pins. You just need to change the IOID_X for the SPI CS pin.

    CC2640R2_LAUNCHXL.h

    /* SPI */
    #define CC2640R2_LAUNCHXL_SPI_FLASH_CS          IOID_5
    #define CC2640R2_LAUNCHXL_FLASH_CS_ON           0
    #define CC2640R2_LAUNCHXL_FLASH_CS_OFF          1
    
    /* SPI Board */
    #define CC2640R2_LAUNCHXL_SPI0_MISO             IOID_8          /* RF1.20 */
    #define CC2640R2_LAUNCHXL_SPI0_MOSI             IOID_9          /* RF1.18 */
    #define CC2640R2_LAUNCHXL_SPI0_CLK              IOID_10         /* RF1.16 */

    Rio Chan said:
    If I set the Board_SPI_FLASH_CS to CC2640R2DK_5XD_SPI0_CSN, then set this "CC2640R2DK_5XD_SPI0_CSN" to IOID_5.

    Do not do this, you will have problems with SPI communication to external flash. Do not assign any pin to CC2640R2DK_5XD_SPI0_CSN.

    Board.h

    #define Board_SPI0              CC2640R2_LAUNCHXL_SPI0
    #define Board_SPI1              CC2640R2_LAUNCHXL_SPI1
    #define Board_SPI_FLASH_CS      CC2640R2_LAUNCHXL_SPI_FLASH_CS
    #define Board_FLASH_CS_ON       0
    #define Board_FLASH_CS_OFF      1

    CC2640R2_LAUNCHXL.c

    const PIN_Config BoardGpioInitTable[] = {
    
        CC2640R2_LAUNCHXL_PIN_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,       /* LED initially off */
        CC2640R2_LAUNCHXL_PIN_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,       /* LED initially off */
        CC2640R2_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS,          /* Button is active low */
        CC2640R2_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS,          /* Button is active low */
        CC2640R2_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN,  /* External flash chip select */
        CC2640R2_LAUNCHXL_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN,                                              /* UART RX via debugger back channel */
        CC2640R2_LAUNCHXL_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL,                        /* UART TX via debugger back channel */
        CC2640R2_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN,                                            /* SPI master out - slave in */
        CC2640R2_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN,                                            /* SPI master in - slave out */
        CC2640R2_LAUNCHXL_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN,                                             /* SPI clock */
    
        PIN_TERMINATE
    };

    - kel

  • Hi Rio,

    Based on your board file, you will need to modify it to reflect your pin mapping on your board.

    Please follow the steps detailed in the following section of the guide: 

    The part I would like to emphasize is step 3 where it says to:

    Modify board files to match application requirements.

    -PIN structure to match the layout of the board. See Package Type and Board Files.


    In order to do this, you will need to add the correct SPI predefines in your board.h file. More specifically, you will need to add predefines for your SPI MISO, MOSI, and CLK. Your CS pin does not exist on your board so it should remain as PIN_UNASSIGNED.

    Once this is done, you will need to modify the CC2640R2DK_5XD.h file referred to in your board.h file since the pins in the file are currently mapped to the CC2640R2DK_5XD reference design. Based on your schematic, you will want to make the following changes in the CC2640R2DK_5XD.h

    #define CC2640R2DK_5XD_SPI0_MISO                     IOID_2          
    #define CC2640R2DK_5XD_SPI0_MOSI                     IOID_0         
    #define CC2640R2DK_5XD_SPI0_CLK                      IOID_1 

    -Sy Su

  • Sy Su said:
    Your CS pin does not exist on your board so it should remain as PIN_UNASSIGNED.

    The ExtFlash.c which is needed for Off-Chip OAD need CS. See, below.

    static PIN_Config BoardFlashPinTable[] =
    {
        Board_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* Ext. flash chip select */
    
        PIN_TERMINATE
    };
    /*******************************************************************************
     * @fn          extFlashSelect
     *
     * @brief       Select the external flash on the SensorTag
     *
     * @param       none
     *
     * @return      none
     */
    static void extFlashSelect(void)
    {
        PIN_setOutputValue(hFlashPin,Board_SPI_FLASH_CS,Board_FLASH_CS_ON);
    }

    This below should be set to PIN_UNASSIGNED

    #define CC2640R2_LAUNCHXL_SPI0_CSN              PIN_UNASSIGNED

    - kel

  • Hi MR.

    Thanks for the hint, i have solved the SPI issue.
    Now, I'm encountering another issue.

    e2e.ti.com/.../624935

    May you guide me how to solve it?

    BR Rio