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: How to use External flash memory in "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 ExtFlash_open(void)
{

    bool f;

    hFlashPin = PIN_open(&pinState, BoardFlashPinTable);

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


above function returning false.

Please tell me why its returning False?

  • Hi,

    I would suggest referencing the BIM project that is available in the SDK to see how to interact with external flash. This example is able to write/read to an external flash through SPI, so I believe looking through source code for this example will be very helpful in implementing the desired flash read/write functionality.

    Best Regards,

    Jan

  • Hi, Jan 

    I am trying wth functions from extFlash.c file.

    I which 

    const PIN_Config BoardGpioInitTable[] had spi pins mentioned.

    When I commented thse lines,

    hFlashpin is returning true now.

    But control does not come out of 

    extFlashPowerStandby(),

    In which it stucks in 

    static int Spi_write(const uint8_t *buf, size_t len)

    Function.

    Its my humble request. please help me with this

  • Hi,

    I would expect the extFlashOpen() to look like the function below:

    bool extFlashOpen(void)
    {
        bool f;
    
        bspSpiOpen(SPI_BIT_RATE, BSP_SPI_CLK_FLASH);
    
        /* GPIO pin configuration */
        IOCPinTypeGpioOutput(BSP_IOID_FLASH_CS);
    
        /* Default output to clear chip select */
        extFlashDeselect();
    
        /* Put the part is standby mode */
        f = extFlashPowerStandby();
    
        if (f)
        {
            f = extFlashVerifyPart();
        }
    
        if (!f)
        {
            extFlashClose();
        }
    
        return f;
    }

    I found that function within the bim_extflash project in the SDK. Can you verify if using that function leads to the function returning success?

    Best Regards,

    Jan

  • Hi, Jan

    Thank you for the reply.

    I saw bim_extflash code.

    Did some changes to the code

    and I saw that I can read, erase and write to the external flash in "bim_extflash" project.(image attached for ref.)

    But problem is I want this functions working in "Simple BLE Peripheral" code.

    Can you please guide me for How can I add all this files and function in  "Simple BLE Peripheral" code?

  • Hi,

    If you add the exact logic present in the modified bim example to the simple_peripheral example, do you still get errors or unexpected behavior? If so, can you share the error or the return codes of the relevant functions?

    Best Regards,

    Jan

  • Hi Jan,

    I have included "C:\xxxx\xxxxx\workspace_v7\simple BLE peripheral modified_app\ExternalFlash" path in include option and #include "ext_flash.h"

    in main.c.

    My all errors are gone.But its still not working

    please guide

  • Hi Jan,

    when I debugged using single stepping I came to know that

    control was stopping in function shown in below code snippet

      /* SPI power */
      ROM_PRCMPeripheralRunEnable(PRCM_PERIPH_SSI0);
     

     

    /* See bsp_spi.h file for description */
    void bspSpiOpen(uint32_t bitRate, uint32_t clkPin)
    {
    //#define BOOT_LOADER
    #ifdef BOOT_LOADER
      /* GPIO power && SPI power domain */
      PRCMPowerDomainOn(PRCM_DOMAIN_PERIPH | PRCM_DOMAIN_SERIAL);
      while (PRCMPowerDomainStatus(PRCM_DOMAIN_PERIPH | PRCM_DOMAIN_SERIAL)
             != PRCM_DOMAIN_POWER_ON);
    
      /* GPIO power */
      PRCMPeripheralRunEnable(PRCM_PERIPH_GPIO);
      PRCMLoadSet();
      while (!PRCMLoadGet());
    #endif
    
      /* SPI power */
      ROM_PRCMPeripheralRunEnable(PRCM_PERIPH_SSI0);
      PRCMLoadSet();
      while (!PRCMLoadGet());
    
      /* SPI configuration */
      SSIIntDisable(BLS_SPI_BASE, SSI_RXOR | SSI_RXFF | SSI_RXTO | SSI_TXFF);
      SSIIntClear(BLS_SPI_BASE, SSI_RXOR | SSI_RXTO);
      ROM_SSIConfigSetExpClk(BLS_SPI_BASE,
                             BLS_CPU_FREQ, /* CPU rate */
                             SSI_FRF_MOTO_MODE_0, /* frame format */
                             SSI_MODE_MASTER, /* mode */
                             bitRate, /* bit rate */
                             8); /* data size */
      ROM_IOCPinTypeSsiMaster(BLS_SPI_BASE, BSP_SPI_MISO, BSP_SPI_MOSI,
                              IOID_UNUSED /* csn */, clkPin);
      SSIEnable(BLS_SPI_BASE);
    
      {
        /* Get read of residual data from SSI port */
        uint32_t buf;
    
        while (SSIDataGetNonBlocking(BLS_SPI_BASE, &buf));
      }
    
    }

    I was getting as error as "Cortex_M3_0: Breakpoint Manager: Error enabling this function: There is no AET resource to support this job".

     Then I saw some code part which was in gray area.

    #ifdef BOOT_LOADER
      /* GPIO power && SPI power domain */
      PRCMPowerDomainOn(PRCM_DOMAIN_PERIPH | PRCM_DOMAIN_SERIAL);
      while (PRCMPowerDomainStatus(PRCM_DOMAIN_PERIPH | PRCM_DOMAIN_SERIAL)
             != PRCM_DOMAIN_POWER_ON);
    
      /* GPIO power */
      PRCMPeripheralRunEnable(PRCM_PERIPH_GPIO);
      PRCMLoadSet();
      while (!PRCMLoadGet());
    #endif

    Then I defined macro "#define BOOT_LOADER"

    after that my problem solved.

    I tested with 10 bytes for Erase, Write and Read operations.

    It is working Now.

    But I have question that Is it it right way I am doing this thing?

    Should I  I define macro "#define BOOT_LOADER" or is there any other better way?

    Please guide

  • HI Jan,

    thank you so much for the support you provided me to solve this problem