How to Configure SWO for J-Link V8 and EFM32

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • How to Configure SWO for J-Link V8 and EFM32

    I have 2 adapter as below
    picasaweb.google.com/lh/photo/…pKyjDCaUs?feat=directlink


    For EFM32_STK I can use below example code to enable the trace and SWO output



    C Source Code

    1. void BSP_TraceSwoSetup(void)
    2. {
    3. /* Debug logic registers */
    4. volatile uint32_t *dwt_ctrl = (uint32_t *) 0xE0001000;
    5. volatile uint32_t *tpiu_prescaler = (uint32_t *) 0xE0040010;
    6. volatile uint32_t *tpiu_protocol = (uint32_t *) 0xE00400F0;
    7. /* Enable GPIO clock */
    8. CMU->HFPERCLKEN0 |= CMU_HFPERCLKEN0_GPIO;
    9. /* Enable Serial wire output pin */
    10. GPIO->ROUTE |= GPIO_ROUTE_SWOPEN;
    11. /* Set correct location */
    12. GPIO->ROUTE = (GPIO->ROUTE & ~(_GPIO_ROUTE_SWLOCATION_MASK)) | BSP_TRACE_SWO_LOCATION;
    13. /* Enable output on correct pin. */
    14. TRACE_ENABLE_PINS();
    15. /* Enable debug clock AUXHFRCO */
    16. CMU->OSCENCMD = CMU_OSCENCMD_AUXHFRCOEN;
    17. /* Wait until clock is ready */
    18. while (!(CMU->STATUS & CMU_STATUS_AUXHFRCORDY)) ;
    19. /* Enable trace in core debug */
    20. CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
    21. /* Enable PC and IRQ sampling output */
    22. *dwt_ctrl = 0x400113FF;
    23. /* Set TPIU prescaler to 16. */
    24. *tpiu_prescaler = 0xf;
    25. /* Set protocol to NRZ */
    26. *tpiu_protocol = 2;
    27. /* Unlock ITM and Output data */
    28. ITM->LAR = 0xC5ACCE55;
    29. ITM->TCR = 0x10009;
    30. }
    Display All


    But for J-Link V8 I use the same environment but the trace function and SWO output not work as expect
    Could anyone suggest me how to configure the SWO for J-Link V8

    The post was edited 1 time, last by bancha ().

  • Hi,

    1) What board exactly do you use? I assume the EFM32-G8XX-STK with an EFM32G890F128 on it?
    2) What debugger are you using?
    Note: You always need to make sure that:
    - The debugger configures the correct SWO frequency for J-Link, so it uses the same (max. +- 3%) SWO frequency as the target, since otherwise communication would not work.
    Usually, the debugger just needs to know the CPU frequency the target is running with since this is used as the base frequency which is divided to the appropriate one that is supported by the target and by the connected J-Link.
    The initialization is done by the debugger itself.
    Please also note that different models of J-Link might support different SWO speeds due to the specifications of the CPU they are based on.

    Can you provide the project you are working with?


    Best regards
    Alex
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.