[SOLVED] JLinkRTTViewer issue with multiple terminals

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

  • [SOLVED] JLinkRTTViewer issue with multiple terminals

    Hi,


    I'm having issues accessing multiple terminal in J-Link RTT Viewer v6.94b both in Linux and Windows.

    My setup is:
    • STM32H753VI custom board
    • J-Trace PRO and J-Link base
    • SWD port is used


    Code is very basic:
    • From STM32CodeMX enable Trace Asynchronous SW from Debug
    • Generate code
    • Add SEGGER sources
    • Add this to main

    C Source Code

    1. char bufferUp[1024];
    2. char bufferDown[1024];
    3. SEGGER_RTT_ConfigUpBuffer(0, NULL, NULL, 0, SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL);
    4. SEGGER_RTT_ConfigUpBuffer(1, "Term1Up", bufferUp, 1024, SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL);
    5. SEGGER_RTT_ConfigDownBuffer(1, "Term1Down", bufferDown, 1024, SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL);
    6. SEGGER_RTT_WriteString(0, "SEGGER Real-Time-Terminal Sample\r\n\r\n");
    7. SEGGER_RTT_WriteString(0, "###### Testing terminals ######\r\n");
    8. /* USER CODE END 2 */
    9. /* Infinite loop */
    10. /* USER CODE BEGIN WHILE */
    11. while (1)
    12. {
    13. /* USER CODE END WHILE */
    14. /* USER CODE BEGIN 3 */
    15. SEGGER_RTT_WriteString(0, "Print terminal 0\r\n");
    16. HAL_Delay(1000);
    17. SEGGER_RTT_WriteString(1, "Print terminal 1\r\n");
    18. HAL_Delay(1000);
    19. }
    Display All



    Expected result:
    • In Terminal 0

    Source Code

    1. SEGGER Real-Time-Terminal Sample
    2. ###### Testing terminals ######
    3. Print terminal 0
    4. Print terminal 0
    5. Print terminal 0
    6. Print terminal 0
    7. Print terminal 0
    • In Terminal 1

    Source Code

    1. Print terminal 1
    2. Print terminal 1
    3. Print terminal 1
    4. Print terminal 1
    5. Print terminal 1
    6. Print terminal 1
    • In All Terminals

    Source Code

    1. 00> SEGGER Real-Time-Terminal Sample
    2. 00>
    3. 00> ###### Testing terminals ######
    4. 00> Print terminal 0
    5. 01> Print terminal 1
    6. 00> Print terminal 0
    7. 01> Print terminal 1
    8. 00> Print terminal 0
    9. 01> Print terminal 1
    10. 00> Print terminal 0
    11. 01> Print terminal 1
    12. 00> Print terminal 0
    13. 01> Print terminal 1
    Display All

    Actual result
    • All Terminals: only have Terminal 0 output
    • Terminal 0: has expected output
    • Terminal 1: has nothing


    More information:
    • While debugging, it appears that both buffer as read by RTTViewer, _SEGGER_RTT.aUp[0].WrOff is equal to _SEGGER_RTT.aUp[0].RrOff as well as _SEGGER_RTT.aUp[1].WrOff is equal to _SEGGER_RTT.aUp[1].RrOff. My understanding is that both buffer are fully read by the J-Link/J-Trace.
    • Using two terminal window, I'm able to log both terminal to file: this is my actual workaround, doesn't support colour though
      • JLinkRTTLogger -Device stm32h753vi -Speed 4000khz -If swd -RTTAddress auto-detection -RTTChannel 1 channel1
      • JLinkRTTLogger -Device stm32h753vi -Speed 4000khz -If swd -RTTAddress auto-detection -RTTChannel 0 channel0


    Question:
    • How do I get JLinkRTTViewer to display two or more terminal? Ideally on both Windows and Linux.



    As a side note, I have a segfault when trying to display channel infos(F8). On Windows, it sometimes works, other times the application quits while kinda fast flashing the channel information window. Here are two partial crash from gdb:

    Source Code

    1. QPixmap: It is not safe to use pixmaps outside the GUI thread
    2. QPixmap: It is not safe to use pixmaps outside the GUI thread
    3. QPixmap: It is not safe to use pixmaps outside the GUI thread
    4. QPixmap: It is not safe to use pixmaps outside the GUI thread
    5. QPixmap: It is not safe to use pixmaps outside the GUI thread
    6. QPixmap: It is not safe to use pixmaps outside the GUI thread
    7. QObject::startTimer: QTimer can only be used with threads started with QThread
    8. QObject::startTimer: QTimer can only be used with threads started with QThread
    9. Thread 2 "JLinkRTTViewerE" received signal SIGSEGV, Segmentation fault.
    10. [Switching to Thread 0x7ffff5bfd640 (LWP 55202)]
    11. 0x00007ffff76e1399 in ?? () from /opt/SEGGER/JLink/libQtGui.so.4
    Display All

    Source Code

    1. QObject::startTimer: QTimer can only be used with threads started with QThread
    2. QObject::startTimer: QTimer can only be used with threads started with QThread
    3. [xcb] Unknown sequence number while processing queue
    4. [xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
    5. [xcb] Aborting, sorry about that.
    6. JLinkRTTViewerExe: xcb_io.c:269: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.
    7. Thread 1 "JLinkRTTViewerE" received signal SIGABRT, Aborted.
    8. 0x00007ffff6a65615 in raise () from /usr/lib/libc.so.6
  • Hi,
    Thank you for your inquiry.

    Regarding the terminal output:
    If you look into the documentation, you will see that the J-Link RTT Viewer Only support RTT channel 0 for Terminal usage, and channel 1 only for logging.
    This is not to be mistaken with RTT terminals, which are "virtual".

    To send data to different terminals, you would have to send them via channel 0 using SEGGER_RTT_SetTerminal() and/or SEGGER_RTT_TerminalOut() functions.
    You can find further information about this here:
    - API functions: wiki.segger.com/RTT#API_functions
    - RTT Viewer: wiki.segger.com/J-Link_RTT_Viewer (especially the first paragraph)

    Regarding the segfault:
    We will look into this as soon as possible.
    This should of course not happen.

    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.
  • Hi,
    You're welcome!
    Don't worry, channel and terminal is mixed up easily when it comes to RTT, and many people do.

    As this issue is resolved now, we will close this thread.

    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.