I am using an ESP32, but it only has 2x available hardware serial ports.
I am talking to a Nextion touch-screen using a software serial link and it seems to work fine.
I was wondering why it is so frowned upon (or at least appears to be)?
This SEEMS to be working absolutely fine.
I imagine a touchscreen isn't timing critical and the Nextion does most of the hard work anyway (it hosts all the graphics).
Because people copy programs that use it, even though the chosen Arduino board has serial connections not being used. Also the software serial has limited speed. It will also have errors if the interrupts is uses are being use by other parts of the program.
Yes, I did think about using serial0.
I lose my 'debugging' ability but it would be nice to get rid of the software serial. Plus, a pain to have to keep disconnecting the screen while uploading and editing code.
Maybe a simple 'programming' switch on the PCB to switch serial lines
You probably only need to worry about a conflict on the TXPIN.
I added a GPS to a ESP32CAM, which is very short of available pins. So I used the program upload Serial port for the GPS and disabled the GPS TX pin during program upload with a switch. No big deal.
Using software serial on its own, no other interrupt stuff in the background works well enough.
But have software serial running in the background, with other program stuff running, SPI or Serial for instance and expecting received characters to be buffered correctly is where the problems can and definetly do occur.
Hardware serial is generally preferred over software serial because it is much less likely to cause implementation issues particularly at higher baud rates on more limited processors.
If software serial works in your application, no one is going to frown upon it. It's just another tool in the toolbox.
That then leads to the question: which of your devices most deserve hardware serial ports, or which of those devices would be the best candidate for the inferior software serial port?
Without knowing what those other devices are, it's certainly possible that the display would benefit from using a hardware serial port more than one of those other devices would be disadvantaged by using a software serial port.
Nope... the two Hardware serials are running timing critical DMX functions. The screen is only for programming and doesn't actually get used while the DMX is running.
Arduino compatible boards based on SAMD21 chips have 5 "SERCOM" ports which can be configured to be SPI, I2C or UART (=Serial) ports. Some of these boards are small and inexpensive.
I don't think anyone has explained that hardware serial is performed by a processor "peripheral", which is a separate section of the processor that runs on its own. Once you start it sending or receiving a byte, it will continue handling each bit automatically no matter what else is going on. So if there's a Timer0 interrupt to update millis(), the serial peripheral will pay no attention, and just continue processing the bits while the interrupt code is executing. So you can deal with the traffic one byte at a time. Software serial may have to deal with each bit, and will have to make provisions for any interrupts that might take place. So hardware serial has significant advantages over software. One of the differences will be maximum baud rate, in case that matters.
We didn't know that. We are the ones you are asking for advice.
On this forum, hundreds of questions are asked every day where the question that was asked turned out not to be the question that needed an answer, because of misconceptions and ignorance on the part of those posting them. This has taught the forum members who spend time answering questions not to make assumptions about what the poster does and does not know. If they answered every question strictly as it was asked, those posting the questions would be back in a couple of days or weeks asking the question they should have asked the first time around, having wasted everybody's time, especially their own (and possibly their money too).