Using the tArmDuino Serial Capability

A project log for Tiny Arduino for Hackers

A dime-sized, ARM-based Arduino complete with a programming/development system.

doctekdoctek 09/20/2023 at 00:490 Comments

Turns out that using the USART (serial) capability of the L071 is actually pretty easy. First, select "Enabled (no generic 'Serial')" from the Tools / U(S)ART support menu. Then, all that's required is to include HardwareSerial.h, instantiate a HardwareSerial object (call it mySerial, for example), and use it as you would use Serial in a Uno sketch. When you instantiate the HardwareSerial object, find the pin numbers to use in PeripheralPins.c and variant_SMALL_L071K.cpp. Specify the digital pin numbers, Rx first, then Tx. L071_serialLoopBack.ino is included as an example.

Using a serial to USB adapter (such as the ch340): connect the ch340 Rx pin to the tArmDuino Tx pin and you can transmit debug info. Obviously, connect ch340 Tx to tArmDuino Rx for serial input to tArmDuino.