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

Mesh serial example with a timeout event

Hi:

I am trying the "Mesh Serial" example on my nrf52840 boards. However, when the Echo command is used after the device is cold-started, a timeout event will occur. I have tried some existing methods in the forum, but none of them worked. The output are shown as below:

PS D:\DATA_SHARE\nrf5_SDK_for_Mesh_v4.2.0_src\scripts\interactive_pyaci> python .\interactive_pyaci.py -d COM10 --no-logfile

    To control your device, use d[x], where x is the device index.
    Devices are indexed based on the order of the COM ports specified by the -d option.
    The first device, d[0], can also be accessed using device.

    Type d[x]. and hit tab to see the available methods.

Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.18.1 -- An enhanced Interactive Python. Type '?' for help.

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

In [2]: 2020-09-20 16:27:17,843 - INFO - COM10: cmd Echo, timeout waiting for event

I may have found the reason, that is, there is a certain difference between my development board and the official development board. My board has a Jlink port for programming (buttom right of the board) and a seperate mini-usb port for serial output. (top left of the board). Similar things happened when I tried to run RIOT OS on my board. The Jlink port was recognized as ttyACM0 on Ubuntu and mini-usb port was recognized as ttyUSB0. In the RIOT tutorial, the Jlink port is used for both programming and serial output. But my board use Jlink only for programming and mini-usb for serial output

Latter, I find that if I plug in & plug out the Jlink after the cold start, the board can respond to the Echo command. The output and the COM port on Windows are shown as below:

PS D:\DATA_SHARE\nrf5_SDK_for_Mesh_v4.2.0_src\scripts\interactive_pyaci> python .\interactive_pyaci.py -d COM10 --no-logfile

    To control your device, use d[x], where x is the device index.
    Devices are indexed based on the order of the COM ports specified by the -d option.
    The first device, d[0], can also be accessed using device.

    Type d[x]. and hit tab to see the available methods.

Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.18.1 -- An enhanced Interactive Python. Type '?' for help.

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

In [2]: 2020-09-20 16:27:01,840 - INFO - COM10: {event: DeviceEchoRsp, data: {'data': '123'}}

Therefore, my initial guess is that there are related configurations in SoftDevice. After a cold start, it uses the Jlink interface as the default serial output interface, but my board lacks relevant hardware functions. When I plug in & plug out the Jlink port, it will detect a Jlink disconnection event and switch the current serial output interface to min-usb port.

So here comes my question: Is my guess correct? If so, can I redirect the default serial output to mini-usb port?

Thank you!

Parents
  • Hi,

    What port (on the PC) you get UART communication over is not something that the nRF can control. From what you describe, it sounds like both the J-Link programmer and the mini-usb with USB-to-serial are connected to the same UART pins of the nRF, and which one of those to use is controlled by logic on the board itself.

    If I understand correctly, there is a J-Link programmer on your board? Maybe it also controls (overrides) the USB-to-serial converter with the mini-USB port, and whether it is connected to the nRF UART pins? You need to consult the documentation for the board, in order to see how things are connected...

    Regards,
    Terje

  • Hi Terje:

    Thanks again for the reply. I have find the PCB design of my board. The UART part is shown as below:

    I checked the PCB of nrf52840 DK, it seems that the UART pin definations are all reversed (e.g. P0.05 is used for RTS on nrf52840 DK but CTS on my board)? Also there is a switch on the nrf52840 DK which can switch between "IF OFF" and "IF MCU". So what is the function of the switch? Is it possible that this is the reason why serial has a timeout problem after a cold start?

    Best Regards

    Yeming Li

  • Hi,

    Sorry for the late reply.

    "IF OFF" / "IF MCU" is whether or not the interface MCU on the nRF52840 DK should use the UART connection to the nRF. It is an internal signal line on the DK board. From what I can tell from the hardware files, the interface MCU will use the UART lines if SW6 is set to "DEFAULT" and USB is detected on the interface MCU USB connector. I do not see how it should affect your setup. In any case, what you see is on the third party board, not on the nRF52840 DK, right?

    If you have any activity on the nRF UART pins, when the application is downloaded, then I guess it would be possible to end up in a bad state, that a reset would mitigate.

    Regards,
    Terje

Reply
  • Hi,

    Sorry for the late reply.

    "IF OFF" / "IF MCU" is whether or not the interface MCU on the nRF52840 DK should use the UART connection to the nRF. It is an internal signal line on the DK board. From what I can tell from the hardware files, the interface MCU will use the UART lines if SW6 is set to "DEFAULT" and USB is detected on the interface MCU USB connector. I do not see how it should affect your setup. In any case, what you see is on the third party board, not on the nRF52840 DK, right?

    If you have any activity on the nRF UART pins, when the application is downloaded, then I guess it would be possible to end up in a bad state, that a reset would mitigate.

    Regards,
    Terje

Children
No Data
Related