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.

CC2642R: DWT

Part Number: CC2642R

Hello there,

I want to use DWT for some precise time measurements in my project. Does this cause a problem with BLE5 stacks and Tirtos?

Is it a problem for BLE5 Stack and Tirtos to turn off debug by writing 0 to the TRCENA bit of the DEMCR register?

Is it a problem to write directly to the CPU_DWT_MAP1 and DEMCR register?

Can I also accept Clock Frequency as 48 Mhz?

Is there any point I should be careful about?

Best Regards.

Ahmet Salih ASKER

  • Ahmet,

    The DWT is not intrusive to the regular CPU execution, therefore its operation is completely transparent to the BLE5 and the TI-RTOS.

    That said, we enable access to the DWT (along other profiling functionality) only via the IDE interface and not via direct access from the CPU. In other words, we don't have examples or support for this operation.

    In this case, can you check section 7.4.9and 7.5.3.2 of the CCS User's Guide below? It has good references to our debugging material:

    https://software-dl.ti.com/ccs/esd/documents/users_guide/index.html 

    Hope this helps,

    Rafael

  • Thank you for your answer. I looked at the pages you linked. I saw access from IDE. But I need to access the Count number with software. And this feature is a feature left to users by Arm Cortex. For example, we can directly access this feature in the microcontrollers of STM company. There should be a way to get this feature in CC2642.

  • Is there a problem in accessing like this?

    For example, to reach the CTRL.CYCCNTENA address of the DWT register.

    HWREG( 0x40000000) |= 0x00000001;

    If I write for the complete example;

    void DWT_Initiliaze(void)

    {

    HWREG( 0xE000EDFC) |= 0x01000000;     // CPU_SCS DEMCR Register  (Offset = DFCh) [reset = 0h], 24.bit : TRCENA  bit = 1

    HWREG( 0xE0001000) &= 0xFDFFFFFF;   //  CPU_DWT_map1 (Offset = 0h) Register CTRL.NOCYCCNT bit = 0

    HWREG( 0xE0001000) |= 0x00000001;   //  CPU_DWT_map1 (Offset = 0h) Register CTRL.CYCCNTENA bit = 1

    }

    void DwtMecurmentStart(void)

    {

    HWREG( 0xE0001004) |= 0; //  CPU_DWT_map1 (Offset = 4h) Register CYCCNT

    }

    void DwtMecurmentStop(void)

    {

    my32BitVar = HWREG( 0xE0001004);

    }

  • Ahmet,

    At first glance the access registers look alright and, if I recall correctly, the ARM Cortex documentation does not impose any specific restrictions to their access. At any rate, I would experiment calling them from different contexts and see if you get consistent results with, say, the CCS Profiler clock (which uses the ARM timer).

    Unfortunately, since we don't have an example for this, I couldn't test your approach.

    Hope this helps,

    Rafael

  • I tried this and got great results. You can use it like that.

    Best Regards.

    Ahmet Salih ASKER