Serial1 doesn't work after arduboy.begin() [Solved]

(rainnw) #1

I am having a very strange issue with the Arduboy. I have one of the units from the original Kickstarter.

I soldered up a serial device to the GND, RX and TX pads. If i don’t arduboy.begin(), I can write a sketch that relays between Serial1 (hardware) and Serial (USB) without any issue.

However, the second I add just a simple begin, Serial1 stops working.

I looked over the schematic, and D0 and D1 aren’t connected to anything, so I am at a loss as to what is actually going on.

Here is my code:

#include "Arduboy.h"

Arduboy arduboy;
uint8_t a = 0;

void setup() {
 Serial.begin(115200);
 Serial1.begin(115200);
 arduboy.begin();                 // commenting out makes this simple serial relay work
}

void loop() {
 if(Serial1.available()) {
     a = Serial1.read();
     Serial.print((char)a);
 }
}
0 Likes

(rainnw) #2

Solution:

For those looking to connect serial peripherals to Arduboy, such as a radio in my case, you will need this function after begining Arduboy. For example:

arduboy.begin();
power_usart1_enable();
Serial1.begin(115200);

It appears that arduboy disables uarts using avr/power.h in order to save power and extend life.

While sound appears to make use of TIMER1 (I believe the serial port might utilize this), it is unclear if you can use both serial and sound simultaneously.

1 Like

(Scott) #3

You shouldn’t need this. Serial (0) is the USB port.

0 Likes

(rainnw) #4

That was cruft from my sketch. I removed it from the solution as its irrelevant.

1 Like