Current / best implementation for the BLE UART App nRF5_SDK\examples\ble_peripheral\ble_app_uart for the nRF25840 Dongle?

Hello,

could someone point me where I can find the most current / state of the art example for the BLE UART app for the nRF25840 Dongle?

The version in the nRF5_SDK does not support the dongle. I guess the latest examples work with VS Code rather than Segger.

Unfortunately I have not found anything so far.

What I want to achieve:

Quickly have an working example on my dongle that transmits incoming strings from BLE to serial and vice versa.

Many thanks in advance.

Regards, Andreas

  • Hello,

    I suggest you check out the nRF5 SDK\examples\peripheral\usbd_ble_uart, but you need to port it from the DK to the dongle. The difference from the normal ble_app_uart example and this one, is that this uses the USB peripheral on the nRF instead of the UART. The USB part of the dongle is connected to the peripheral USB, and not the UART via the debugger (which is not present). 

    Best regards,

    Edvin

  • Hi Edvin,

    thanks for the response so far. I am not absolutely sure if this is the right example at all. What I want to achieve / develop is a birectional BLE GATT Server to USB bridge allowing you to transfer text from the BLE Client over the Nordic HW to the Terminal and vice versa. Is there a better example for this or is this the right choice?

  • Hello,

    If you were using 2x nRF52840 DK, the answer would be easy. You would need to use one of each of these:

    sdk\examples\ble_peripheral\ble_app_uart

    sdk\examples\ble_central\ble_app_uart_c

    Then plug the USB cable into the debug port, and then you would be good to go. They would use UART via the debugger and whatever is inserted on one side would be printed on the other side, and vice versa.

    On the nRF52840 dongle, however, no normal gpios are connected to the USB part of the dongle. The USB part of the dongle is the actual USB peripheral on the nRF52840. Therefore it is not possible to push UART through it. It needs to be USB_CDC, and this is why I am pointing at the sdk\examples\peripheral\usbd_ble_uart. This is the equivalent of sdk\examples\ble_app_uart, except that it uses USB_cdc instead (which is a serial port USB, as opposed to e.g. HID over USB (keyboard, mouse, etc.)). 

    So if you run one ble_app_uart_c and one usbd_ble_uart, then whatever is pushed into the uart of the ble_app_uart_c will be pushed out of the usb peripheral (usb_cdc) on the usbd_ble_uart device. 

    So this one is partly ported for you. You just need to make sure that it runs on the dongle, by changing the board files (so that the LEDs are on the right GPIOs and such). Then, if you want a dongle on the other end of the connection as well, you would need to adapt the example to be a ble_app_uart_c device instead of a ble_app_uart. I would recommend that you start with the ble_app_uart_c example, and try to swap out all UART parts with USB_CDC, similar to how it is done in the usbd_ble_uart example.

    Best regards,

    Edvin

  • Hi Edvin,

    I am not so into Segger right at the moment and try to get into it with tutorials first. Is also a Zephyr-related example for the new toolchain available or do I have to go the Segger way?

  • You can also use the nRF Connect SDK (which is based on Zephyr). If so, I advise you to use a DK first, to familiarize yourself with it (with a debugger, so that you can monitor logging).

    In that case, I can recommend the Nordic Developer Academy. There is a course called Bluetooth Low Energy Fundamentals which goes through the theory of setting up a BLE peripheral. 

    Basically it breaks down the NCS\nrf\samples\bluetooth\peripheral_uart, which is more or less the same example as ble_app_uart, except that it is written for NCS instead of the nRF5 SDK.

    So what you are looking for is ultimately using the peripheral_uart and central_uart samples (if you want to use NCS), but replace the UART with USB CDC. 

    I also see that there is a prj_cdc.conf file that seems to disable the UART and enable the peripheral USB. I guess this does pretty much what you want to do, so that you can use it with the nRF52840 dongle.

    To add this config file, please use the extra CMake argument: "-DEXTRA_CONF_FILE=prj_cdc.conf". Do not select it instead of prj.conf, as this will leave out prj.conf. 

    Best regards,

    Edvin

Related