Connect a Laptop with Windows to Peripheral UART example

Sure, my question is very stupid, but after one day I found nothing to explain the principle of the situation, I decided to ask.

I have a laptop with built-in Bluetooth 5.2 and Windows 11. It runs a terminal testing program.

I have nRF5340 DK with the example Peripheral UART installed (nRF Connect SDK1.8.0). The board works normally, I tested it with a phone with Android and nRF Connect for Mobile. Everything is working fine. The board is connected to a desktop computer on which a terminal program is running and connected to COM port ( not USB).

Windows (laptop), sees the board. After pressing adding device (on Win), the LED on the board (connected) lights up for 1 second, Windows thinks about 5 seconds, and says try again. I imagine that it will connect to the board, and a window will appear to install a serial port to which I can connect through the terminal program. No PIN display window appears. I tried to quickly press button 1, possibly to confirm, nothing. I can transmit data over the phone without the board being BONDED. Let me just say that I've been doing Nordic for 6 months, and I've learned some things. But here I can't even imagine what should happen. Google didn't help either. Does anything else need to be installed on the board?

In the final version, it should be a remote device to which with any laptop with Bluetooth 5.2, to be able to connect and through a terminal program to exchange data via serial port.

  • There are no messages or windows from Windows. Just click on add this device, it thinks 3-5 seconds, and writes try to connect this device again.

    In capture:

    1. Start capture.

    2. Choose Nordic_UART_service.

    3. Click 3 times to Add device in Windows.

    4. Stop Capture.

    LaptopW11_01.zip

    -------------------------

    There are new things, after a whole day guessing what's going on.

    I use VSC (last version for all), there is no debug information at all. I decided that I don't know what version is installed in the Net core. It is also not at all clear what and where the VSC programs, whether only the App core or both cores. I decided to delete the Net core, securely and manually, and reprogram it. I launched NRF Programmer, and there after two hours I found out that it is not clear what is happening. I press Erase all. I program again with VSC. Surprisingly, Bluetooth works (with phone). Therefore, the VSC programs both cores. However, for sure I decided to do the same project and program it with SEGGER Embedded studio, at least there I know that only the app core can be programmed. So again, Erase all in NRF Programmer, Program with SEGGER, and … Bluetooth works (with phone), what??? At that moment I realized that the NRF Programmer does not see or delete the net core at all. However, it is difficult for me to give up, there is a connect to J-link-> Erase all in SEGGER. Program again and … Bluetooth works (with phone). Obviously, the net core is not deleted here either. However, I decided to launch a debug (with the laptop already!!)., some information may appear, and miracles:

     

    [00:04:17.606,475] [0m<inf> peripheral_uart: Connected 5C:FB:3A:53:9C:3A (public)[0m

    [00:04:18.180,725] [0m<inf> peripheral_uart: Passkey for 5C:FB:3A:53:9C:3A (public): 929526[0m

    [00:04:18.180,725] [0m<inf> peripheral_uart: Press Button 1 to confirm, Button 2 to reject.[0m

    [00:04:25.029,693] [0m<inf> peripheral_uart: Numeric Match, conn 0x20000a60[0m

    [00:04:27.963,836] [1;33m<wrn> peripheral_uart: Security failed: 5C:FB:3A:53:9C:3A (public) level 1 err 9[0m

    [00:04:27.963,958] [0m<inf> peripheral_uart: Pairing failed conn: 5C:FB:3A:53:9C:3A (public), reason 9[0m

    [00:04:27.964,263] [0m<inf> peripheral_uart: Disconnected: 5C:FB:3A:53:9C:3A (public) (reason 8)[0m

     

    The PIN code confirmation window appears in Windows. I press it, then press button 1 on the board. And the connection falls again. I tried several times, the same.

    I programmed without debugging with SEGGER. No debugging information, but the PIN window appears again and then the connection breaks down.

    I closed the SEGGER and opened the VSC, programming directly. The PIN window reappears, and breaks down.

    I don't know why PIN window appears.

     

    I finally realized that it is not clear which program is programming what. In Windows, nothing has been changed or updated. In VSC and SEGGER I program the same project (one common project directory, and two separate ones for each program.) without changing anything, the standard example.

     

    I decided that despite the stupid question of where the net core is in the NRF programmer /2.2.0/, I will have to ask in the forum. After about half an hour of searching, I came across this topic / NRF Connect Programmer 2.2.0 Broken for nrf53 / from 10 days ago, it has already been asked. For another hour, I didn't know how to register for this topic /subscribe !! not for notification/. In the user's control panel, these are two different things. It was enough for me.

     

    Once you've fixed the NRF programmer, and I'm sure the net core has been erased and programmed with the latest version, then I'll keep guessing. At least one thing to be certain.

     

    For now, I'm stopping pretending to be a fortune teller, that's not the way to work.

  • Hi again

    After testing this on my end on my work laptop (Windows 10 device) I think I see what the issue is. When I try connecting to the Nordic_UART_Service device the PC will initiate a pairing procedure it seems, and thus the board follows the pairing procedure, displays a pin code and prompts the computer to accept this pin. Then you need to press button 1 on the DK to confirm, or button 2 to reject. If I don't press any buttons I see the same behavior as what you explain, I wait for a few seconds and get a message to try connecting again. I can press button 1 to accept and thus connect to the device.

    I'm sorry, I'm not sure I understand what exactly you did to make the pairing happen. Was it sufficient to do an erase all in SEGGER and program the NET and APP cores?

    What device/DK are you using as a sniffer device, as the sniffer trace did not look to pick up any advertisements what so ever. 

    The NET core is indeed not available from the nRFConnect programmer app. 

    Finally, I also asked a colleague with a Windows 11 machine with BLE to test. They used the standard peripheral_uart sample project and did not have any issues. So there goes my theory. Here are logs of the standard application (defaulting to numeric comparison):

    [00:00:00.017,883] <inf> bt_hci_core: No ID address. App must call settings_load()
    [00:00:00.017,883] <inf> peripheral_uart: Bluetooth initialized
    [00:00:45.050,933] <inf> peripheral_uart: Connected 18:56:80:9D:AD:EF (public)
    [00:00:45.478,698] <inf> peripheral_uart: Passkey for 18:56:80:9D:AD:EF (public): 423061
    [00:00:45.478,698] <inf> peripheral_uart: Press Button 1 to confirm, Button 2 to reject.
    [00:00:49.498,657] <inf> peripheral_uart: Numeric Match, conn 0x20001870
    [00:00:54.162,170] <inf> peripheral_uart: Security changed: 18:56:80:9D:AD:EF (public) level 4
    [00:00:54.315,338] <inf> peripheral_uart: Pairing completed: 18:56:80:9D:AD:EF (public), bonded: 1
    [00:00:57.791,290] <inf> peripheral_uart: Disconnected: 18:56:80:9D:AD:EF (public) (reason 19)

    Here's a log when connecting with a passkey:

    [00:01:02.485,290] <inf> peripheral_uart: Connected 18:56:80:9D:AD:EF (public)
    [00:01:02.888,763] <inf> peripheral_uart: Passkey for 18:56:80:9D:AD:EF (public): 149895
    [00:01:22.012,695] <inf> peripheral_uart: Security changed: 18:56:80:9D:AD:EF (public) level 4
    [00:01:22.120,452] <inf> peripheral_uart: Pairing completed: 18:56:80:9D:AD:EF (public), bonded: 1
    [00:01:25.146,789] <inf> peripheral_uart: Disconnected: 18:56:80:9D:AD:EF (public) (reason 19)

    Best regards,

    Simon

  • Board - nRF5340 DK

    Sniffer - nRF52840 Dongle

    Laptop - HP Envy x360 15-eu0023nn , support.hp.com/.../c07650663

    Windows 11 Home 64 bit

    Pairing, from last post:

    “The PIN code confirmation window appears in Windows. I press it, then press button 1 on the board. And the connection falls again. I tried several times, the same.”

    Software:

    Before updating all Nordic software, the version I was working with was 1.7.1 nRF Connect SDK. I suspect that this version is installed in the net core.

    Then everything was updated to the latest version nRF Connect SDK 1.8.0. From here I program the example - standard peripheral_uart sample.

    NRF Connect Programmer became version 2.2.0, and no longer sees the net core. As far as I found, it neither programs nor erases it.

    Unfortunately, apparently it is not erased through the SEGGER either (connect to J-link-> Erase all).

    If I could somehow erase it (net core), when programming the example in SEGGER, the LED would flash, but there would be no Bluetooth. However, this does not happen, there is always Bluetooth.

    The only way I know how to program the net core is from the NRF Connect Programmer, to put the HEX file and program it. This is not working at the moment with 2.2.0.

    I don't know what VSC is programming, one or both cores. There is no debugging information and nothing can be seen.

    The HEX files there are different (VSC/ SEGGER), which is very strange to me, because the example is the same. In general, which file is actually programmed?

     

    SEGGER

    \SDK\ncs\v1.8.0\nrf\samples\bluetooth\peripheral_uart\build_nrf5340dk_nrf5340_cpuapp\zephyr

    merged_domains.hex - 838k

    merged.hex - 374k  -> APP CORE

    zephyr.hex - 374k ( != merged.hex)

    \SDK\ncs\v1.8.0\nrf\samples\bluetooth\peripheral_uart\build_nrf5340dk_nrf5340_cpuapp\hci_rpmsg\zephyr

    app.hex - 465k

    merged_CPUNET.hex - 465k ( = app.hex)  ->NET CORE

    zephyr.hex - 465k ( != merged_CPUNET.hex)

     

    VSC

    \SDK\ncs\v1.8.0\nrf\samples\bluetooth\peripheral_uart\build\zephyr

    GENERATED_CP_APPLICATION_merged_domains.hex - 458k

    GENERATED_CP_NETWORK_merged_domains.hex - 465k ( same as merged_CPUNET.hex from SEGGER

    )

    merged_domains.hex - 922k

    merged.hex - 458k ( = GENERATED_CP_APPLICATION_merged_domains.hex)

    zephyr.hex - 458k (!= merged.hex)

    Here maybe:

    merged.hex / GENERATED_CP_APPLICATION_merged_domains.hex  -> APP CORE

    GENERATED_CP_NETWORK_merged_domains.hex - I don't know if it's being programmed to NET CORE

     

    Why ?  SEGGER/merged.hex - 374k  and    VSC/merged.hex - 458k                    -> APP CORE

    The laptop is not updated and there is no internet before the last tests for which I wrote about in the previous post. The window for the PIN code appeared, after programming the board in debug mode in SEGGER, why I do not know. It didn't exist before. After programming in VSC, why this window remained, I also do not know. I suspect that something is not reprogrammed but left from SEGGER, otherwise I have no idea.

    That's why I want the NRF Connect Programmeo work to make sure the chip is erased before I program anything. I do not want to go back to old versions, as described in the colleague's topic that I mentioned in the last post.

    ===

    From last post : [00:04:25.029,693] [0m<inf> peripheral_uart: Numeric Match, conn 0x20000a60[0m.

    so button 1 is detected correctly.

  • Hi

    Have you checked out the Working with nRF5340 DK guide in the nRFConnect SDK documentation? It describes how to build the APP or NET core of the nRF5340. You generally have to flash the NET and APP core separately unless you merge them yourself. In BLE applications, usually the NET core is flashed with the Bluetooth: HCI RPMsg sample, and the application core is flashed with one of the Bluetooth samples.

    Best regards,

    Simon

  • Even when it was 1.7.1 (nRF Connect SDK), that's exactly what I did. I opened an example ( from Bluetooth samples ) and generated the project with SEGGER, then I only worked with it. Then I started the NRF Connect Programmer, threw the hex file for the net core and programmed it. I haven't changed it since. I experimented with different examples, they all worked fine (there were old declarations for improvement, but nothing special). I haven't touched the net core.

    After that, everything was updated (nRF Connect SDK 1.8.0), and I decided to try a little more seriously what works. And then I tried the laptop, and I saw that nothing was happening. Until then, I only tried with a phone.

    ========================

    The net core I reprogrammed accordingly. this:

    developer.nordicsemi.com/.../ug_nrf5340.html

     

    No difference, it still can't connect. Same error:

    [00:00:09.601,135] [0m<inf> peripheral_uart: Connected 5C:FB:3A:53:9C:3A (public)[0m

    [00:00:10.182,373] [0m<inf> peripheral_uart: Passkey for 5C:FB:3A:53:9C:3A (public): 004792[0m

    [00:00:10.182,403] [0m<inf> peripheral_uart: Press Button 1 to confirm, Button 2 to reject.[0m

    [00:00:18.688,446] [0m<inf> peripheral_uart: Numeric Match, conn 0x20000a60[0m

    [00:00:19.965,484] [1;33m<wrn> peripheral_uart: Security failed: 5C:FB:3A:53:9C:3A (public) level 1 err 9[0m

    [00:00:19.965,606] [0m<inf> peripheral_uart: Pairing failed conn: 5C:FB:3A:53:9C:3A (public), reason 9[0m

    [00:00:19.965,911] [0m<inf> peripheral_uart: Disconnected: 5C:FB:3A:53:9C:3A (public) (reason 8)[0m

     

    What is level 1 err 9?

Related