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

Using the nRF52840 dongle to receive and display data via the serial port (terminal)

Hello,

I am developing the following application:

An nRF52840 bluetooth module connected to a sensor does data acquisition and then sends it directly to an nRF52840 dongle which transmits the data to the serial port.

I thought for this I would use the example "ble_app_uart_c" to receive the data and transmit it on the serial port.

This is very easy to do with an nRF52840 DK, but I can't do it with the dongle because it seems that the serial port is not available with the dongle.

What do I need to do in order for this to work properly using the dongle?

Thank you in advance and best regards,


Maxime

  • Hi Maxime,

    you can use USB CDC ACM - a virtual USB COM port, there is an example in SDK. Please also read this thread.

  • There is also a USBD BLE UART Example if you want to use NUS to transfer the sensor data over BLE. This example implements NUS peripheral role, but you can implement NUS Central on the other end, it is possible to send data both ways.

  • In case you actually want the hardware serial port and can't use USB as suggested by the team, here are the salient points in ./boards/pca10059.h you require for using the hardware serial port, LEDs and push-button:

    // Serial Port definitions for PCA10059
    #define RX_PIN_NUMBER   9 // 13
    #define TX_PIN_NUMBER  10 // 15
    #define CTS_PIN_NUMBER UART_PIN_DISCONNECTED //NRF_UART_PSEL_DISCONNECTED // 17
    #define RTS_PIN_NUMBER UART_PIN_DISCONNECTED //NRF_UART_PSEL_DISCONNECTED // 20
    #define HWFC           false
    
    // LED definitions for PCA10059
    // Each LED color is considered a separate LED
    #define LEDS_NUMBER    4
    #define LED1_G         NRF_GPIO_PIN_MAP(0,6)
    #define LED2_R         NRF_GPIO_PIN_MAP(0,8)
    #define LED2_G         NRF_GPIO_PIN_MAP(1,9)
    #define LED2_B         NRF_GPIO_PIN_MAP(0,12)
    #define LED_1          LED1_G
    #define LED_2          LED2_R
    #define LED_3          LED2_G
    #define LED_4          LED2_B
    #define LEDS_ACTIVE_STATE 0
    #define LEDS_LIST { LED_1, LED_2, LED_3, LED_4 }
    #define LEDS_INV_MASK  LEDS_MASK
    #define BSP_LED_0      LED_1
    #define BSP_LED_1      LED_2
    #define BSP_LED_2      LED_3
    #define BSP_LED_3      LED_4
    
    // There is only one button for the application as the second button is used for a RESET.
    #define BUTTONS_NUMBER 1
    #define BUTTON_1       NRF_GPIO_PIN_MAP(1,6)
    #define BUTTON_PULL    NRF_GPIO_PIN_PULLUP
    #define BUTTONS_ACTIVE_STATE 0
    #define BUTTONS_LIST { BUTTON_1 }
    #define BSP_BUTTON_0   BUTTON_1
    #define BSP_SELF_PINRESET_PIN NRF_GPIO_PIN_MAP(0,19)

    These work with the ble_app_uart.c pplication with or without the USB serial port code. You might be using different hardware pins for Rx and Tx, simple to change those; just be sure sdk_config.h doesn't conflict with pin settings but SES should highlight any conflicts.

  • Hi,

    That is indeed what I would like to do. I tried your solution:

    - I added the #defines for the serial port in the file PCA10059.h.
    - Of course I changed the preprocessor definition with BOARD_PCA0059.

    => There is no conflict during compilation
    => Once I run the application on the nRF52840 dongle, I have no access to the serial port of the dongle at all. So it's impossible to have a serial communication afterwards ...!

    Is there a step I'm missing? Is this solution working for you?

    Thank you in advance.

  • Hello,

    I've tried the example. However I can't receive/send data via the serial port.

    I can connect/disconnect to the dongle with another Bluetooth device. When I send data to the dongle, it seems that the data is received (The LD2 led flashes differently every time I send data).

    But nothing is visible in my serial port... (I use the "Termite" terminal, which works very well with a nrf52840 DK and the examples ble_app_uart and ble_app_art_c)

Related