-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UPDI programming with level translation #41
Comments
Actually I never tried a level shifter, because most use pull-ups and I knew these would not work due to the way jtag2updi operates. The UPDI collision detector can be disabled, and I could add an option to jtag2updi to do that. I'll also consider your feature request of a direction pin, but I don't have a lot of different level shifters to test. |
Thanks for the reference -- this collision detection seems a probable explanation. Although I'm slightly surprised TXB0104 works. I tried tinkering with the code to add the collision-detection-disable command in If you like, you can tell me where/how exactly to insert this updi command and I'll test it for you with both TXB0104 and PI4ULS. Regarding direction pin - if you decide to work on this, I can help you test it with some level shifters. |
I think it should be enough to modify JTAG2::set_device_descriptor() function. |
Great! I applied this change:
And that indeed made it work with the PI4ULS level shifter. Anyway, how actually significant is the risk of removing collision detection? |
Well, in theory collisions will never happen. Both the series resistor and collision detection are there just in case, but they are not really required. Anyway, if the 4.7k resistor doesn't work with your setup, I would at least leave some smaller value resistor as protection, maybe 1k or 470 ohm will work. In sum, yeah, the risk of burning an I/O due to collision is very low when things are running smoothly, but if there are communication errors it's possible. |
I came across this issue since I need to program a AVR128DA28 in-circuit at 3V3 (max. voltage for other components) and I'm having no luck with a voltage divider and a TXS0104E. Based on @vladbelous I created this circuit: But I always get:
(avrdude: Version 7.0) By any chance: do you have any idea if I'm doing something wrong? (programming the AVR128DA28 directly using 5V works fine; programming the AVR128DA28 via pyprog (RaspberryPi) works fine - so the IC is good and connections checked and working) |
"RSP_NO_TARGET_POWER" Hi, |
In https://microchip.my.site.com/s/article/AVR---Hardware-Design-Considerations-for-UPDI-pin I found that
So it'd appear that a 10k pull-up resistor should still work, although a larger one would be better. PI4ULS5V201 has integrated 10k pull-up resistors, while TXB0104 (8.3.5) has apparently none and requires that
Which would explain why it worked better. |
Thanks again for your work on jtag2updi!
In the README.md you mention you haven't tried using a level shifter -- I thought I'd share my results/issues here and maybe add a suggestion.
In all cases I use atmega328p as the programmer, and attiny1614 as the target MCU.
The programmer (atmega328p) is running at 5V, and I'm level-shifting down to 2.5V on the target.
Level translation with TXB0104
This one seems to work just fine both at max UPDI_BAUD (225k) and min (80k).
TXB0104 chip is an auto-direction-sensing translator, intended for push-pull applications.
I tried it with the series resistor (on UPDI line) on both side of the translator, on either one side, as well as neither side - works in all combinations.
Level translation with PI4ULS
The full name is PI4ULS5V201 (datasheet) - could NOT get it to work, no matter what I tried. Which is a shame, because it's a small single-channel auto-direction-sensing translator.
The datasheet for it claims support for 20Mbit/s for push-pull (should more than enough) and 2Mbit/s for open-drain applications.
This IC has integrated 10k pull-up resistors - could this be throwing off the UPDI protocol? On the other hand, it does claim to support push-pull applications in any case (not sure how that works with pull-ups).
I also tried recompiling jtag2updi to reduce UPDI_BAUD to minimum (80k) -- still no luck.
I've verified that the translator IC itself appears to function as expected by manually connecting either side to VCC/GND with a jumper cable and observing correct change on the other side (I've done this on the PCB itself, i.e. physically same IC).
I've attached logs of
avrdude -v -v -v ...
runs with TXB0104 (working) and PI4ULS (not working) in case this gives you any clue:logs-txb0104-new.txt
logs-pi4uls-new.txt
Feature request: expose data direction on a separate output pin?
I've generally found auto-direction sensing translators can be finicky, where as translators with a DIR pin seem more reliable (also faster and cheaper).
I'm wondering if we could have jtag2updi expose "current data direction" on a pin, which could then be hooked up to the DIR pin on the translator -- this would allow more parts to choose from. Any thoughts about this?
One would probably need 2 data direction pins of opposite polarity, actually (to support all configurations).
The text was updated successfully, but these errors were encountered: