Connecting an external UART device to the HiFive1 kit

Hey,

I’m trying to connect a UART device (camera) to my HiFive1 kit using the arduino IDE, with the pins 0 (RX) and 1 (TX) on the hifive1 kit. The arduino code I’m running is as follows:

void setup() 
  {
   // put your setup code here, to run once:
   Serial.begin(115200);
   Serial1.begin(115200);

}

void loop(){ }

However, I get the following error message when I try to implement it:

Arduino: 1.8.1 (Linux), Board: “HiFive 1, Default, 16 MHz XTAL”
/home/niramay/Desktop/sketch_apr25b/sketch_apr25b.ino: In function ‘void setup()’:
sketch_apr25b:4: error: ‘Serial1’ was not declared in this scope
Serial1.begin(115200);
^~~~~~~
exit status 1
’Serial1’ was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Apparently, I can’t use “Serial1” to interface with the UART on pins 0 and 1. I thought that option would be present in this device, but it apparently isn’t. Any thoughts on why this is happening? Any solutions?

You can use “Serial” to interface with the GPIO pins 0 and 1. There is only one serial device exported on the HiFive1, and it goes to both the USB for serial communication and to pins 0 and 1 for general UART use.