Two software serial port using ParticleSoftSerial library



Is there any way to use two software serial using ParticleSoftSerial library?

I am already using particleSoftSerial library for one uart but i need second one in particle p1.

@ScruffR, Will you please give suggestion on this?



Nope. You can only have one PSS instance but the P1 also has two HW UARTs - whether both are available depends on your PCB design and whether you use the RGB LED on the same pins as the Photon or alternative ones.

But the limitation on PSS is also documented

*  Notes:
*  Import SparkIntervalTimer library (by Paul Kourany)
*    Due to limited free timers and to avoid interrupt mashup, only
*    one active instance is allowed.


@ScruffR, Yes i am already using both hw UARTS - one for RGB led and other for serial log.

And Led indication is also require for me to get reset/connected/disconnected/safe mode indication.

Is there any way to shift led to another pins and also change in bootloader so i can use RGB led HW UART?

Thanks for quick reply.


You can use RGB.mirrorTo() to redirect the RGB output to three other PWM pins.
That setting can be made sticky so that even in SafeMode or when you flash other firmware the mirroring will still happen.
To undo that change you’d need to call RGB.mirrorDisable()


Ok. got it but also low on pwm pins…:confused:

Is there any way to change in code so i can get RGB signal on single pwm pin and instead of RGB led i will use neopixel led so i have HW serial free to use.



You can still use the default RGBR pin so you’d only need two alternative PWM pins and you can have either blue or green assigned to a non-existent pin.
If you want to use a NeoPixel you can’t use RGB.mirrorTo() but you can use RGB.onChange()
Which is also suggested by the reference docs about Serial

RGB.mirrorTo() came later so that’s not mentioned here as it is less flexible but has the benefit of being sticky, which RGB.onChange() is not.

You mean you have already used all 14 (+2 RGBB & RGBG) the available PWMs even the extra ones (P1S0, P1S1 & P1S6)?


You can add an I2C or SPI UART easily. The SC16IS740 works great on the P1 (also the other 2nd and 3rd-generation devices) and you can connect many of them.


Not all pin as PWM but some of them as PWM, analog pins, software serial, HW UART so not any pin is free. even using one GPIO expander.



In that case I think you should definetly go with @rickkas7’s suggestion and opt for a UART expander and keep the RGB as is.


@rickkas7, Yes that will be last option as i have to redesign pcb and thank you for IC suggestion.



@ScruffR Yes. I think that will be best.

Thank you for support. appreciate it.:+1:


Hi @rickkas7

Any through hole I2C/SPI based UART IC for particle device suggestion please?

Thank you.


I think nowadays you’ll have much more luck looking for a breakout board that facilitates a SMT chip. There are many around for the SC16IS740 and with that you already have a working library.

Rick has even designed his own