Skip to content

13. Networking and Communications

Serial and serial bus

During the Electronics production week, we tested UART communication between our boards with Maxime, through UART and also using the Micropython board.

UART Connection between our boards

With that and very simple code, we can communicate via our boards with each other.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
void setup() {
   SerialUSB.begin(0);
   Serial2.begin(115200, SERIAL_8E2);
}

void loop() {
   if (SerialUSB.available()) {
      Serial2.write((char) SerialUSB.read());
   }
   if (Serial2.available()) {
      SerialUSB.write((char) Serial2.read());
   }
}

Doing that we had already tested communication without adresses.

We can make a serial bus by sending initial characters working as an address and filtering messages based on these initial characters.

I2C bus

However, we connected different projects with an I2C bus including an AtTiny board (tested below another setup) and the board for my final project.

I2C bus connection

I also monitored the bus with a digital analyzer and while receiving messages from the SAMD21 board for my final project over the serial monitor.

The message makes the LED blink at different speeds and different number of times depending on the number sent. We can check this number by looking at the serial monitor as the samd21 board is asking the Attiny peripheral to send it or by checking the value sent on the bus looking at the digital analyser.

Files


Last update: June 17, 2021 09:47:29