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

Serial port on the nRF52840 Dongle

Hi I am trying to init the serial on the nRF52840 Dongle but there are some defines missing in the boards/pca10069.h

I run this on the nRF52840 DK and it works fine.

NRF_SERIAL_DRV_UART_CONFIG_DEF(m_uart0_drv_config,
    RX_PIN_NUMBER, TX_PIN_NUMBER,
    RTS_PIN_NUMBER, CTS_PIN_NUMBER,
    NRF_UART_HWFC_ENABLED, NRF_UART_PARITY_EXCLUDED,
    NRF_UART_BAUDRATE_115200,
    UART_DEFAULT_CONFIG_IRQ_PRIORITY);

file: boards/pca10056.h

#define RX_PIN_NUMBER  8
#define TX_PIN_NUMBER  6
#define CTS_PIN_NUMBER 7
#define RTS_PIN_NUMBER 5
#define HWFC           true

Parents Reply Children
  • Is there a way to get the sample to run as a pure Serial device e.g not using any AT commands. I tried to change the APP_USBD_CDC_COMM_PROTOCOL_AT_V250 to APP_USBD_CDC_COMM_PROTOCOL_NONE but still there is no data sent when I trie to send it using the Linux 

    _fd = open(_port.c_str(), O_RDWR | O_NOCTTY | O_SYNC);
        if (_fd < 0)
        {
            fprintf(stderr, "Error Failed to open post '%s' : %s\n", _port.c_str(), strerror(errno));
            return false;
        }
        
          struct termios tty;
        memset(&tty, 0, sizeof tty);
        if (tcgetattr(_fd, &tty) != 0)
        {
            fprintf(stderr, "Error failed to get attributs from serial %s\n", strerror(errno));
            return false;
        }
        fprintf(stdout, "Setting speed %d\n", speed);
        cfsetospeed(&tty, speed);
        cfsetispeed(&tty, speed);
    
        tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS8; // 8-bit chars
        // disable IGNBRK for mismatched speed tests; otherwise receive break as \000 chars
        tty.c_iflag &= ~IGNBRK; // disable break processing
        tty.c_lflag = 0;        // no signaling chars, no echo,
                                // no canonical processing
        tty.c_oflag = 0;        // no remapping, no delays
        tty.c_cc[VMIN] = 0;     // read doesn't block
        tty.c_cc[VTIME] = 5;    // 0.5 seconds read timeout
    
        tty.c_iflag &= ~(IXON | IXOFF | IXANY); // shut off xon/xoff ctrl
    
        tty.c_cflag |= (CLOCAL | CREAD);   // ignore modem controls,
                                           // enable reading
        tty.c_cflag &= ~(PARENB | PARODD); // shut off parity
        tty.c_cflag |= parity;
        tty.c_cflag &= ~CSTOPB;
        tty.c_cflag &= ~CRTSCTS;
    
        if (tcsetattr(_fd, TCSANOW, &tty) != 0)
        {
            fprintf(stderr, "Error setting attributes on serail %s\n", strerror(errno));
            return false;
        }
        return true;
        
        
        write(_fd, "baja maja", strlen("baja maja"));

  • run as a pure Serial device

    Not quite sure what you mean by that?

    Do you just want to send/receive stuff from/to the microcontroller locally via its UART pins?

    Or are you talking about transferring stuff over BLE?

    For the latter, see the Nordic UART Service (NUS) example ... 

  • I am looking to send data from my PC to the DK or the Dongle using serial or any other mean of simple communication.

  • You should be able to use the example as a standard serial device with terminal software, for instance putty. Please have a look at the Terminal settings documentation to see the recommended settings.

Related