Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Serial logging errors

    Scheduled Pinned Locked Moved Discussion
    4 Posts 3 Posters 24 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A Offline
      Andrea Picillo
      last edited by

      Hi there,
      I'm facing this problem.

      I've lunched a script that every seconds sends a TCP Modbus message and wait for a response.
      Most of time everything is ok and I get something like that

      TCP - _send_receive - Send b'\xdf\xa9\x00\x00\x00\x06\xff' 57257
      tcp_output_segment: rtseq 19578
      <packet content>
      Pass to IP Layer
      tcp_receive: pcb->rttest 643 rtseq 19578 ackno 19590
      tcp_receive: experienced rtt 0 ticks (0 msec).
      tcp_receive: RTO 3 (1500 milliseconds)
      TCP - _send_receive - Receive b'\xdf\xa9\x00\x00\x00\x07\xff\x03\x04\x00\x00N '
      [658579][TRACE][ModbusManager]: read() - Reg Value Read
      counter: 218
      

      Sometimes serial output gives me errors like that

      ff Pass to IP LayerTCP  - _send_-rece ive U- SeRnd b'\xefM\xd4E\x00T\x00 \x00-\x06\xff'  613396
      

      like if something mixes up the content.
      What's your idea?
      I'm not using thread to lunch the script nor any lock.
      Sentences in brackets are coming from my script, the others from debugging at pycom esp idf level.

      Thank you very much.
      Greetings,
      Andrea

      robert-hhR J 2 Replies Last reply Reply Quote 0
      • robert-hhR Offline
        robert-hh @Andrea Picillo
        last edited by

        @Andrea-Picillo So it seems that the messages:
        Pass to IP Layer ....
        and
        TCP - _send_receive ...
        get mixed in the output, which I assume to be the output at the USB interface. In which context and how are these two messages generated?

        1 Reply Last reply Reply Quote 0
        • J Offline
          jcaron @Andrea Picillo
          last edited by

          @Andrea-Picillo IIRC the IP stack runs on a separate core, so application logs and IP logs could get mixed, I suppose, depending on the implementation of logging.

          1 Reply Last reply Reply Quote 0
          • A Offline
            Andrea Picillo
            last edited by Andrea Picillo

            The

            Pass to IP Layer ....
            

            string is generated into lwip library. I've added that string into the ethernet.c file that is part of the lwip library.
            I've built the wifi/scan project and then substituted the lwip.a file into the pycom-micropython project.

            The code used to generate that strings is something like this

            LWIP_DEBUGF(ETHARP_DEBUG, ("Pass to IP Layer \n"));
            

            Of course i've changed the ETHARP_DEBUG value from LWIP_DBG_OFF to LWIP_DBG_ON into lwipopts.h header file in order to enable the ETHARP DEBUG.

            The

            TCP - _send_receive ...
            

            string is generated at level application. I'm using a TCP Modbus external python library.
            I've added the following code into the library

            print('TCP - _send_receive - Receive %s' % response)
            

            The application (and the modbus tcp library of course) is frozen into the final build and then uploaded through pycom firmware update tool.

            TCP Modbus messages are managed from a manager that runs as a python thread.

            The log output is got from USB interface.

            1 Reply Last reply Reply Quote 0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • 1 / 1
            • First post
              Last post

            Pycom on Twitter

            Pycom