[SOLVED] RTT not flushing on LPC? Check for WFI

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

  • [SOLVED] RTT not flushing on LPC? Check for WFI

    I stumbled on a problem with NXP LPC845 (ARM Cortex-M0+):
    The RTT output was very, very slow like it was stuck in the pipe (not flushed).
    I have found a report of the same problem here: LPC82x, FreeRTOS, RTT Not Flushing

    Finally, I have found the problem (and the solution):
    the problem is related to low power mode on the LPC. In FreeRTOS it enters low power mode with the WFI instruction, causing the RTT communication to stuck.
    Interestingly, the same WFI works fine on ARM Cortex-M4, so not sure why it affects M0+.
    Anyway, the 'solution' was to turn off WFI for Cortex-M0:

    Source Code

    1. void McuRTOS_vApplicationIdleHook(void)
    2. {
    3. /* Called whenever the RTOS is idle (from the IDLE task).
    4. Here would be a good place to put the CPU into low power mode. */
    5. /* Write your code here ... */
    6. #if McuLib_CONFIG_CORTEX_M==0 && PL_CONFIG_USE_RTT
    7. /* somehow on LPC this does slow down RTT communication a lot! */
    8. #else
    9. __asm volatile("dsb");
    10. __asm volatile("wfi");
    11. __asm volatile("isb");
    12. #endif
    13. }
    Display All
    I hope this saves someone else time and efforts,
    Erich
  • Hi Erich,
    Thank you very much for your contribution!

    We will close this thread now.

    Best regards,
    Fabian
    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.