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.

LP-EM-CC2340R5: CC2340R5 onchip OAD

Part Number: LP-EM-CC2340R5
Other Parts Discussed in Thread: CC2340R5, LP-XDS110ET, , UNIFLASH

Hi expert,

I'm running CC2340R5 example:C:\ti\simplelink_lowpower_f3_sdk_7_10_00_35\examples\rtos\LP_EM_CC2340R5\ble5stack\basic_ble_oad_onchip

when I flash the device it will show the JTAG Communication Error:

Cortex_M0P: JTAG Communication Error: (Error -615 @ 0x0) The target failed to see a correctly formatted SWD header. The connection to the target may be unreliable. Try lowering the TCLK setting before trying again.                          (Emulation package 9.11.0.00128)
Cortex_M0P: Failed to remove the debug state from the target before disconnecting. There may still be breakpoint op-codes embedded in program memory. It is recommended that you reset the emulator before you                                  connect and reload your program before you continue debugging

I tried using the same setup with different examples, but this issue didn't occur.

I want to know why this problem occurs?

I also found the same error message in E2E, And I follow the steps mentioned by Ryan : 

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/1224456/lp-em-cc2340r5-unable-to-program-cc2340-device-via-xds110-debugger/4625946#4625946

When I load the `unblock_loki_low_plus_pg2.gel` script, the status of the gel script will show Failed:

CS_DAP_0: GEL: Error loading file 'C:\ ...\unblock_loki_low_plus_pg2.gel': function 'ChipErase()' already defined

Should I comment out hotmenu ChipErase() in CC23xx_dap.gel, or what should I do?

The followings are the details of my test

SW: simplelink_lowpower_f3_sdk_7_10_00_35 basic_ble_oad_onchip

HW: LP-EM-CC2340R5 PG.2 + LP-XDS110ET Rev:B

  • Hi,

    Thank you for reaching out. Can you please describe how you are flashing the code? Have you tried using Uniflash?

    Can you also confirm my understanding that the issue only occurs for OAD enabled projects?

    Best regards,

  • Hi Clement,

    I flash the code via CCS, and I haven't tried using Uniflash.

    Yes, this issue only happens on this project (basic_ble_oad_onchip).

    Best Regards,

    Seamus

  • Hi Seamus,

    Please use Uniflash and ensure you are flashing the three required images (mcuboot_onchip, basic_persistent, basic_ble_oad_onchip).

    Best regards,

  • Hi Clement,

    Where can I find images of  basic_persistent & basic_ble_oad_onchip in SDK? or I need to build by myself?

    Best Regards,

    Seamus

  • Hi Clement,

    I followed your way to use Uniflash successfully, but I still want to know the issue encountered in CCS. 

  • Hi Clement,

    I can download mcuboot and basic_persistent to my LP-CC2340R5 and see it advertising. However, if I try to debug basic_persistent from CCS12.1, I see Error -615 as the followings. How can we fix this issue?

    Cortex_M0P: Flash loader: CC23xx_FLASH_LIBRARY_VERSION 3.17.09.20
    Cortex_M0P: Updating CRC32 field ccfg.bootCfg.crc32 @ address 0x4E02000C, based on data in the range [04E020000, 0x4E02000B]. Value changes from 0x00000000 to 0xFFFFFFFF
    Cortex_M0P: Updating CRC32 field ccfg.crc32 @ address 0x4E02074C, based on data in the range [04E020010, 0x4E02074B]. Value changes from 0x00000000 to 0x4C1584B6
    Cortex_M0P: Updating CRC32 field ccfg.userRecord.crc32 @ address 0x4E0207CC, based on data in the range [04E020750, 0x4E0207CB]. Value changes from 0x00000000 to 0x15D70E0C
    Cortex_M0P: Updating CRC32 field ccfg.debugCfg.crc32 @ address 0x4E0207FC, based on data in the range [04E0207D0, 0x4E0207FB]. Value changes from 0x00000000 to 0x527294A2
    Cortex_M0P: GEL Output: Memory Map Initialization Complete.
    Cortex_M0P: JTAG Communication Error: (Error -615 @ 0x0) The target failed to see a correctly formatted SWD header. The  connection to the target may be unreliable. Try lowering the  TCLK setting before trying again. (Emulation package 9.11.0.00128)
    Cortex_M0P: Failed to remove the debug state from the target before disconnecting.  There may still be breakpoint op-codes embedded in program memory.  It is recommended that you reset the emulator before you connect and reload your program before you continue debugging

    The followings are chip info for your reference.

  • Hi Seamus and YiKai,

    The behavior may be caused by the CCFG settings set. By default, the OAD examples protect certain parts of the Flash (e.g. CCFG and other critical Flash sectors) to avoid overwriting these by accident. 

    I would recommend to re-build the images disabling these protections (note: this suggestion is for debug only), and re-flash the device with the updated images.

    I cannot be 100% sure, but the original issue with CCS may have been caused by a blank CCFG caused by flashing only the basic_persistent project. In that case, the CCFG was considered as invalid and the device was reaching the serial bootloader mode.

    I hope this will help,

    Best regards,

  • Hi Clement,

    It’s really frustrating to use CC2340…To make things easier, can you show us exact steps to bring the device back? For example, use Uniflash or any other tool to erase the chip or CCFG?

  • The followings are the default ccfg settings in basic_persistent project. It looks like there is nothing blocking the debug but why we get "JTAG Communication Error: (Error -615 @ 0x0) The target failed to see a correctly formatted SWD header...." if we want to debug and trace basic_persistent project. Can you show us how to debug and trace your basic_persistent and basic_ble_oad_onchip project?

  • Hi YK,

    Here are the steps I recommend to follow to debug the basic_persistent app c (similar steps can be applied for basic_ble_oad_on_chip).

     

    • I- Build the image, flash the device and connect the debugger
    1. Build the basic_persistent app
    2. Click the Debug button – This leads the debugger to erase the device’s flash then download the newly built image
    3. This is going to lead to a JTAG Communication Error: (Error -615 @ 0x0). This is due to MCUBoot image not being programmed leading the code at address 0x0 to be invalid
    4. In the “Debug” window, right click on “Texas Instruments XDS110 USB Debug Probe” then “Connect Target”

     

    • II- Enable the “Memory Browser” and “Registers” views
    1. Click “View”
    2. Then select “Memory Browser”
    3. Click again “View” and select “Registers”

     

    • III- Force the device to execute the image you want to debug
    1. In the memory browser, find the entry point of the image. You can leverage the map file (see the green square) if you are not sure of the address.
      In all the cases, you should find the resetVectors symbol at the entry point of the image.
      For the basic_ble_persistent app, the entry point is at 0x6100
    2. In the “Registers” view, update the value of the Core Registers > SP register with the first value of the resetVectors (0x20009000 in my case)
    3. In the “Registers” view, update the value of the Core Registers > PC register with the second value of the resetVectors (0x2C66D in my case)
    4. In the “Registers” view, update the value of the SCB > VTOR register with the address of the resetVectors (which is also the entry point of the app, i.e. 0x6100 in my case)
    5. Setup a breakpoint in the basic_persistent application (e.g. on the call to BLEAppUtil_init() in the function appMain in app_main.c) and click the “Run button”

     

     

     

    Note: The steps provided here only leads to flash one app (which is the recommended approach for app debugging). In case multiple apps have to be flashed at the same time, Uniflash should be used. Then the step to connect the Debugger to a Running Target described in the Debugger Guide should be followed. And, eventually, the steps in II- and III- should be applied.

    I hope this will help,

    Best regards,

  • Hi Clement,

    Thanks for elaborating these steps and I can make it work with your instruction. The question is that will TI have plan to make this easier in CCS later?

  • Hi YiKai,

    I cannot comment on our future plans on a public forum, but I am sure we can find much more developer-friendly approaches here.

    Appreciate your patience.

    Regards,

  • Hi Clement,

    OK, I see and Thanks for your great support.