Serial Communication between Nano and MKR type board

Hi, I would like to do hardware serial communication between the Nano 33 BLE and OpenRB-150 which is very similar to an MKR board. I'll show what I have - but it's not working:
Here's the connected pins from the nano to the OpenRB-150:

  • TX1 -> 13 Rx
  • RX0 -> 14 Tx
  • VIN -> 5v
  • GND -> GND

    I am trying to power the nano from the openRB-150, which works and I can run codes on the boards separately while the openRB-150 powers the nano. I want to use Serial2 for something else on the OpenRB-150 and want to use pins 13/14 to talk with the nano.

Here's the code on the nano:

//Transmitter

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);      // set LED pin as output
  digitalWrite(LED_BUILTIN, LOW);    // switch off LED pin

  Serial.begin(9600);              // initialize serial communication at 9600 bits per second:
  Serial1.begin(9600);            // initialize UART with the first board with baud rate of 9600

  Serial.println("Enter a number between 0-9 to turn on or off the LED on different boards");
}

void loop() {
  // check if there is any incoming byte to read from the Serial Monitor
  if (Serial.available() > 0){
    int inByte = Serial.read();

    switch (inByte){
      // Send to receiver 1
      case '1':
      Serial1.println('1');
      delay(100);
      Serial.print("Board 1: LED ON");
      break;

      case '2':
      Serial1.println('2');
      delay(100);
      Serial.print("Board 1: LED OFF");
      break;

      default:
      Serial.println(" ");
      break;
    }
  }
}

Here's the code on the OpenRB-150:

//Receiver

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);      // set LED pin as output
  digitalWrite(LED_BUILTIN, LOW);    // switch off LED pin

  Serial1.begin(9600);            // initialize UART with baud rate of 9600
}
void loop() {
  while (Serial1.available() >= 0) {
    char receivedData = Serial1.read();   // read one byte from serial buffer and save to receivedData
    if (receivedData == '1') {
      digitalWrite(LED_BUILTIN, HIGH); // switch LED On
    }
    else if (receivedData == '2') {
      digitalWrite(LED_BUILTIN, LOW);  // switch LED Off
    }
  }
}

You may have the Tx and Rx backwards on the Nano 33 BLE. See this pin out

Are you saying TX1 should go to 14 Tx or that I might have accidentally done that? Here's some more pictures of my wiring. I put the wires next to the pin reference on the OpenRB-150 to get them in the same picture:

Nano 33 BLE

OpenRB-150

Thanks for the clarification. Your wiring looks correct with Tx>Rx and Rx>Tx.

Are you using the OpenRB-150 core and OpenRB board manager package with your board?

https://github.com/ROBOTIS-GIT/OpenRB-150/tree/master

If so, take a look at the variant file
variants/OpenRB-150/variant.h

Unlike the Mkr1000, It would indicate that Serial1 is on 26 and 27 and Serial3 is on 13 and 14.

// Serial1
extern Uart Serial1;
// #define PIN_SERIAL3_RX (13ul)
// #define PIN_SERIAL3_TX (14ul)
// #define PAD_SERIAL3_TX (UART_TX_PAD_2)
// #define PAD_SERIAL3_RX (SERCOM_RX_PAD_3)
#define PIN_SERIAL1_TX (26ul)
#define PIN_SERIAL1_RX (27ul)
#define PAD_SERIAL1_TX (UART_TX_PAD_0)
#define PAD_SERIAL1_RX (SERCOM_RX_PAD_1)

// Serial2 4pin uart
extern Uart Serial2;
#define PIN_SERIAL2_TX (28ul)
#define PIN_SERIAL2_RX (29ul)
#define PAD_SERIAL2_TX (UART_TX_PAD_2)
#define PAD_SERIAL2_RX (SERCOM_RX_PAD_3)

// Serial3 exp uart
extern Uart Serial3;
#define PIN_SERIAL3_TX (14ul)
#define PIN_SERIAL3_RX (13ul)
#define PAD_SERIAL3_TX (UART_TX_PAD_2)
#define PAD_SERIAL3_RX (SERCOM_RX_PAD_3)
#endif // __cplusplus

If you are running this with the Mkr1000 core, then I would think that the 13 and 14 are correct for Serial1 and I don't understand the lack of communication.

EDIT: Are you using the OpenRB 150 as a shield on a Mkr 1010 like in this previous posting?
https://forum.arduino.cc/t/mkr-serial-communication/1114062

1 Like

You're an amazing wonderful fantastical person. That totally worked (Modifying the code for Serial3 on OpenRB-150). Didn't know Serial3 existed. Thank you!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.