Serial confusion


I am bit confused about serial connections for photon. I understand that serial1 uses TX and RX pins, that is clear enough. Serial is over the usb port. What I can’t understand is can it be used for communicating with other equipemnt and are those big pads 30,31 underside photon meant to be used for serial? Is pad 30(RX) and pad 31(TX) or is it the other way around?

And now comes serial2 :smiley: That is very confucious. Particle docs says for serial2 to use D1(TX) and D0(RX), but in this thread HERE they say to use lines going to the RGB Green and Blue LEDs???

Can all serials run at 230400 Baud?
Thank you! who can clear this up for me.

As for the pads (30/31) these are not meant as RX/TX but they are the D+/D- pins for the USB port. And even if you can use it via Serial, the communication is still not executed the same way as a on a serial COM port but in adherence to the USB standard. Hence you need a driver to make this USB device accessible as COM port.

Serial2 is accessible via D0/D1 only on the Core. On the Photon these are really only accessible via the RGB-LED pads but can only be used properly after you remove the LED and the series resisors.
It is quite possible that there are some Core/Photon mixups in the docs - I’ll fix it the sample code comments. (Edit: Done)

About 230400 I can’t say, did you see any reference that this baud rate should be available?

Thanks for clearing things up. That means I can’t connect two uart devices to my photon without making changes to it.

Not easily, but there might be options if you have a definitive use-case.

I’m builing a linefollowing robot. And the ESC’s I have can be controlled over CAN, Serial and PWM. So far CAN is still not working on Photon. I really don’t want to start removing small smd’s form my photon to make serial2 working (but it might be my only option) And the photon’s sevo library that generates pwm runs at measly 50hz whereas it sure could be made to run close to 500hz, but I am new to aruinos and stuff so that is out of my skill level. I made a thread were I want help changing the servo library frequency, but so far it has no replies.

While it would probably be best to go the PWM route (and this should be possible once some underlying PWM issues are solved), would it not be possible to multiplex the RX/TX lines?


By multiplexing you mean something like this? LINK that might even work, but their shipping to EU is insane, over 40$. Do you know some other brands?

@Infinity see the post below for a hardware PWM hack.
Unfortunately, it makes use of the Tx pin, which may be an issue for you.

We made an earlier post showing how to generate softPWM, which would work for short bursts, but probably not for continuous PWM. (Follow link in this post)

Its not much more than a breakout board for 74HC4052 a general multiplexor chip.
The downside is you can only have one active serial port at a time, so you need to know which port you currently need.