nRF52840 mini UART pins?

Hey!

I’m trying to get my nRF52840 to send it’s information with UART but I don’t know what pins the RX0, RX1 and Tx0, Tx1 is.

  • What is the UART pin by default?

  • Is it called Serial1?

  • Can I change the UART to be on another pin?
  • The documentation for this is very difficult and doesn’t exactly have a good datasheet. Thanks in advance!

    To clear it up, I am programming in Arduino with the Adafruit library.

    I had some trouble at first with this topic and then dug in to the docs, here is what I found and use. When you add the boards file for the “SparkFun nRF52840 Mini Breakout” as shown in the guide, access to those pins and others are mapped. I tried software serial at first, however I couldn’t get the speed above 9600 and was still unreliable. The hardware serial port is very stable.

    Search “Adding Boards File”

    https://learn.sparkfun.com/tutorials/nr … e-nrf5-sdk

    Pin 15 = RX

    Pin 17 = TX

    Use Serial1 to access.

    Search “I/O Features” on the following link:

    https://learn.sparkfun.com/tutorials/sp … -guide/all

    robwag:
    I had some trouble at first with this topic and then dug in to the docs, here is what I found and use. When you add the boards file for the “SparkFun nRF52840 Mini Breakout” as shown in the guide, access to those pins and others are mapped. I tried software serial at first, however I couldn’t get the speed above 9600 and was still unreliable. The hardware serial port is very stable.

    Search “Adding Boards File”

    https://learn.sparkfun.com/tutorials/nr … e-nrf5-sdk

    Pin 15 = RX

    Pin 17 = TX

    Use Serial1 to access.

    Search “I/O Features” on the following link:

    https://learn.sparkfun.com/tutorials/sp … -guide/all

    This is all great news, thank you so much. I did add the board with the Arduino-method and not the nr52-SDK-method, do you think this matters?

    Hello Marius1992, were you able to use the UART pins from the board successfully ?

    I am trying to send a byte from nrf852840 to an Arduino Uno. I can see x (120 in ASCII) printed on serial monitor(for nrf52840), but can’t see anything received on the serial monitor of Arduino Uno apart from the “Hello” that I am printing on to the Serial monitor from Uno itself.

    Is there something wrong with my connections ? Do I have to do some declarations on using certain pins for UART ?

    Connections,

    GND common.

    TX(Arduino) - Pin 15, nrf52840 (Used a voltage divider in between 5V to 3.3V conversion with 1k and 2k resistors).

    RX(Arduino) - Pin 17, nrf52840.

    Code uploaded on nrf52840

    byte b = 120; //String data
    
    void setup() {
      // Begin the Serial at 9600 Baud
      Serial.begin(9600);
    }
    
    void loop() {
      Serial.write(b); //Write the serial data
      delay(1000);
    }
    

    Code on Arduino Uno

    byte incomingByte = 0;   // for incoming serial data
    
    void setup() {
            Serial.begin(9600);     // opens serial port, sets data rate to 9600 bps
    }
    
    void loop() {
    
            // send data only when you receive data:
            if (Serial.available() > 0) {
                    // read the incoming byte:
                    incomingByte = Serial.read();
    
                    // say what you got:
                    Serial.print("I received: ");
                    Serial.println(incomingByte);
            }
            Serial.println("Hello");
            delay(1000);
    }
    

    The Uno only has one hardware serial port, and that is tied to the USB to Serial chip. If you have a usb-to-serial cable or board handy, I would try using that first connected to the nRF module to cut the problem in half. If not, you will need to use software serial on the Uno to connect to the nRF, and leave the hardware serial for the connection to the PC.

    I used a USB-serial converter, attached my transmit pin(17, on nrf52840) to the receive of the USB to ttl converter, grounds were common, I monitored the serial port using Teraterm. Still couldn’t get “x” that I am sending in the code mentioned in my last post.

    For all the noobies out there like me!

    Software Serial is the solution! Look at the code below. Checkout the second line of code which does the pin definition. The below code worked and I was able to receive the char “v” in TeraTerm.

    #include <SoftwareSerial.h>
    
    SoftwareSerial mySerial(15, 17); // RX, TX
    
    void setup() {
        // set the data rate for the SoftwareSerial port
      mySerial.begin(9600);
      Serial.begin(9600);
    }
    
    void loop() { // run over and over
      
        mySerial.write("v");
        
      delay(1000);
    }
    

    s0rw131313:
    Hello Marius1992, were you able to use the UART pins from the board successfully ?

    Sorry for the late reply, and yes! I am using a teensy as my microcontroller so I already have plenty of hardware serials. Glad you solved your problem!