Konde MegaTinyCore Which RX/TX For Serial Monitor

I am using an ATtiny 2 series chip for a project. My question is, which of the two sets of RxTx lines are the "standard" UART to which a Serial.println statement will be written when implementing Spence Konde's MegaTinyCore?

The links below were incredibly helpful guides. But In the spirit of "teach a man to fish.." I would be grateful if someone could point out the part I missed that would have answered my question.
Konde -Github 1
Konde -Github 2
Arduino Forum

Incidentally I wish to combine monitoring and programming into a single cable. Borrowing ideas from Konde (Dr. Azzy - eye of providence logo) and 6v6gt (vacuum tube logo) see points of attribution in schematic: the image below shows my understanding of how a programming / monitoring switching circuit might be configured. Critical or helpful advice is appreciated!


Update 11/29: As Spence Konde pointed out in his post below, I mistakenly reversed the diode (D3) in the above image. For consistency with Konde's post, I left the original error, and noted it. Konde also mentioned it needs to be a Schottky.


San Jose, CA

Go to the main page for Megatinycore and scroll down to the chapter about "Serial Uart Support"

Under "Pin Swapping" is where you can read that Serial works with RXD0/TXD0) and Serial1 with RXD1/TXD1

I've just summarised and published what I have done up to now on this theme. I'm glad you are also interested in this and I hope it helps.

How did I miss that? I'm not sure I want to know... Thanks for pointing it out (with kindness!)

Nicely done - super helpful document - Thanks.

Serial USART0, Serial1 is USART1, RX0/TX0 is for USART0/serial, RX1/TX1 is for USART1/Serial1.
Each of those have the default pinset, and an alternate pinset. This is exposed by Serial.swap() - Serial.swap(1) switches to the alternate pins, Serial.swap(0) switches back to default, and it has to be called before Serial.begin() for us to guarantee that it will work

Also worth noting that the megaTinyCore docs are markedly worse than the DxCore docs now. megaTinyCore has too much stuff in the main file, making it a wall of text that's painful to wade through. As time permits I'm planning to port the docs back - the modern tinies and the Dx-series are very similar.

The pin mapping on the 2-series is... strange in that the alternate pins for Serial and the default pins for Serial1 are the same. I've not yet tried Serial.swap(1) (moving it to the alt pins) and then Serial.begin(115200) and Serial1.begin(115200) - they would then both be trying to use the same pins, and it's not clear whether one of them would "win" or if they'd both be controlling the pins, and in that case what it would mean. And - surely not coincidentally - two of those three pinsets happen to be on the same pins as an the SPI default and alternate mappings - clearly there's some silicon reuse going on under the hood!

The diode in that schematic is backwards - (and it needs to be a schottky diode with the band towards the TX pin of the serial adapter - Serial is idle-HIGH). I tried using one of those mux ICs. My first attempt failed impressively hard and I never got around to figuring out why (my plan btw was to use a 6-pin FTDI header to connect the adapter/programmer board to the target, and have the "CTS" pin on the target actually connected to UPDI. On the latest versions of my breakouts, thats one of the three things that the CTS line can be tied to with solder bridge jumpers. I laid out what I hope will function as an HV UPDI programmer via serialUPDI or a serial adapter. But I'm not getting over-confident, after my previous attempt failed as it did (I managed to totally bung the assembly of >50% of them, one of the worst rates I've had, and the ones that survived that didnt work; I'm not sure if I made a major blunder in the design, or just repeatedly fumbled the assembly.
That said, I've become more or less convinced that you don't actually want the UPDI programmer and the serial monitor to be on the same serial port -you want to be able to have monitor port connected to a serial console, while you upload with another port. Especially on these damned reset-less tinys!

Thanks Spence, for pointing out that error. The ATtiny nets I attached to the push-button must have derailed my focus! (see above, I made clarifications for future forum readers).

Got it. I will do some more experimenting: Using a 1n4148 and no 470ohm resistor, it worked perfectly (to be clear, just the programing worked - I have yet to try the monitoring). However, add in the 470ohm resistor and it fails. Perhaps a 470ohm combined with a Schottky will work. Diodes, I have thousands, but couldn't find a single Schottky! Amazon...

Time Trade-offs: being your own technical writer/curator vs creating cool new technology. One of those is more likely to put a Pyramid-eye shaped dent in the universe. This community seems at the ready to help insulate you from busy work of answering questions that would be solved by optimal documentation.

I am exploring the 14 pin and 8 pin Megatinys. On the 14 pin, two interfaces is fine, nary the twain shall meet.. great idea. But the 8 pin, with an external SPI peripheral, and reading a pot, ugh... I am likely to pivot back to the library-rich world of the old T85, as not enough people have bled to death on the MegaTiny's.

I received your excellent breakout boards yesterday - very well designed!


San Jose