This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Mesh Serial Example Problem (timeout waiting for event)

Hello I have problem with Mesh Serial Example and Interactive_pyaci, it works just in Debug-Mode. I use nRF52840, nRF5_SDK_15.0.0_a53641a, nrf5_SDK_for_Mesh_v2.0.1, Python3.5.2 64bit on linux mint 18 64bit. JLink_Linux_V633f_x86_64.

In aci_uart.py I set :  def __init__(self, port, baudrate=115200, device_name=None, rtscts=False):

In Debug-mode it works:

Activating auto-logging. Current session state plus future input saved.
Filename       : log/18-178-8-46_interactive_session.log
Mode           : backup
Output logging : False
Raw input log  : False
Timestamping   : False
State          : active
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.4.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: send(cmd.Echo("test"))

In [2]: 2018-06-27 08:46:48,476 - INFO - ttyACM0: {event: DeviceEchoRsp, data: {'data': bytearray(b'test')}}

But if I plug-out and  plug-in the device again, I get :

In [2]: 2018-06-27 08:49:12,153 - INFO - ttyACM0: cmd Echo, timeout waiting for event

in examples/serial/include/sdk_config.h  there are a lot of definitions with UART what exactly should i set to 1, if this is the problem ?

I'm new in this topic and my aim is to receive all the packets in the mesh and to send them to the host pc.

Are there any mesh monitors for observ the mesh traffic ?

Parents Reply Children
  • If you plug out & plug in the serial device that is running interactive_pyaci, you will need to close the interactive_pyaci terminal & start from the beginning again with:

    python interactive_pyaci.py -d /dev/ttyACM0 --no-logfile
  • the problem is still there but I dont use this interactive script anymore. Instead of this I use putty . Now I have another problem and maybe you are also competent in this one and can help me:

    I changed the serial_nrf52840_xxAA example like this:

    int main(void)
    {
        initialize();
        execution_start(start);
        uint32_t result;
        static char tx_message[] = "Hello nrf_serial!\n\r";
        result = nrf_mesh_serial_tx(tx_message, sizeof(tx_message));
         __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Send result hello: %d\r\n", result);

        
        for (;;)
        {
         
            (void)sd_app_evt_wait();
              
             
        }
    }

    Properties i use in putty:

    Baudrate: 115200

    Data bits: 8

    Stop bits 1:

    Parity: none

    Flow control: none

    The problem is that I receive in front of Hello nrf_serial!\ some strange characters that i did not send.

    something like:  #c#Hello nrf_serial! 

    i tested it also with that c programm: https://github.com/xanthium-enterprises/Serial-Port-Programming-on-Linux and get also some unknown characters in front of my message.

    Any ideas where does it come from?

  • ok i think I got it,What I receive is not just a string from application layer, its a serial_packet. I need to use the serial_packet.h, serial_cmd.h and serial_evt.h to parse the packet  right way.

    1)are there some limitations:how often can I send such packets per second ? (because of Radio-Frequency stuff ) .


    2)Do you have some c-file examples, how to use all those comands and events on the host PC ?

    3) Do I have to implement the ECDH offloading-support on the Host PC ?
    at the moment  I dont understand how ECDH offloading works together with the device and where is the code for this job.





  • 1) My guess is you may have a limitation based on the Bluetooth Mesh specifications itself. Let me double check this & get back to you.

    2) If you mean another way to use the serial example instead of via the Interactive PyACI on the host pc, then no, unfortunately not. You could try to modify the Interactive PyACI python script, as long as you follow the copyright notice on top of the file.

    3) From the documentation provided, it seems you do not have to implement ECDH offloading on the host pc. This link says that you should enable ECDH offloading if you are running multiple provisioners in parallel. The code to enable ECDH offloading is given in the link. I am unsure how the serial example tells the computer to do ECDH operations. I could ask internally about this if you want? Short answer: no, you don't have to do, but can be useful if you are running multiple concurrent provisioners.

  • ok I'm agin back to the interactive PyACI script because all the Datastructure  is already implemented there. But as I said bevore it still does not work proper.

    I found out that I can always read data from the device: I implemented a button which sends a number via serial port. It works after plugout & plugin but if i try to send a comand to the device i get a time out error. I dont understand why.
    And why i can send messages tho the device just after i flashed it but not after re-pluging.

    there is some output: first I try to send a command to the device but it does not work. After that i press button #1 on the board four times and send the number 1 to the Host-PC and it works.

    In [1]: send(cmd.Echo("test"))

    write data
    In [2]: 2018-07-09 10:29:23,823 - INFO - ttyACM1: cmd Echo, timeout waiting for event
    2018-07-09 10:29:33,888 - INFO - ttyACM1: {event: Application, data: {'data': bytearray(b'1')}}
    2018-07-09 10:29:34,456 - INFO - ttyACM1: {event: Application, data: {'data': bytearray(b'1')}}
    2018-07-09 10:29:34,994 - INFO - ttyACM1: {event: Application, data: {'data': bytearray(b'1')}}
    2018-07-09 10:29:35,425 - INFO - ttyACM1: {event: Application, data: {'data': bytearray(b'1')}}

    Serial events are sent asynchronously, what about commands, how are they sent ?
    maybe this is the reason for the problem, because the synchronous stuff does not work properly ?

    concerning theECDH, ask please If you have the time , would be interessting.

Related