[SOLVED] RTT binary stream

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

  • [SOLVED] RTT binary stream

    Any way I could send binary up to the PC on ch0 of RTT?

    I'm connecting directly via telnet to Jlink driver, leaving RTTViewer out.

    But when I send 0xFF it interprets it as control character and closes connection.
    And next time I connect I get NVT message.

    Telnet does support binary mode
    github.com/kdart/pycopia/blob/…copia/inet/telnet.py#L170
    it only has to be set once.

    I know it listens on telnet for 100ms on startup for control commands, this would be perfect time for it, or even better as parameter.

    If I cannot use binary mode then I have to send everything as hex ascii which reduces the speed to half.
  • Hi,

    No logic inside the J-Link software interprets rhe RTT data. It is just forwarded from one side to the other (host -> target or the other way around).
    All the interpretation of the data itself is up to the host and target application.

    We will check again but there should not be any problem with sending 0xFF, 0xFE, … down to 0x00 for a byte.
    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.
  • SEGGER - Alex wrote:

    Hi,

    No logic inside the J-Link software interprets rhe RTT data. It is just forwarded from one side to the other (host -> target or the other way around).
    All the interpretation of the data itself is up to the host and target application.

    We will check again but there should not be any problem with sending 0xFF, 0xFE, … down to 0x00 for a byte.


    When I checked, I have sent up from RTT target this:
    0x23,0x00,0x01,0xff,0xfe

    which dropped my TCP client, and on reconnection it sent me the banner plus something like

    "NVT something 0xff,0xfe"
    the NVT came from Jlink driver, not from my code.
    I guess it's control commands for telnet.

    Direct binary pipe would be great, that's the most versatile.
  • Hi,
    The RTT TELNET channel is technically a RAW socket.
    See: wiki.segger.com/J-Link_RTT_TELNET_Channel

    Except:

    https://wiki.segger.com/J-Link_RTT_TELNET_Channel wrote:

    Note:
    The channel is "TELNET-like", which means:
    • The TELNET protocol is not fully implemented, so not all functionality is supported.
    • It is TELNET compliant for RTT data that is solely consisting of printable characters, only.
    • Raw (non-character) RTT data has to be interpreted as raw bytes.

    What does this mean?
    When you are sending bytes, these bytes will be written just as they are to the Socket, which is not TELNET complient.

    Example:
    If your target does something like:

    C Source Code

    1. char ac[12] = {0x23,0x00,0x01,0xff,0xfe};
    2. SEGGER_RTT_Write(0, ac, 5);
    Then the 5 bytes will be written to the socket.
    So, reading 5 bytes from the socket will give you the desired data.

    You can verify this by reading raw data from the socket.

    In short:
    Simply read the data from the Socket as raw bytes and you should be fine.

    balance3164 wrote:

    "NVT something 0xff,0xfe"
    the NVT came from Jlink driver, not from my code.
    I guess it's control commands for telnet.
    That is incorrect.
    Where ever it is coming from, it is not from the J-Link Software.
    Googling suggests that NVT stand for "Network Virtual Terminal", which is not supported by J-Link Software.
    See: geeksforgeeks.org/what-is-netw…rtual-terminal-in-telnet/
    So I guess that some background layer of your software is using it.

    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.
  • Sorry, you are right, the issue was Hercules TCP client added extra data to it.
    After writing a simple TCP client in python I get raw data.

    import socket

    client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    client_socket.connect(('127.0.0.1', 19021))

    while 1:
    data = client_socket.recv(1024)
    print('got', data.decode('utf-8','ignore'))
    print('gothex', data.hex())

    client_socket.close()


    Thank you!
  • Hi,
    You are welcome! :)

    It is good to hear that this is no longer blocking for you.

    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.