UPDI programmer software for Arduino - compatible with avrdude

Go To Last Post
125 posts / 0 new

Pages

Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

As you may recall, I've been working on a UPDI programmer firmware to run on Arduinos (Arduini?), to facilitate the programming of the new xtiny MCUs. These chips are clearly gaining in popularity and maybe not everyone wants to invest in a Atmel-ICE, even with 50% discount.

 

The first version was for Atmel Studio but had several drawbacks, it was more of a prototype/hack. But now I have a new one, meant to be used with avrdude, that I think is a lot better.

 

You can get it here: https://github.com/ElTangas/jtag...

 

I hope it will be useful for low-budget hobbyists, it sure is useful to myself :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hey El Tangas,

 

I am trying to program an Attiny814 to blink an LED first before going to my intended program. But I have trouble understanding the tool (pardon me as I am a mechanical/automotive engineer) and it would be great if you could point me in the right direction. 

 

To successfully program an ATtiny814, I would need:

  • Atmel studio, to write the program, to tell which ports are outputs and high etc and then "build" the hex file
  • AVRDUDE: to burn the hex file into the ATtiny814 using Atmega 328P ( I have Arduino UNO )
  • Arduino to load your tool.

 

I understand the first 2 steps but I am having difficulties in understanding the last step on how to go upon using an Arduino UNO as a programmer. I saw few videos in Youtube on how to use Arduino as ISP but I am not sure how to use Arduino for this application. It would be great if you could help me out here!

 

Thank you!

---
Vish
An automotive engineer learning about uCs

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You need to burn the programmer firmware into the Arduino. This is the "JTAG2UPDI.hex" file that you can find here: https://github.com/ElTangas/jtag...

 

You can do this using avrdude with a command like:

 

avrdude -p atmega328p -C {path}/avrdude.conf -c arduino -U flash:w:{path}/JTAG2UPDI.hex:i -P {COM port where arduino is connected}

(you need to supply the correct paths and COM port in your system)

 

Alternatively, if you have the Arduino IDE installed, you can follow these instructions:

 

Building with Arduino IDE

If you prefer, the program can be built as if it was an Arduino sketch. Inside the "source" directory, there is an empty file called "jtag2updi.ino" so that the Arduino IDE can recognize the source code.

Just copy all the files inside "source" to a new directory called "jtag2updi" inside your sketch main directory.

 In this case you just need to program the Arduino like you would any other sketch.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

El Tangas wrote:

You need to burn the programmer firmware into the Arduino. This is the "JTAG2UPDI.hex" file that you can find here: https://github.com/ElTangas/jtag...

 

You can do this using avrdude with a command like:

 

avrdude -p atmega328p -C {path}/avrdude.conf -c arduino -U flash:w:{path}/JTAG2UPDI.hex:i -P {COM port where arduino is connected}

(you need to supply the correct paths and COM port in your system)

 

 

 

Aah yes. Dang. Thanks a lot. I would be following this method to flash the firmware. One more question. The hardware serial interface between the PC(avrdude) and the prograqmmer(Arduino UNO) is a normal USB 2.0 cable type A/B or should I use USB to Serial adapter? 

 

Thanks a lot for your help again!!

---
Vish
An automotive engineer learning about uCs

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

vishwar1 wrote:

 

The hardware serial interface between the PC(avrdude) and the prograqmmer(Arduino UNO) is a normal USB 2.0 cable type A/B or should I use USB to Serial adapter?

 

Any regular USB cable that fits to the Arduino will do, that is, you can use the same cable you use to burn the firmware.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

El Tangas wrote:

vishwar1 wrote:

 

The hardware serial interface between the PC(avrdude) and the prograqmmer(Arduino UNO) is a normal USB 2.0 cable type A/B or should I use USB to Serial adapter?

 

 

Any regular USB cable that fits to the Arduino will do, that is, you can use the same cable you use to burn the firmware.

 

Awesome!! Thank you ! 

---
Vish
An automotive engineer learning about uCs

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I just signed up to say thank you El Tangas! I've been interested about these new chips but thought it was a complete mission to program, but seems like you've done everything so you can use these chips in the Arduino environment. I'm just really really grateful, and wanted to say thank you for your commendable work! 

 

Let me get this straight, so if I take these steps I can pretty much use these chips as if they were an arduino? ie use adafruit libraries and program in a way I know and love? If so then dude, you're a damn legend, and why the heck is there only one other person to have cottoned on? You're a damn hero in my eyes and your praise deserves to be sung!!

 

Another question I have (I am a complete noob when comes to electronic circuit design, apart from badly designing a nano clone), if I was designing a circuit for one of these new attiny chips would I only need one exposed pin for UPDI programming? Is that what 1-wire means? If so then these chips are just bonkers cool, no blooming ICSP of FTDI headers on a board that take up so much space!

 

I've got an idea the for a board using these chips that the wearable crowd would eat for breakfast. So damn excited, sincerely thank you! 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

hopCode wrote:
would I only need one exposed pin for UPDI programming?

Along with vcc and gnd and maybe reset? 

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
stack gold/silver https://www.onegold.com/join/713...

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

hopCode wrote:
Let me get this straight, so if I take these steps I can pretty much use these chips as if they were an arduino? ie use adafruit libraries and program in a way I know and love? If so then dude, you're a damn legend, and why the heck is there only one other person to have cottoned on? You're a damn hero in my eyes and your praise deserves to be sung!!

 

Whoa, whoa, not so fast! These chips are quite different from previous mega and tiny, and more similar to xmega. I can't guarantee library compatibility, that's the job of the library writers.

Maybe when the new Arduino based on the Atmega4809 (which is an UPDI chip), is out, all the stuff you mentioned will eventually become possible.

Right now, you can't, in general, use them as an Arduino.

 

I made this program for people who use Atmel Studio, not the Arduino IDE. I used the Arduino hardware as platform for the programmer, because it's cheap (I mean, the Chinese clones) and easily available.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ok ok I'll slow down haha! I have read these chips are some sort of PIC and Attiny hybrid, and their name is somewhat confusing to most. I'm more familiar with that normal Arduino IDE, I think I may bite the bullet and jump into Atmel studio and see what happens (unless you have to pay for the software; then I'm Tom Tuggered). 

 

If i'm completely honest what I really wanna build is the simplest WS2812b driver, with only a few components, that I hopefully can be lazy and just program in the way I know and love. I had hoped these new chips could be up to the challenge. 

 

I may give this new Attiny stuff a try anyway and see what happens, do what I usually do test things, break things, hack things, hopefully learn something along the way. Price point is pretty compelling! 

 

I can't use them as an Arduino, maybe a better question is can I slap some C code on these new Attiny's and hack/find or blag someone elses WS2812 library to control some LEDs?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

The tight code requirements of the WS2812B IC   (8 bits each for red:green:blue, a logic 0 being high for 0.4 microseconds and low for 0.8 uS and a logic 1 being high for 0.8uS and low for 0.4uS) requires in-line assembler.   The internal op-codes of the UPDI IC MAY be different enough to require a rewrite of the most-commonly used Arduino code for the WS2812B "NeoPixels".

 

Now that Arduino is the world standard for low-cost custom-application AVR development, it should be the microcontroller IC makers who adapt their new IC models to Arduino. They should offer their new IC models for sale on tiny module boards with the Arduino boot-loader pre-installed at low-cost like the $3 Arduino Nanos currently available on eBay.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the comment! Eek well if it requires a re-write that could be an interesting learning curve. I've stumbled over a fair few tutorials on the timing, although I don't think I would take the gamble on whether I can savant it up and turn it into assembler frown

 

I fully and holeheartedly agree with that sentiment*, I wonder if these companies make enough money to employ people to do a job like that, if so where do I sign up? 

 

*My confusion comes in the form of I thought Atmel was synonymous with Arduino, and at one stage thought all Atmel chips could be programmed through or is if they were an Arduino.

 

EDIT: I think it could be worth noting the new datasheets for current WS2812b say reset of >280uS, supports lower frequency and inexpensive MCU. (http://www.world-semi.com/Certif...)

Last Edited: Tue. Jun 5, 2018 - 01:19 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

hopCode wrote:
or is if they were an Arduino.
Not really. See this table:

 

https://en.wikipedia.org/wiki/Li...

 

Specifically the "Processor" column - *those* are the "Arduino processors". In the 8bit AVR range that basically means ATmega32U4, ATmega328P, ATmega2560, ATmega168. The Arduino installation has "core" support for each of those. (so implementations of things like digitalWrite(), analogRead(), Serial.begin(), etc that work with those specific models). For the Arduino system to support a different micro it needs a new "core" added. Some people have developed these for other models of AVR:

 

https://playground.arduino.cc/Ma...

 

So for other chips you might find it listed there - in which case you'd follow the associated link, download the additional core and add to your Arduino installation - then it should be able to support that added chip. But that's still just a tiny subset of the 300+ models of AVR that there are. I don't know if anyone has yet looked at doing this for "Xtiny" (which is what these new, UPDI based AVRs based on the Xmega range are generically referred to as).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
I don't know if anyone has yet looked at doing this for "Xtiny" (which is what these new, UPDI based AVRs based on the Xmega range are generically referred to as).

 

Well someone seems to have done it for the Xmega range: https://github.com/XMegaForArdui...

 

With a few tweaks I wonder if it could be made to include the new Tiny's as well, if your statement is correct and they are based on the xmega range, and not actually some other miscreant hybrid.

I should probably start a thread, I feel really bad shoe horning in here. Apologies, and thank you all for the healthy responses, this place seems cool, I'll stick around!!

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It's better to wait for this one: https://store.arduino.cc/usa/ard...

Supposedly, the "brand new 8-bit microprocessor from Microchip" will be the atmega4809, which is an UPDI chip, therefore, someone must be undertaking the rather difficult work of writing the required Arduino libraries.

Once the libs for the atmega4809 are available, adapting them to the other "xtinies" should not be so hard.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

 

I was able to flash chips while using an Arduino Uno but tried switching over to a Arduino Pro Mini 3V3 and had no luck. If I can flash the jtag2updi code onto the 328p the rest should work the same, right? I tried connecting my sparkfun FTDI to the mini with DTR pin broken off and I can see the my serial TX line sending logic but pin 6 doesnt show any activity on my Saleae...

 

@El Tangas, do you have any additional instructions?

 

Ps. This application is great! Thank you! 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The 3.3V pro mini runs @8MHz, right? My software requires 16MHz to run. This is because of the software UART I implemented for the UPDI link. It may work @8MHz with a few changes but I wouldn't bet on it, the timing is a bit tight.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok, after further consideration, I see that since the mega328p is not specified to run at 16MHz with a 3.3V VCC, this is a problem when programming at lower voltages.

I will try to modify the code to also run at lower speeds, selectable at compile time using F_CPU. This might take a while though.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hey, thanks for the speedy reply.

 

I was hoping to use a 3.3V board to avoid needing to disconnect my other 3.3V circuitry when flashing with my Uno but good to know. Im glad I asked! I can probably just go back to an Uno or get a logic converter for now. Maybe if Im lucky, Ill have time to fix it myself ;)

 

Might be good to specify the 5V in the README.md next time you push an update, since you already mention Arduino Mini Pro.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

In case you are still around, I have updated jtag2updi so that it can run at speeds other than 16MHz. I would be grateful if you could test it with your 3.3V Arduino, I ran some tests using a Mega328P running @8MHz from the internal oscillator.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I gave it shot but no luck. It looks like Im getting the beginning sync byte but no response. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

El Tangas:

 

Thank you for making this software. I have it running on an unmodified Seeeduino v4.2 set to 3.3v (a bargain at $US6.90). Works great.

 

For reference, here is the command line I am using to program my ATtiny412:

avrdude.exe -c jtag2updi -P com5 -p t412 -e -U flash:w:Tiny412Blink.hex

I do have a question about programming the fuses though.

 

I can get the example fuse code for the AVRTiny to compile, but the fuses do not seem to get set in the device. In particular, I am trying to take over the uPDI/RST pin as GPIO, and I can tell the fuse must not be getting set, because I can still reprogram the chip :-)

#if 1 // !! BRICK_THIS_CHIP !!
// Set the fuse so the uPDI will be a GPIO.
// This will make the chip unable to be reprogrammed
// until a 12v pulse is applied. Eeek!
// Apparently this structure needs to be packed from
// the start, but not the end (?)
FUSES =
  {
  //Watchdog Configuration (default is 0x00)
  .WDTCFG=WINDOW_OFF_gc | PERIOD_OFF_gc,
  //BOD Configuration (default is 0x00)
  .BODCFG=0x00,
  //Oscillator Configuration (default is 0x02)
  .OSCCFG=FREQSEL_20MHZ_gc,
  //Apparently need for the compiler.
  .reserved_0x03=0x00,
  //TCD0 Configuration (default is 0x00)
  .TCD0CFG = 0x00,
  //System Configuration 0 (default is 0xC4)
  //Be aware, this breaks future programming
  //unless you use a 12v pulse to reset
  .SYSCFG0 = CRCSRC_NOCRC_gc| RSTPINCFG_GPIO_gc,
  //System Configuration 1 (default is 0x07)
  .SYSCFG1 = SUT_64MS_gc,
  //Application Code Section End (default is 0x00)
  .APPEND = 0x00,
  //Boot Section End (default is 0x00)
  .BOOTEND = 0x00,
  };
#endif

Is this programming firmware supposed to be able to program the fuses?

 

Is there some fiddly bits needed to make fuse programming work?

 

Thanks for any assistance you can offer.

 

TinyAVR Fuse uPDI Programming ATtiny212 ATtiny214 ATtiny412 ATtiny414 ATtiny416 ATtiny417 ATtiny814 ATtiny816 ATtiny817 ATtiny1614 ATtiny1616 ATtiny1617

Last Edited: Tue. Sep 11, 2018 - 06:09 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Some more information this morning: I compared my hex file with and without the code above included. They are identical, so I do not think the fuse information is making it to the programmer. Studying that now.

. . . 

OK, it appears that AVRDUDE needs the fuses passed to it on the command line. The examples I am finding only have three fuse bytes. As far as I can tell the ATtiny412 has 8 (9 with reserved) fuse bytes. Still looking.

 

Last Edited: Tue. Sep 11, 2018 - 02:00 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Fuse info is NEVER in the .hex file (only microchip do that with PICs - it's never been the case for AVR).

 

You can only use .fuse section programming if you use ELF not HEX files (because ELF are multi-section and as well as .text+.data for the flash image and .eeprom for the EEPROM, they can have .fuses for the fuses and .lock for the lockbits),

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson: Thanks for confirming that the fuses are not in the HEX.

 

I am looking now to see if/how El Tangas's programmer in conjunction with AVRDude can be used with ELF files.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

-- THIS WILL BRICK YOUR ATtiny412 CHIP --

(well, only until you use a 12v pulse to get around it)

 

Here is the information to write the RSTPINCFG_GPIO_gc fuse to an ATtiny412 using El Tangas's jtag2updi  programmer.

 

This will change the RST/uPDI pin (permanently) to a GPIO which your code can control.

 

This also shows how AVRDude can be used with ELF files.

 

In your source:

#if 1 // !! BRICK_THIS_CHIP !!
// Set the fuse so the uPDI will be a GPIO.
// This will make the chip unable to be reprogrammed
// until a 12v pulse is applied. Eeek!
// Apparently this structure needs to be packed from
// the start, but not the end (?)
FUSES =
  {
  //Watchdog Configuration (default is 0x00)
  .WDTCFG=WINDOW_OFF_gc | PERIOD_OFF_gc,
  //BOD Configuration (default is 0x00)
  .BODCFG=0x00,
  //Oscillator Configuration (default is 0x02)
  .OSCCFG=FREQSEL_20MHZ_gc,
  //Apparently need for the compiler.
  .reserved_0x03=0x00,
  //TCD0 Configuration (default is 0x00)
  .TCD0CFG = 0x00,
  //System Configuration 0 (default is 0xC4)
  //Be aware, this breaks future programming
  //unless you use a 12v pulse to reset
  .SYSCFG0 = CRCSRC_NOCRC_gc| RSTPINCFG_GPIO_gc,
  //System Configuration 1 (default is 0x07)
  .SYSCFG1 = SUT_64MS_gc,
  //Application Code Section End (default is 0x00)
  .APPEND = 0x00,
  //Boot Section End (default is 0x00)
  .BOOTEND = 0x00,
  };
#endif

Command line for AVRDUDE to set FUSES on ATtiny412 using ELF file:

avrdude.exe -c jtag2updi -P com5 -p t412 -e -u -U flash:w:w:YourProject.elf:e -U fuse5:w:YourProject.elf:e

* I have verified that I can manually use a bench supply to jam 12v into the uPDI pin to enable further programming. You will want to protect your circuitry that is connected to uPDI from the 12v. I used a 1K resistor figuring that it would limit the current driven into my circuit to ~ 9mA (12v-3.3v)/1K

 

Bonus: I do not think I have fried anything . . . yet!

 

tinyAVR uPDI RST GPIO ATtiny212 ATtiny214 ATtiny412 ATtiny414 ATtiny416 ATtiny417 ATtiny814 ATtiny816 ATtiny817 ATtiny1614 ATtiny1616 ATtiny1617

Last Edited: Thu. Sep 13, 2018 - 03:19 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm glad everything worked out. As you learned, hex files can only hold data for one memory type, unlike elf files that have multiple sections and therefore can hold the data for all the different memories.

So your question was more of a general avrdude/object file format question than something specifically related to my program.

 

I also want to note that if you do some calculations from the Mega328P datasheet, the maximum operating frequency at 3.3V is 13.3MHz, so the Seeeduino operating @ 16MHz is a bit overclocked (+20%) when running at 3.3V.

 

edit: yeah, I believe someone here had already tried to give a 12V jolt to the UPDI pin an was also able to get it into programming mode. Maybe it would be better to limit the current from the 12V source to 1mA or less, so as not to strain the protection diodes in your main circuit.

 

edit2:

  //Apparently need for the compiler.
  .reserved_0x03=0x00,

Actually, this fuse seems to be unused. It's factory value is 0xFF, but you can put any value there and it doesn't seem to have any effect.

Last Edited: Tue. Sep 11, 2018 - 08:13 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Can I use this method to program the Mega4809 or is it not supported? I've been tinkering with a project on the xplained pro dev board and am wondering if I can use this to program the 4809 on a standalone PCB? I can't really justify the purchase of an Atmel-Ice at the moment... When I purchased this I was unaware of the different programming requirements and mistakenly thought I could use my cheap AVR Pocket Programmer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

dino_cupertino wrote:
... and am wondering if I can use this to program the 4809 on a standalone PCB?
Yes

https://www.avrfreaks.net/forum/megaavr-0-series?page=1#comment-2475636

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

gchapman wrote:

dino_cupertino wrote:
... and am wondering if I can use this to program the 4809 on a standalone PCB?
Yes

https://www.avrfreaks.net/forum/megaavr-0-series?page=1#comment-2475636

 

 

Fantastic! Thank you sir!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can, in principle, program any UPDI chip defined in the avrdude.conf file I supply. The complete list is:

 

# ATtiny202
# ATtiny204
# ATtiny402
# ATtiny404
# ATtiny406
# ATtiny804
# ATtiny806
# ATtiny807
# ATtiny1604
# ATtiny1606
# ATtiny1607
# ATtiny212
# ATtiny214
# ATtiny412
# ATtiny414
# ATtiny416
# ATtiny417
# ATtiny814
# ATtiny816
# ATtiny817
# ATtiny1614
# ATtiny1616
# ATtiny1617
# ATtiny3214
# ATtiny3216
# ATtiny3217
# ATmega3208
# ATmega3209
# ATmega4808
# ATmega4809

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I got it blinking! Thank you for your work on this El Tangas! 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hey, I have read all the data in the chat above but being new to this field I couldn't understand it. I have attiny406 uC and USBASP programmer and an Arduino mega. I have generated a hex file using Atmel studio. I also have winAVR and Arduino ide installed in my pc. Can someone explain me the steps to flash my program in the IC?

 

Thanx in advance.

Last Edited: Sat. Oct 6, 2018 - 07:26 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I can try to help, but my software is not meant for Arduino Mega. It will need to be ported, it should not be very difficult because the ATMega2560 in the Arduino Mega has similar peripherals to the Mega328P on the Arduino uno.

However I will need your cooperation since I don't have an Arduino Mega for testing.

So, first, I need to update the jtag2updi repository, I have some changes that need to be done.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No problem with arduino mega, if it is easily possible with usbasp module, we can use that also. I have a usbasp module

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No, usbasp can't be used to program the tiny406.

 

Ok, the first thing you need to do, is create a sketch called "jtag2updi" then copy from my repository, the files inside the "source" directory to the sketch directory.

Then open the sketch in the Arduino IDE, change the preferences to display detailed compilation info, select the arduino Mega and hit the verify button. There will be errors, please copy and post here.

Last Edited: Sat. Oct 6, 2018 - 03:14 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello!

 

I have some troubles with the jtag2updi. I have program an Arduino Nano v3 and I've disallowed the reset by DRT (unsoldering the capacitor), but in my scope I don't see any signal in the PIN D6 when I use the avrdude command (COM13):

avrdude -c jtag2updi -P com13 -p t412

I get this error from avrdude:

avrdude: jtagmkII_getsync(): sign-on command: status -1

As I said, I don't see anything in my scope, and it is very very strange.

 

I've tried changing the serial speed, but without success. Also, I've programed a simple script for test the PORT D6, and it works perfectly.

 

The hardware configuration is very simple, an Arduino Nano v3 (without the capacitor for DRT reset) plus a 4,7KOhm resistence between D6 and the UPID pin (pin 6 for the ATtiny412). I get the power from the arduino +5 and GND pins.

 

Could you help me?

 

Thank you! 

 

P.S. Now I'm in a trip, but this weekend I can do some test if you need more information.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok. The first thing that comes to mind is that maybe the nano has a Mega168 instead of a mega328P. The precompiled binaries are for the 328P and won't work on a 168.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It has the mega328p. I tried with the compiled version and my own compilation with Arduino IDE 1.8.5 and I was able to flash it without problems (I specified the microcontroller, boot version and serial port in the Arduino IDE settings).

 

I remember that at the begining, after reset or power on the LED (PB5) blinked for 3 times, is it correct? 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Elektor has published a news article about your programmer : "UPDI programmer for ATmega4809 and ATtiny816/817" !

Bernard.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I may have introduced some bug... people have forked older versions, please try them out.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

El Tangas wrote:

I may have introduced some bug... people have forked older versions, please try them out.

Ok, I will try them the weekend. Any suggested version?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

WeSo wrote:
I tried with the compiled version and my own compilation with Arduino IDE 1.8.5 and I was able to flash it without problems

 

Well, I just flashed the current version of jtag2updi on an Arduino nano, either compiled with AS7 or Arduino IDE 1.8.2 and it seems to be working fine with tiny1614 and tiny1616 (that's what I can test right now).

I disabled the reset function using a 10uF capacitor from RST to GND.

 

 

 

pradines wrote:
Elektor has published a news article about your programmer : "UPDI programmer for ATmega4809 and ATtiny816/817" !

 

Cool. I had already noticed lots of traffic coming from Elektor to the jtag2updi repository.

Last Edited: Tue. Nov 20, 2018 - 10:46 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

El Tangas wrote:

WeSo wrote:

I tried with the compiled version and my own compilation with Arduino IDE 1.8.5 and I was able to flash it without problems

 

 

Well, I just flashed the current version of jtag2updi on an Arduino nano, either compiled with AS7 or Arduino IDE 1.8.2 and it seems to be working fine with tiny1614 and tiny1616 (that's what I can test right now).

I disabled the reset function using a 10uF capacitor from RST to GND.

 

Some questions:

- Is the version v3?

- The led blink 3 times? Maybe my Nano is being reset for some reason...

- Can you monitor the D6 output with a scope?

 

I disabled the reset function with two options:

- 120Ohm resistor from RST to +5

- Removing the capacitor in RESET pin. This one worked because now for re-flash the Nano I have to press the button.

 

I will try with other Nano. I don't remember if I ordered tiny161x.

 

Thank you for all!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

WeSo wrote:

Some questions:

- Is the version v3?

- The led blink 3 times? Maybe my Nano is being reset for some reason...

- Can you monitor the D6 output with a scope?

 

  • The Nano is a generic Chinese clone from Ebay/Aliexpress
  • The LED is not supposed to blink 3 times. It should just stay on while the UPDI is in programming mode.
  • The D6 signal looks like this, when probed on the UPDI side (after the resistor):

 

 

Notice that the UPDI while on input mode has a pull-up resistor, this causes the signals from the host to not go fully to GND (the 4.7k resistor forms a voltage divider with the pull-up). The signals sent by the UPDI side go to GND.

This is useful for diagnostic, allowing us to see on the scope which side is "talking". Each data packet sent by the host starts with a synch signal (4 periods of square wave) visible on this sample.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

El Tangas wrote:

WeSo wrote:

 

Some questions:

- Is the version v3?

- The led blink 3 times? Maybe my Nano is being reset for some reason...

- Can you monitor the D6 output with a scope?

 

  • The Nano is a generic Chinese clone from Ebay/Aliexpress
  • The LED is not supposed to blink 3 times. It should just stay on while the UPDI is in programming mode.
  • The D6 signal looks like this, when probed on the UPDI side (after the resistor):

 

 

Notice that the UPDI while on input mode has a pull-up resistor, this causes the signals from the host to not go fully to GND (the 4.7k resistor forms a voltage divider with the pull-up). The signals sent by the UPDI side go to GND.

This is useful for diagnostic, allowing us to see on the scope which side is "talking". Each data packet sent by the host starts with a synch signal (4 periods of square wave) visible on this sample.

I use a chinese clone too :\ I will try other unit, but it works perfect with other programs.

 

I get 3 blinks at boot... very strange.

 

I suppose that even without a microcontroller connected, I should see in my scope the initial pattern, right?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The first thing you should see in the UPDI line is the "double break" pattern, that is, two consecutive low pulses of 24.6 ms each. See the first scope trace in this post: https://www.avrfreaks.net/forum/...

 

Note that jtag2updi will usually enter infinite loops when things go wrong (yeah, in my laziness I haven't implemented timeouts in the program yet).

So, you should always reset the Nano in the event of failure, then try again.

 

Also, avrdude can output useful diagnostics if you add the -v option to the command line. You can use up to 4 -v (that is, -v -v -v -v) to get more and more diagnostic info.

This will show the avrdude step at which failure occurs.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, I tried the -vvvv output, then I saw that it fails waiting the reply, I mean, avrdude sent the first pattern but it didn't receive the response. Meanwhile, I didn't see anything in my scope.

 

This weekend I will test with other hardware and I will monitor the reset pin and others... I'll keep you informed.

 

Thank you El Tangas!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi!

 

I have tried with other Nano v3 and it works perfect now... I don't know why the other model does not work :(

 

Work vs not work

 

Thank you for all El Tangas!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Strange... which one is working, the blue one or the black one?

 

I'm guessing the blue one works? It's modded with a cap on RST to GND, while on your first post you said you used a different mod, so the original must be the black one.

 

Well, the important thing is that you got it workingyes, I like the way you took advantage of the programming header of the nano to build your programmer, thanks for the pic.

Pages