Serial not working if Using Arduino Shields requiring Serial on pins 0/1

Been testing some old shields with the Arduino Q - EasyVr shield and a XBee shield.

Going to talk about the XBee shield. Using a simple pass through sketch:

#include <Arduino_RouterBridge.h>

#define XBee Serial
#define pcSerial Monitor

void setup()
{
  XBee.begin(57600);
  pcSerial.begin(57600);

}

void loop()
{
  if (pcSerial.available())

  { 
    XBee.write(pcSerial.read());

   }

  if (XBee.available())
  { 
   pcSerial.write(XBee.read());
   }

}

Then using the XCTU app on the PC and doing a search, the app fails to find the attached Xbee on the shield.

However, if I try it on the Giga using

//#include <Arduino_RouterBridge.h>

#define XBee Serial1
#define pcSerial Serial

The Giga has no problem finding the XBee using the XCTU app.

This can be an issue with any shields that use Serial which I have a couple of which are now useless.

Hi @Merlin513,

at the moment pin TX/RX are in use by the Zephyr console. In order to use them as traditional TX/RX pins you need to disable the console feature in the Zephyr core / bootloader.

After commenting out these lines https://github.com/arduino/zephyr/blob/f7a59afe5c3558a290915337dea5cedf61d97426/boards/arduino/uno_q/arduino_uno_q_defconfig#L9, you need to recompile the core and the bootloader by following the instructions at the following links:

After that, you must flash the new bootloader using the arduino-cli with the burn-bootloader command.

Let me know if you can get it working with these instructions.

Cheers

@manchuino

Thanks - didn’t think about that. And yeah already know how to recompile the core - been doing that a long time with zephyr boards :slight_smile:

For a quick test can I just do this from IDE 2.3.7 if I am not using app lab.

Other question - most users are not going to go through the effort of the effort of doing this is there any plan for doing changing pins 0/1 from Serial to Serial and the just use Monitor to print?

Also once I change this where will debug messages from zephyr show up - still on Serial?

Thanks

Mike

And Merry Christmas.

Just commented out the Console config options in zephyr and recompiled and burned bootloader through the IDE and still didn’t work.

Also did a double check on the GIGA config - just as a note the giga has as well and has

#Console

CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y

@Merlin513

double-check you are using burn-bootloader or the IDE with the correct core selected: it must be the one from GitHub with your changes. Also, try to comment out the SERIAL conf a few lines above.

Cheers.

Yep I am using the core from the last release that I downloaded from github.

I ran a simple test sketch

#include <Arduino_RouterBridge.h>

void setup() {
Serial.begin(57600);
Monitor.begin(57600);
}

void loop() {
Serial.println("Hello Serial");
Monitor.println("Hello Monitor");
delay(1000);

}

Just to check where things get printed to.

With the following config:

#enable uart driver
CONFIG_SERIAL=y

#enable GPIO
CONFIG_GPIO=y

#console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y

“Hello Monitor” is printed to Serial (pins 0/1) and Hello Monitor is printed to IDE Serial Monitor

If I just comment out the config console, still seeing prints to both Serial and Monitor. If I run the pass through sketch, it does not find the device. Note I am seeing AT commands getting sent over Serial: APe+++ATAP, for instance.

With serial and console commented out seeing the same things. still not recognizing the xbee on Serial

Hooking up a LA to pins 0/1 I see the atp command but nothing is being acknowledged

On the giga I see the atp command and the response

Actually just remembered even if change the board config it is still in the prj.conf file for all

#zephyr boards
#SPDX-License-Identifier: Apache-2.0
#This file contains selected Kconfig options for the application.

CONFIG_USERSPACE=n
CONFIG_ARM_MPU=n

CONFIG_LOG=y
CONFIG_LOG_MODE_IMMEDIATE=y

CONFIG_HEAP_MEM_POOL_SIZE=32768
CONFIG_MAIN_STACK_SIZE=32768

CONFIG_ARDUINO_API=y

CONFIG_SHELL=y
CONFIG_SHELL_STACK_SIZE=2048
CONFIG_SHELL_CMD_BUFF_SIZE=2048
CONFIG_SHELL_LOG_LEVEL_DBG=n

CONFIG_LLEXT=y
CONFIG_LLEXT_LOG_LEVEL_ERR=y
CONFIG_LLEXT_HEAP_SIZE=32
CONFIG_LLEXT_SHELL=y
CONFIG_LLEXT_STORAGE_WRITABLE=y
CONFIG_LLEXT_EXPORT_DEVICES=y

CONFIG_LLEXT_EDK=y
CONFIG_LLEXT_EDK_FORMAT_TAR_ZSTD=y

CONFIG_GPIO=y
CONFIG_PINCTRL=y
CONFIG_I2C=y
CONFIG_SPI=y

CONFIG_SERIAL=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y

CONFIG_FLASH=y
CONFIG_FLASH_MAP=y

CONFIG_CPP=y
CONFIG_STD_CPP17=y
CONFIG_GLIBCXX_LIBCPP=y
CONFIG_REQUIRES_FULL_LIBC=y
CONFIG_CBPRINTF_FP_SUPPORT=y

CONFIG_MAIN_THREAD_PRIORITY=14
CONFIG_INPUT_THREAD_PRIORITY_OVERRIDE=y
CONFIG_INPUT_THREAD_PRIORITY=0

CONFIG_EVENTS=y

and I really dont want to change it in the prj.conf file since it is affecting all boards.

Note Commented out Console configs in both places but XBeeis still not responding.

UPDATE Tried commenting out Serial and console configs but still no luck.

Ok for any one interested did manage to get the q to work with an xbee however it is not working with the XBee shield. It does seem to work with this type of adapter hooked up directly to the 3.3v pin:
Amazon.com: Waveshare UART Communication Board Supports XBee Connectivity : Electronics