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

Parents Reply Children
  • 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

  • Back after some training and doing lots of SEGGER stuff. Regarding the \examples\peripheral\usbd_ble_uart:
    There is a project for the dongle (PCA10059) missing. Could you advice me how to create / port the existing code to a PCA10059 project?

  • The main differences are the board layout and the flash. Have a look at one of the samples that does have a pca10059 project, and try to replicate that. When you are building an application that has uses the softdevice, it will be the same, but if you use a project that doesn't use the softdevice, remember to move the flash start address from 0x00000000 to 0x00001000, and program the MBR (found in SDK\components\softdevice\mbr). This is used by the bootloader. But the MBR is included in the softdevice, so if you are using that, then you don't need to worry about it.

    Then you really just need to include the pca10059 board file instead of the pca10056 one. This is usually done by changing the preprocessor definition from BOARD_PCA10056 to BOARD_PCA10059, and it will be included automatically.

    For an example that has a pca10059 project, you can check out the ble_app_hrs example.

    Best regards,

    Edvin

Related