diff --git a/Kconfig b/Kconfig index 61c43ecf..4fcf7746 100644 --- a/Kconfig +++ b/Kconfig @@ -13,6 +13,7 @@ config ARDUINO_API imply NEWLIB_LIBC_FLOAT_PRINTF imply CBPRINTF_FP_SUPPORT imply RING_BUFFER + select UART_INTERRUPT_DRIVEN default n if ARDUINO_API @@ -22,4 +23,8 @@ config QEMU_ICOUNT default n depends on QEMU_TARGET +config ARDUINO_API_SERIAL_BUFFER_SIZE + int "Buffer size for Arduino Serial API" + default 64 + endif diff --git a/cores/arduino/Arduino.h b/cores/arduino/Arduino.h index 383efea8..4ef58eaf 100644 --- a/cores/arduino/Arduino.h +++ b/cores/arduino/Arduino.h @@ -12,4 +12,5 @@ #include #include +#include #include diff --git a/cores/arduino/main.cpp b/cores/arduino/main.cpp index 34b77f5c..97afd420 100644 --- a/cores/arduino/main.cpp +++ b/cores/arduino/main.cpp @@ -11,7 +11,8 @@ int main(void) { for (;;) { loop(); + if (arduino::serialEventRun) arduino::serialEventRun(); } return 0; -} \ No newline at end of file +} diff --git a/cores/arduino/zephyrPrint.cpp b/cores/arduino/zephyrPrint.cpp index 979f5ce5..2e07c232 100644 --- a/cores/arduino/zephyrPrint.cpp +++ b/cores/arduino/zephyrPrint.cpp @@ -4,7 +4,89 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include + #include +#include + +namespace arduino +{ +namespace zephyr +{ + +int cbprintf_callback(int c, void *ctx) +{ + return reinterpret_cast(ctx)->write((unsigned char)c); +} + +size_t wrap_cbprintf(void *ctx, const char *format, ...) +{ + va_list ap; + int rc; + + va_start(ap, format); + rc = cbvprintf(reinterpret_cast(cbprintf_callback), ctx, format, ap); + va_end(ap); + + return static_cast(rc > 0 ? rc : 0); +} + +size_t print_number_base_any(void *ctx, unsigned long long ull, int base) +{ + arduino::Print &print = *reinterpret_cast(ctx); + char string[sizeof(unsigned long long) * 8] = {0}; + size_t digit = 0; + unsigned value; + + if (base < 2 || base > ('~' - 'A' + 10)) { + base = 10; + } + + while (ull != 0) { + value = ull % base; + if (value < 10) { + string[sizeof(string) - digit] = '0' + value; + } else { + string[sizeof(string) - digit] = 'A' + (value- 10); + } + + digit++; + ull /= base; + } + + return print.write(string + (sizeof(string) - digit), digit + 1); +} + +size_t print_number_base_pow2(void *ctx, unsigned long long ull, unsigned bits) +{ + arduino::Print &print = *reinterpret_cast(ctx); + const unsigned long long mask = (1 << bits) - 1; + int digit = (((sizeof(unsigned long long) * 8) + bits) / bits); + int output_count = -1; + unsigned value; + + while (digit >= 0) { + value = (ull & (mask << (digit * bits))) >> (digit * bits); + if (value != 0 && output_count < 0) { + output_count = 0; + } + + if (output_count >= 0) { + if (value < 10) { + print.write('0' + value); + } else { + print.write('A' + (value- 10)); + } + output_count++; + } + digit--; + } + + return output_count; +} + +} // namespace zephyr +} // namespace arduino /* * This is the default implementation. diff --git a/cores/arduino/zephyrPrint.h b/cores/arduino/zephyrPrint.h new file mode 100644 index 00000000..7b6131b6 --- /dev/null +++ b/cores/arduino/zephyrPrint.h @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2022 TOKITA Hiroshi + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#include + +#include +#include + +namespace arduino +{ +namespace zephyr +{ + +int cbprintf_callback(int c, void *ctx); +size_t wrap_cbprintf(void *ctx, const char *format, ...); +size_t print_number_base_any(void *ctx, unsigned long long ull, int base); +size_t print_number_base_pow2(void *ctx, unsigned long long ull, unsigned bits); + +template size_t print_number(void *ctx, Number n, const int base, const char *decfmt) +{ + if (base == 0) { + return reinterpret_cast(ctx)->write((char)n); + } else if (base == 2) { + return arduino::zephyr::print_number_base_pow2(ctx, n, 1); + } else if (base == 4) { + return arduino::zephyr::print_number_base_pow2(ctx, n, 2); + } else if (base == 8) { + return arduino::zephyr::print_number_base_pow2(ctx, n, 3); + } else if (base == 10) { + return arduino::zephyr::wrap_cbprintf(ctx, decfmt, n); + } else if (base == 16) { + return arduino::zephyr::print_number_base_pow2(ctx, n, 4); + } else if (base == 32) { + return arduino::zephyr::print_number_base_pow2(ctx, n, 5); + } else { + return arduino::zephyr::print_number_base_any(ctx, n, base); + } +} + +} // namespace zephyr + +} // namespace arduino + +inline size_t arduino::Print::print(const __FlashStringHelper *fsh) +{ + return write(reinterpret_cast(fsh)); +} + +inline size_t arduino::Print::print(const String &s) +{ + return write(s.c_str(), s.length()); +} + +inline size_t arduino::Print::print(const char str[]) +{ + return write(str); +} + +inline size_t arduino::Print::print(char c) +{ + return write(c); +} + +inline size_t arduino::Print::print(unsigned char n, int base) +{ + return arduino::zephyr::print_number(this, n, base, "%hhu"); +} + +inline size_t arduino::Print::print(int n, int base) +{ + return arduino::zephyr::print_number(this, n, base, "%d"); +} + +inline size_t arduino::Print::print(unsigned int n, int base) +{ + return arduino::zephyr::print_number(this, n, base, "%u"); +} + +inline size_t arduino::Print::print(long n, int base) +{ + return arduino::zephyr::print_number(this, n, base, "%ld"); +} + +inline size_t arduino::Print::print(unsigned long n, int base) +{ + return arduino::zephyr::print_number(this, n, base, "%lu"); +} + +inline size_t arduino::Print::print(long long n, int base) +{ + return arduino::zephyr::print_number(this, n, base, "%lld"); +} + +inline size_t arduino::Print::print(unsigned long long n, int base) +{ + return arduino::zephyr::print_number(this, n, base, "%llu"); +} + +inline size_t arduino::Print::print(double n, int perception) +{ + if (perception < 10) { + const char ch_perception = static_cast('0' + perception); + const char format[] = {'%', '.', ch_perception, 'f', '\0'}; + return arduino::zephyr::wrap_cbprintf(this, format, n); + } else { + const char ch_perception = static_cast('0' + (perception % 10)); + const char format[] = {'%', '.', '1', ch_perception, 'f', '\0'}; + return arduino::zephyr::wrap_cbprintf(this, format, n); + } +} + +inline size_t arduino::Print::print(const Printable &printable) +{ + return printable.printTo(*this); +} + +inline size_t arduino::Print::println(const __FlashStringHelper *fsh) +{ + return print(fsh) + println(); +} + +inline size_t arduino::Print::println(const String &s) +{ + return print(s) + println(); +} + +inline size_t arduino::Print::println(const char str[]) +{ + return print(str) + println(); +} + +inline size_t arduino::Print::println(char c) +{ + return print(c) + println(); +} + +inline size_t arduino::Print::println(unsigned char uc, int base) +{ + return print(uc, base) + println(); +} + +inline size_t arduino::Print::println(int i, int base) +{ + return print(i, base) + println(); +} + +inline size_t arduino::Print::println(unsigned int ui, int base) +{ + return print(ui, base) + println(); +} + +inline size_t arduino::Print::println(long l, int base) +{ + return print(l, base) + println(); +} + +inline size_t arduino::Print::println(unsigned long ul, int base) +{ + return print(ul, base) + println(); +} + +inline size_t arduino::Print::println(long long ll, int base) +{ + return print(ll, base) + println(); +} + +inline size_t arduino::Print::println(unsigned long long ull, int base) +{ + return print(ull, base) + println(); +} + +inline size_t arduino::Print::println(double d, int perception) +{ + return print(d, perception) + println(); +} + +inline size_t arduino::Print::println(const Printable &printable) +{ + return print(printable) + println(); +} + +inline size_t arduino::Print::println(void) +{ + return write("\r\n", 2); +} diff --git a/cores/arduino/zephyrSerial.cpp b/cores/arduino/zephyrSerial.cpp index febc9cc0..f9d79f1c 100644 --- a/cores/arduino/zephyrSerial.cpp +++ b/cores/arduino/zephyrSerial.cpp @@ -4,70 +4,205 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include +#include + +#include #include -size_t arduino::ZephyrSerial::begin(unsigned long int baudrate){ - return 0; -} +namespace +{ -size_t arduino::ZephyrSerial::print_char(char ch, bool lf){ - printk(lf ? "%c\n" : "%c", ch); - return lf ? 2 : 1; +enum uart_config_parity conf_parity(uint16_t conf) +{ + switch (conf & SERIAL_PARITY_MASK) { + case SERIAL_PARITY_EVEN: + return UART_CFG_PARITY_EVEN; + case SERIAL_PARITY_ODD: + return UART_CFG_PARITY_ODD; + default: + return UART_CFG_PARITY_NONE; + } } -size_t arduino::ZephyrSerial::print_str(const char* ptr, bool lf) { - printk(lf ? "%s\n" : "%s", ptr); - return lf ? strlen(ptr)+1 : strlen(ptr); +enum uart_config_stop_bits conf_stop_bits(uint16_t conf) +{ + switch (conf & SERIAL_STOP_BIT_MASK) { + case SERIAL_STOP_BIT_1_5: + return UART_CFG_STOP_BITS_1_5; + case SERIAL_STOP_BIT_2: + return UART_CFG_STOP_BITS_2; + default: + return UART_CFG_STOP_BITS_1; + } } -size_t arduino::ZephyrSerial::print(char ch){ - return print_char(ch, false); +enum uart_config_data_bits conf_data_bits(uint16_t conf) +{ + switch (conf & SERIAL_DATA_MASK) { + case SERIAL_DATA_5: + return UART_CFG_DATA_BITS_5; + case SERIAL_DATA_6: + return UART_CFG_DATA_BITS_6; + case SERIAL_DATA_7: + return UART_CFG_DATA_BITS_7; + default: + return UART_CFG_DATA_BITS_8; + } } -size_t arduino::ZephyrSerial::print(const int val) { - printk("%d",val); - return sizeof(int); +} // anonymous namespace + +void arduino::ZephyrSerial::begin(unsigned long baud, uint16_t conf) +{ + struct uart_config config = { + .baudrate = baud, + .parity = conf_parity(conf), + .stop_bits = conf_stop_bits(conf), + .data_bits = conf_data_bits(conf), + .flow_ctrl = UART_CFG_FLOW_CTRL_NONE, + }; + + uart_configure(uart, &config); + uart_irq_callback_user_data_set(uart, arduino::ZephyrSerial::IrqDispatch, this); + uart_irq_rx_enable(uart); } -size_t arduino::ZephyrSerial::print(double d) { - printk("%.2f",d); - return sizeof(double); +void arduino::ZephyrSerial::IrqHandler() +{ + uint8_t buf[8]; + int length; + int ret = 0; + + if (!uart_irq_update(uart)) { + return; + } + + if (ring_buf_size_get(&tx.ringbuf) == 0) { + uart_irq_tx_disable(uart); + } + + k_sem_take(&rx.sem, K_NO_WAIT); + while (uart_irq_rx_ready(uart) && ((length = uart_fifo_read(uart, buf, sizeof(buf))) > 0)) { + length = min(sizeof(buf), static_cast(length)); + ret = ring_buf_put(&rx.ringbuf, &buf[0], length); + + if (ret < 0) { + break; + } + } + k_sem_give(&rx.sem); + + k_sem_take(&tx.sem, K_NO_WAIT); + while (uart_irq_tx_ready(uart) && ((length = ring_buf_size_get(&tx.ringbuf)) > 0)) { + length = min(sizeof(buf), static_cast(length)); + ring_buf_peek(&tx.ringbuf, &buf[0], length); + + ret = uart_fifo_fill(uart, &buf[0], length); + if (ret < 0) { + break; + } else { + ring_buf_get(&tx.ringbuf, &buf[0], ret); + } + } + k_sem_give(&tx.sem); } -size_t arduino::ZephyrSerial::print(const int val, const int base) { - if (base == 2) { /* Todo: print Binary */ - printk("%d", val); - } else if (base == 16) { /* print Hex value */ - printk("%x",val); - } else if (base == 8) { /* Todo: print octal value */ - printk("%d", val); - } else if (base == 10) { /* print decimal value */ - printk("%d", val); - } else { - return EINVAL; - } - - return 1; /* temporarily return 1 byte, but change this to - * return strlen(buffer); - * when we implement octal and binary - */ +void arduino::ZephyrSerial::IrqDispatch(const struct device *dev, void *data) +{ + reinterpret_cast(data)->IrqHandler(); } -size_t arduino::ZephyrSerial::println(char ch){ - return print_char(ch, true); +int arduino::ZephyrSerial::available() +{ + int ret; + + k_sem_take(&rx.sem, K_FOREVER); + ret = ring_buf_size_get(&rx.ringbuf); + k_sem_give(&rx.sem); + + return ret; } -size_t arduino::ZephyrSerial::print(const char* ptr) { - return print_str(ptr, false); +int arduino::ZephyrSerial::peek() +{ + uint8_t data; + + k_sem_take(&rx.sem, K_FOREVER); + ring_buf_peek(&rx.ringbuf, &data, 1); + k_sem_give(&rx.sem); + + return data; } -size_t arduino::ZephyrSerial::println(const char* ptr){ - return print_str(ptr, true); +int arduino::ZephyrSerial::read() +{ + uint8_t data; + + k_sem_take(&rx.sem, K_FOREVER); + ring_buf_get(&rx.ringbuf, &data, 1); + k_sem_give(&rx.sem); + + return data; } -size_t arduino::ZephyrSerial::println(void){ - printk("\n"); - return 0; +size_t arduino::ZephyrSerial::write(const uint8_t *buffer, size_t size) +{ + int ret; + + k_sem_take(&tx.sem, K_FOREVER); + ret = ring_buf_put(&tx.ringbuf, buffer, size); + k_sem_give(&tx.sem); + + if (ret < 0) { + return 0; + } + + uart_irq_tx_enable(uart); + + return ret; } -arduino::ZephyrSerial Serial; +#if DT_NODE_HAS_PROP(DT_PATH(zephyr_user), serials) +arduino::ZephyrSerial Serial(DEVICE_DT_GET(DT_PHANDLE_BY_IDX(DT_PATH(zephyr_user), serials, 0))); +#if (DT_PROP_LEN(DT_PATH(zephyr_user), serials) > 1) +#define ARDUINO_SERIAL_DEFINED_0 1 + +#define DECL_SERIAL_0(n, p, i) +#define DECL_SERIAL_N(n, p, i) \ + arduino::ZephyrSerial Serial##i(DEVICE_DT_GET(DT_PHANDLE_BY_IDX(n, p, i))); +#define DECLARE_SERIAL_N(n, p, i) \ + COND_CODE_1(ARDUINO_SERIAL_DEFINED_##i, (DECL_SERIAL_0(n, p, i)), (DECL_SERIAL_N(n, p, i))) + +#define CALL_EVENT_0(n, p, i) +#define CALL_EVENT_N(n, p, i) if (_CONCAT(Serial, i).available()) _CONCAT(_CONCAT(serial, i), Event)(); +#define CALL_SERIALEVENT_N(n, p, i) \ + COND_CODE_1(ARDUINO_SERIAL_DEFINED_##i, (CALL_EVENT_0(n, p, i)), (CALL_EVENT_N(n, p, i))); + +#define DECL_EVENT_0(n, p, i) +#define DECL_EVENT_N(n, p, i) __attribute__((weak)) void serial##i##Event() { } +#define DECLARE_SERIALEVENT_N(n, p, i) \ + COND_CODE_1(ARDUINO_SERIAL_DEFINED_##i, (DECL_EVENT_0(n, p, i)), (DECL_EVENT_N(n, p, i))); + +DT_FOREACH_PROP_ELEM(DT_PATH(zephyr_user), serials, DECLARE_SERIAL_N) +#endif // PROP_LEN(serials) > 1 +#elif DT_NODE_EXISTS(DT_NODELABEL(arduino_serial)) +/* If serials node is not defined, tries to use arduino_serial */ +arduino::ZephyrSerial Serial(DEVICE_DT_GET(DT_NODELABEL(arduino_serial))); +#else +arduino::ZephyrSerialStub Serial; +#endif + + +__attribute__((weak)) void serialEvent() { } +#if (DT_PROP_LEN(DT_PATH(zephyr_user), serials) > 1) +DT_FOREACH_PROP_ELEM(DT_PATH(zephyr_user), serials, DECLARE_SERIALEVENT_N) +#endif + +void arduino::serialEventRun(void) +{ + if (Serial.available()) serialEvent(); +#if (DT_PROP_LEN(DT_PATH(zephyr_user), serials) > 1) + DT_FOREACH_PROP_ELEM(DT_PATH(zephyr_user), serials, CALL_SERIALEVENT_N) +#endif +} diff --git a/cores/arduino/zephyrSerial.h b/cores/arduino/zephyrSerial.h index d57a0b97..72703504 100644 --- a/cores/arduino/zephyrSerial.h +++ b/cores/arduino/zephyrSerial.h @@ -6,32 +6,94 @@ #pragma once +#include + #include +#include namespace arduino { -class ZephyrSerial { - char pvt_c; +class ZephyrSerialStub : public HardwareSerial +{ +public: + void begin(unsigned long baudRate) { } + void begin(unsigned long baudrate, uint16_t config) { } + void end() { } + int available() { return 0; } + int peek() { return 0; } + int read() { return 0; } + void flush() { } + size_t write(const uint8_t data) + { + printk("%c", static_cast(data)); + return 1; + } -private: - size_t print_char(const char c, bool lf); - size_t print_str(const char * ptr, bool lf); + operator bool() { return true; } +}; +class ZephyrSerial : public HardwareSerial +{ public: - size_t begin(unsigned long int baudrate); //TODO + template + class ZephyrSerialBuffer + { + friend arduino::ZephyrSerial; + struct ring_buf ringbuf; + uint8_t buffer[SZ]; + struct k_sem sem; + + ZephyrSerialBuffer() + { + k_sem_init(&sem, 1, 1); + ring_buf_init(&ringbuf, sizeof(buffer), buffer); + } + }; + + ZephyrSerial(const struct device *dev) : uart(dev) { } + void begin(unsigned long baudrate, uint16_t config); + void begin(unsigned long baudrate) { begin(baudrate, SERIAL_8N1); } + void flush() { } + void end() { } + size_t write(const uint8_t *buffer, size_t size); + size_t write(const uint8_t data) { return write(&data, 1); } + int available(); + int peek(); + int read(); - size_t print(const char c); - size_t print(const int val); - size_t print(double d); - size_t print(const char * ptr); - size_t print(const int val, const int base); + operator bool() + { + return true; + } - size_t println(const char c); - size_t println(const char* ptr); - size_t println(void); +protected: + void IrqHandler(); + static void IrqDispatch(const struct device *dev, void *data); + const struct device *uart; + ZephyrSerialBuffer tx; + ZephyrSerialBuffer rx; }; + } // namespace arduino +#if DT_NODE_HAS_PROP(DT_PATH(zephyr_user), serials) +extern arduino::ZephyrSerial Serial; +#if (DT_PROP_LEN(DT_PATH(zephyr_user), serials) > 1) +#define SERIAL_DEFINED_0 1 +#define EXTERN_SERIAL_N(i) extern arduino::ZephyrSerial Serial##i; +#define DECLARE_EXTERN_SERIAL_N(n, p, i) COND_CODE_1(SERIAL_DEFINED_##i, (), (EXTERN_SERIAL_N(i))) + +/* Declare Serial1, Serial2, ... */ +DT_FOREACH_PROP_ELEM(DT_PATH(zephyr_user), serials, DECLARE_EXTERN_SERIAL_N) + +#undef DECLARE_EXTERN_SERIAL_N +#undef EXTERN_SERIAL_N +#undef SERIAL_DEFINED_0 +#endif +#elif DT_NODE_EXISTS(DT_NODELABEL(arduino_serial)) extern arduino::ZephyrSerial Serial; +#else +extern arduino::ZephyrSerialStub Serial; +#endif diff --git a/documentation/variants.md b/documentation/variants.md index 4b8ea518..743ef6f9 100644 --- a/documentation/variants.md +++ b/documentation/variants.md @@ -83,6 +83,31 @@ uses [the Arduino header definitions](https://github.com/zephyrproject-rtos/zeph }; ``` +### Configure Serial devices + +The `serials` node defines the Serial devices to use. +It instantiate the `Serial` with the UART device that contained in the node. +Also instantiate as `Serial1`, `Serial2`, .. `SerialN` with the devices that is +after the second in the case of the array contains plural devices. + +If the `serials` node is not defined, Use the node labeled `arduino-serial`. +Boards with Arduino-shield style connectors usually label `arduino-serial` for +UART port exposed in header or frequently used UART port. + +If even 'arduino_serial' does not define, it uses the stub implementation +that redirects to printk(). + +The following example instantiates `Serial` and `Serial1` with each `uart0` and `uart1`. + +``` +/ { + zephyr,user { + serials = <&uart0, &uart1>; + }; +}; +``` + + ### Overlays from scratch You can see in the example above that there is no mapping for `LED0` in the diff --git a/samples/serial_event/CMakeLists.txt b/samples/serial_event/CMakeLists.txt new file mode 100644 index 00000000..4053955b --- /dev/null +++ b/samples/serial_event/CMakeLists.txt @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) + +set(DTC_OVERLAY_FILE $ENV{ZEPHYR_BASE}/../modules/lib/Arduino-Zephyr-API/variants/${BOARD}/${BOARD}.overlay) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(serial_event) + +target_sources(app PRIVATE src/app.cpp) + +zephyr_compile_options(-Wno-unused-variable -Wno-comment) diff --git a/samples/serial_event/README.rst b/samples/serial_event/README.rst new file mode 100644 index 00000000..e4dde008 --- /dev/null +++ b/samples/serial_event/README.rst @@ -0,0 +1,20 @@ +.. _serial_event: + +Serial Event +############ + +Overview +******** + +The serial_event sample echo back serial input data. + +Building and Running +******************** + +Build and flash serial_event sample as follows, + +```sh +$> west build -p -b arduino_nano_33_ble sample/serial_event/ + +$> west flash --bossac=/home/$USER/.arduino15/packages/arduino/tools/bossac/1.9.1-arduino2/bossac +``` diff --git a/samples/serial_event/prj.conf b/samples/serial_event/prj.conf new file mode 100644 index 00000000..f93fa321 --- /dev/null +++ b/samples/serial_event/prj.conf @@ -0,0 +1 @@ +CONFIG_ARDUINO_API=y diff --git a/samples/serial_event/src/app.cpp b/samples/serial_event/src/app.cpp new file mode 100644 index 00000000..602d378a --- /dev/null +++ b/samples/serial_event/src/app.cpp @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 TOKITA Hiroshi + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +void setup() { + Serial.begin(115200); +} + +void loop() { +} + +void serialEvent() { + while(Serial.available()) { + Serial.print((char)Serial.read()); + } +} diff --git a/variants/arduino_mkrzero/arduino_mkrzero.overlay b/variants/arduino_mkrzero/arduino_mkrzero.overlay index 6550fd84..4e34d6b2 100644 --- a/variants/arduino_mkrzero/arduino_mkrzero.overlay +++ b/variants/arduino_mkrzero/arduino_mkrzero.overlay @@ -43,6 +43,8 @@ <&adc 6>, <&adc 7>; io-channel-pins = <15 16 17 18 19 20 21>; + + serials = <&sercom5>; }; }; diff --git a/variants/arduino_nano_33_ble/arduino_nano_33_ble.overlay b/variants/arduino_nano_33_ble/arduino_nano_33_ble.overlay index f26995d5..6c259771 100644 --- a/variants/arduino_nano_33_ble/arduino_nano_33_ble.overlay +++ b/variants/arduino_nano_33_ble/arduino_nano_33_ble.overlay @@ -41,6 +41,8 @@ <&adc 4>, <&adc 1>; io-channel-pins = <14 15 16 17 18 19 20 21>; + + serials = <&uart0>; }; }; diff --git a/variants/arduino_nano_33_ble_sense/arduino_nano_33_ble_sense.overlay b/variants/arduino_nano_33_ble_sense/arduino_nano_33_ble_sense.overlay index f26995d5..6c259771 100644 --- a/variants/arduino_nano_33_ble_sense/arduino_nano_33_ble_sense.overlay +++ b/variants/arduino_nano_33_ble_sense/arduino_nano_33_ble_sense.overlay @@ -41,6 +41,8 @@ <&adc 4>, <&adc 1>; io-channel-pins = <14 15 16 17 18 19 20 21>; + + serials = <&uart0>; }; }; diff --git a/variants/arduino_nano_33_iot/arduino_nano_33_iot.overlay b/variants/arduino_nano_33_iot/arduino_nano_33_iot.overlay index d64c3f98..69af343c 100644 --- a/variants/arduino_nano_33_iot/arduino_nano_33_iot.overlay +++ b/variants/arduino_nano_33_iot/arduino_nano_33_iot.overlay @@ -43,6 +43,8 @@ <&adc 6>, <&adc 7>; io-channel-pins = <14 15 16 17 18 19 20 21>; + + serials = <&sercom5>; }; };