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.

CC2640R2F: off-chip BIM problem

Part Number: CC2640R2F
Other Parts Discussed in Thread: BLE-STACK

Dear Sirs

I have a very strange beahaviour of the BIM code.

I have a board with a CC2640R2 and an Adesto Flash together with other circuits on the SPI, so I need to change the BIM.

I can download a new application software using OAD onto my Adesto Flash, this works very well.

But the new program doesn't start.

If I press the reset button the BIM transfers the application from the externa flash into the internal flash, but the new program still doesn't start.

If I now activate the pre-definition "NO_COPY" then my downloaded software starts perfectly.

So OAD and the flashing of external and internal flash works!

When I remove NO_COPY then the application software never starts.

After much works I have a theory that it is the GPIOs that are the root of my problem. It seems that the GPIOs in BIM is sensitive to time.

Please see the code below. At the last line I change a pin. If the delay preceding that is very short then the last pin change works fine. If the delay is long (100mS) the it seems that this PIN change makes the BIM freeze.

bool extFlashOpen(void)
{
    bool f;
    uint32_t i;
    volatile uint32_t x;

    bspSpiOpen(SPI_BIT_RATE, BSP_SPI_CLK_FLASH);  / I have not changed anything inside this function.
    /* GPIO pin configuration */
    IOCPinTypeGpioOutput(FLASH_PWR);  // Powers on my Adesto Flash
    IOCPinTypeGpioOutput(BSP_IOID_FLASH_CS);  // Flash CS
    IOCPinTypeGpioOutput(ACC_CS);
    IOCPinTypeGpioOutput(GFE_CS);

    /* Default output to clear chip select */
    GPIO_setDio(FLASH_PWR);  // Power on Flash
    GPIO_setDio(BSP_IOID_FLASH_CS);  // Flash CS high
    GPIO_setDio(ACC_CS);  // ACC CS high so it doesn't disturb
    GPIO_clearDio(GFE_CS); // GFE CS for debug

    // The routine below gives a delay of 150mS so that the Flash wakes up properly before we do anything
    for (i=0;i<800000;i++)  // 800000
    {
        x=(x+10)/2; // Dummy
    }

    GPIO_setDio(ACC_CS);  // GFE CS high used for debug, works if delay above is very short

Any ideas are highly welcome.

/Dan

  • Hi Dan,

    Which version of the TI BLE-Stack are you using? How did you generate the images in question? Do the images in question contain valid metadata/image header information?
  • Hello Rachel

    I really appreciate the help.

    I use CC2640R2, CCS7.2, sdk 1.40.00.45 and Btool V1.41.21

    The program is simple_peripheral_cc2640r2lp_oad_offchip_app

    For OAD I use the application bin produced by CCS.

    The OAD worked perfectly when I run it on the LaunchPad.

    Then I changed the SPI and nessecery I/Opins in the app and BIM to fit my hardware.

    Now I get the strange behaviour described in my problem description.

    It feels like the BIM is very sensitive of how and when we use I/Os.

    If you have any idea I would be most grateful.

    /Dan

  • I solved the problem in hardware.

    Our hardware has a switch that powers the Flash.

    By shortcutting this switch, so that the flash is always powered, the bootloader works fine.

    Eventhough we have solved the problem in hardware it would be interesting to understand why it couldn't be fixed in software. 

    I added so that the bootloader activates this switch and then waites for 10mS in order for the flash to wake up.

    This delay made the BIM brake down. So it seems that the BIM has some timing issues?

    Best

    /Dan