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

Parents
  • 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.

  • Yes, the serial port Rx and Tx are on the i/o pins which must be physically connected to another serial port device, typically a serial-to-USB converter. The nRF Dongle doesn't need to be plugged in to a USB port at all, power can be from a coin cell or Li-Po battery (below 3.6 volts) giving a stand-alone BLE-to-Serial gateway which can be attached to (say) an ST dev board or other computer serial interface.

    If you have no activity on the serial pins, it is just possible that you have to erase MBR and Bootloader on the nRF Dongle before programming it for the first time; the nRF Dongles I use all work fine but I erased all flash memory before using them. They can be plugged into a USB port (for power, not communication) or not plugged in but instead operated from a battery, that doesn't matter.

    Remember if using a battery that you need 3 wires to the converter you mention; Rx, Tx and Gnd. Use the 3.3 volt setting, not the 5 volt setting. Some converters provide a 3 or 3.3 volt supply, which can replace the battery. In that case there are 4 wires, Rx, Tx, Gnd and Vcc (3.3 volts); the USB connector is not used at all in that case.

    However .. maybe we are not understanding your requirement, since if you can use a serial-to-USB device then you can just instead use the nRF Dongle as a BLE-to-USB-to-serial-to-Termite as described in earlier responses; there is a project which does just that, and it works with the nRF Dongle. It's a nuisance to debug, as the PC beeps every time you stop and start the program since the USB serial of course disconnects/reconnects each time.

  • Thank you for your excellent response. Indeed I just want to use the dongle to receive BLE packets and transmit them via the serial port on termite for example.

    So the solution described earlier should be enough. However, I haven't been able to get the example to work on the dongle yet. I have to find the wrong manipulation I'm doing and then move on with that.

    Thank you very much.

Reply
  • Thank you for your excellent response. Indeed I just want to use the dongle to receive BLE packets and transmit them via the serial port on termite for example.

    So the solution described earlier should be enough. However, I haven't been able to get the example to work on the dongle yet. I have to find the wrong manipulation I'm doing and then move on with that.

    Thank you very much.

Children
No Data
Related