Serial And UPDI Handled Together With One Convenient Circuit

Sometimes it’s nice when you can do everything you need to do with just one single port. In this vein, [Nicola Strappazzon] whipped up a circuit to combine serial and UPDI programming in a very convenient way.

As an example, [Nicola] demonstrates the concept using an AVR128DA28 microcontroller. It’s paired with a 4052 multiplexer IC and a CH340 USB-to-serial chip. Everything is wired up such that the 4052 acts as a switch for the signal coming from the CH340. When the RTS flow-control signal is set high, it switches the 4052 to hook up the CH340’s RX and TX pins to the UDPI interface on the AVR microcontroller. Conversely, when the RTS signal is set low, the CH340 is instead hooked up to the serial UART on the microcontroller. From there, it’s a simple matter of configuring avrdude to properly set the RTS pin when attempting to program the attached device.

If you’re working with UPDI devices and you want to be able to talk to them and program them with a minimum of fuss, this project might be useful for you. We’ve looked at dedicated UPDI programmers before, too. If you’re cooking up your own nifty microcontroller hacks, don’t hesitate to let us know on the tipsline.

2 thoughts on “Serial And UPDI Handled Together With One Convenient Circuit

  1. Nice trick, and worthy of publishing.

    About 20 odd years ago I did something similar with the AVR’s. I made a dip adapter that had both an atmega and an 4052, and I switched MISO / MOSI / SCK between the programming connector and the application, and I switched it with the reset line. (It even was in an official AN from Atmel back then) This way the application had more freedom to use those pins, but you do have to consider the series resistance of the switches. In practice I never made much use of it, as nearly always there are plenty of possibilities to hook up the I/O pins. And a bit similar here. Normally you have plenty of USB ports and an extra CH340 is similar in complexity as adding a 4052. But it’s nice to have options like this.

    And it could all be integrated into a single uC. I believe some ST-Link programmers already have extra Uart / I2C / SPI wires to communicate with the application. But it’s quite a lot of work to implement an USB device properly on an uC.

Leave a Reply to ChristophCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.