I was just reading the GitHub project page about how to wire up a UPDI programmer, by @DrAzzy, and noticed a curious omission about types of available USB/Serial interfaces. (I believe that FTDI and CH340G based interfaces were the ones that were mentioned. EDIT: There were a couple more types mentioned in a comparison chart, farther down the page.)
My "go to" method for a USB-to-digital serial interface is as follows:
- take a spare UNO or NANO (I have a few of each);
- upload "The Empty Sketch" (i.e. startup() and loop() methods are defined, but empty);
- take a couple of small pieces of adhesive 3M Post-It (or similar) labels and label one as Tx and the other as Rx;
- paste the "Rx" adhesive label over the Arduino (UNO or NANO) board's "Tx" pin label and the "Tx" adhesive label over the Arduino "Rx" pin label;
- connect the external device to the newly re-labelled Rx and Tx pins (with appropriate level-shifting resistors and/or diodes, if the external device is 3.3V);
- connect the UNO/NANO USB connector to a PC running a terminal emulator (or even the Arduino IDE serial monitor). EDIT: Or running the "PYUPDI Style" programmer software.
(Note that this should theoretically work with any spare Arduino board that does NOT have a USB interface integrated into the main Arduino processor - so this would not work (AFAIK) for boards like Leonardo or Due.)
This effectively allows the UNO/NANO on-board USB serial interface to communicate with external devices connected to the (newly re-labelled) Tx and Rx pins.
Loading "The Empty Sketch" leaves all of the main Arduino processor's I/O pins (including the serial interface Arduino pins 0 and 1) in high-impedance state. Note that the "normal" Arduino "Tx" pin is actually connected to the on-board USB interface's "Rx" pin (and vice versa), hence the re-labelling of the two pins.
And, yes, dedicated serial interface boards are available "dirt-cheap" from vendors like Ali-express and, other Asian vendors on Ebay, but I really do not want to wait a month or more to receive shipments.
Questions for @DrAzzy (or anyone who might know the answers).
EDIT: I looked up the schematic of the UNO R3 board and found that there are 1K resistors in both the Rx and Tx lines. As well, the LEDs are NOT on the signal lines as I had thought, but are controlled by separate digital I/O pins on the 'mega16U2 (the chip being used as the USB interface).
- Would the above scheme work for the "PYUPDI Style" programmer?
- If so, what would be the best value(s) and placement(s) of resistor(s) (for programming time) between the UNO/NANO serial interface, and the UPDI pin of the target "bare" chip (like the ATtiny412)? EDIT: from the GitHub page and the 1K resistors on the UNO schematic, I infer that there only needs to be the one 470R resistor, and the diode between Rx and Tx.
- In the Windows Device Manager, would the comport latency timer need to be updated (as discussed under " Serial adapter requirements" on the GitHub project page)?
- Would the Arduino's on-board Tx and Rx LEDs (and their resistors) negatively affect programming? (I believe these are just a resistor-diode pair between each Tx/Rx signal line and ground.) EDIT: No, they would not, because my belief was wrong. The LEDs are controlled by separate I/O pins on the 'mega16U2; they are not on the Tx and Rx lines.
- Under "Required Components," list item 2, the GitHub project page indicates that a 1N4148 is a Schottky diode(??). I know it is a "fast-switching" and "small-signal" diode, but I do not think it is a Schottky diode. So is the smaller forward voltage drop of a Schottky diode not required for this application? (I am assuming that, being a "fast-switching diode", the 1N4148 recovery time is similar to a Schottky diode recovery time, so the only other relevant difference that I know of would be the forward voltage of each type.)
Instead of specially wiring up a USB interface (like a FTDI or CH340G board) to make a "permanent" dedicated UPDI programmer, I could just add the diode and resistor to a small UNO shield prototype board, make the three-wire "cable" as described in the GitHub article, load the UNO with "The Empty Sketch," et Voila! Instant UPDI programmer.
So would that work?
EDIT: So here is my proposal for a UPDI Programmer "mini-shield" for Arduino UNO R3:
As mentioned above, the UNO would be loaded with "The Empty Sketch" (both setup() and loop() are empty). The top-right and bottom-left headers are meant to represent the pins UNDER the board that would engage with the UNO's header sockets. (Note the reversal of the Tx and Rx labels at the top-right.) The extra two pins for each of these two headers are included to help make the shield more stable when connected to the UNO. The three-pin header in the middle is meant to represent the connector pins for the 3-wire UPDI "cable", with ground in the middle, as suggested by the GitHub page.
From the UNO R3 schematic, and from my understanding of @DrAzzy's GitHub page, I believe the above should work.
Thanks and best regards,