Switching UPDI and serial #514
-
Would it be possible to use the same serial adapter for both programming and communication? I am thinking of using one or more mosfets with their gates driven low by DTR to enable UPDI. When DTR is high, they would let normal TX/RX lines through. I may try to breadboard something up, but I was curious whether it has been tried or if there's any reason it couldn't work? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
For now I have decided against this in the board I'm designing. I will instead use a DPDT switch to select between programming and normal serial comms. I can program via the bootloader in serial comms mode to avoid having to manually toggle the switch constantly. Here's the relevant portion of my schematic. I have posted more details about the board I will be using this circuit on in show and tell, if you care to have a look. Thanks for paving the way for hobbyists using the Dx series! I have found so much useful information in your docs even though I'm not using the Arduino core. |
Beta Was this translation helpful? Give feedback.
-
I dunno about the MOSFETs for this - the thing to remember is that SerialUPDI at a hardware level is a hair's breadth from not working on the tinyAVRs because of how weak the pin driver on their UPDI pin is (since it's also the reset pin and also the pin that getsthe HV pulse, HV pulse pin has always had crap drivers, which they finally admitted were pretty worthless, when they finally added Reset as I/O to Dx with the double D's - they didn't even bother with pin drivers. (on a log scale, the strength of the output drivers is about halfway between the pullup and a normal pin driver). But on tinyAVRs, it can only drive the pin low with like half a milliamp or something stupid like that (see the datasheet). I've definitely swtiched between modes with a physical switch, and I've also done CH343 dual serial adapters with one dedicated to UPDI and the other to normal serial. I'd be selling them already were it not for some strange issues that have resisted proper understanding. There's a parameter you can pass to SerialUPDI I think to set up it's DTR and RTS pins to whatever you want them to be, too, that I added so I could potentially support an HVSP scheme with it. |
Beta Was this translation helpful? Give feedback.
-
I breadboarded the circuit with a physical switch and confirmed that it works, though had to move the series resistor on the TX line to the other side of the switch to avoid parasitically powering the AVR though the TX line in either mode. Also I am using 1K, not 4.7K as the schematic reads. |
Beta Was this translation helpful? Give feedback.
-
Hi, I'm using the USB to Dual Serial Ports Chip CH342 for my programmer. So there is no hassle switching between UPDI and Serial. This would be a different approach to adress the problem. |
Beta Was this translation helpful? Give feedback.
I dunno about the MOSFETs for this - the thing to remember is that SerialUPDI at a hardware level is a hair's breadth from not working on the tinyAVRs because of how weak the pin driver on their UPDI pin is (since it's also the reset pin and also the pin that getsthe HV pulse, HV pulse pin has always had crap drivers, which they finally admitted were pretty worthless, when they finally added Reset as I/O to Dx with the double D's - they didn't even bother with pin drivers. (on a log scale, the strength of the output drivers is about halfway between the pullup and a normal pin driver). But on tinyAVRs, it can only drive the pin low with like half a milliamp or something stupid like that (s…