Electron UART4 Firmware Support?


I was hoping to use UART4 (pins c2 and c3) on the electron. Is it currently supported in firmware / if not will it be in the future? Is my only option for a UART beyond USB and Serial1 without using the RGB led pins to use a SoftwareSerial port?


Just try it

#include "Serial2/Serial2.h"
#include "Serial4/Serial4.h"
#include "Serial5/Serial5.h"

void setup()

Alright I’ll stop being lazy. Ran your tests, both UART4 and 5 work for both reading and writing!


Just updated the docs with this missing info, thanks for the push and example @ScruffR

Once the above commit clears Travis CI, it will be live here:


Just a note here. The doc in the link above indicates that Serial4 is on Pins C2 anc C3. According to the Electron Pin Map V002, those pins are for UART4, which is indicated to be Serial 2.

I think the pinout image has not been updated accordingly yet (@BDub?)

It still mentions Serial2 & Serial3 where the former is actually talking to the cell modem (I think) and the latter is actually unavailable in code.
It’s also confusing that you can use Serial1,Serial2,Serial4 & Serial5, but there are only three USARTs documented.

And this is only true for the Photon (I think), but still shows up for the Electron too

As said, I suspect that’s rather the modem communication port - buut I might be wrong there, I’d have to check but am too lazy right now :blush:

Thanks for the heads up, that is an error. I’ve added it to the datasheet errata here: https://github.com/spark/docs/issues/19

v002 of the Pinout PDF has an error in the lower left of the Legend, UART4 and UART5 should be Serial4 and Serial5, not Serial2 and Serial3.

You can use Serial2 on the electron just like the Photon… it’s kind of hard to use though, and requires hardware modifications. Good thing there are 3 other hardware Serial ports available on the Electron :wink:

1 Like

Hi everyone,

I could use the Serial4 compiling in the web IDE. But how can I add Serial4.h if I am using the offline compiler?

What offline compiler are you refering to?