Serial logging errors

  • 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.

  • 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.


    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.

  • @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.

  • @Andrea-Picillo So it seems that the messages:
    Pass to IP Layer ....
    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?

Log in to reply

Pycom on Twitter