UPDI programmer software for Arduino - compatible with avrdude

Go To Last Post
125 posts / 0 new

Pages

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

Xtronic, Moe123 and ElTangas all make good points. I think that many of the reasons I have got into a new topic is because someone has made a route into it using the things I am already familiar.

I'm certainly thankful that jtag2updi existed to get me interested and thanks for the reminder about the ATtiny xplained boards as a updi programmer. Just ordered one today.

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

In my opinion the Curiosity Nano has a superior debugger to the old Xplained Nano, although at a slightly higher cost... 

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

Hello.

I'm trying to setup fuses to an mega4809.

I want to setup BOOTEND and APPEND.

According to a previous post I placed a macro in my main.c file

 

FUSES = {
    .WDTCFG     = WINDOW_OFF_gc | PERIOD_OFF_gc,
    .BODCFG     = 0x00,
    .OSCCFG     = FREQSEL_20MHZ_gc,
    //  .TCD0CFG    =
    //  .SYSCFG0    =
    //  .SYSCFG1    =
    .APPEND     = 0xBF,
    .BOOTEND    = 0x20,
};

 

Using avr-objcopy I extracted a binary.

 

avr-objcopy -j .fuse my-app.elf -O binary fuses.bin

 

and I'm trying to flash the bin into the chip.

I tried:

 

avrdude -c jtag2updi -P com5 -p m4809 -Ufuses:w:fuses.bin
avrdude -c jtag2updi -P com5 -p m4809 -U fuses:w:fuses.bin
avrdude -c jtag2updi -P com5 -p m4809 -U fuse:w:fuses.bin

But nothing's working.

 

I get.

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.22s

avrdude: Device signature = 0x1e9651 (probably m4809)
avrdude: NOTE: Programmer supports page erase for Xmega devices.
         Each page will be erased before programming it, but no chip erase is performed.
         To disable page erases, specify the -D option; for a chip-erase, use the -e option.
avrdude: reading input file "fuses.bin"
avrdude: can't determine file format for fuses.bin, specify explicitly
avrdude: read from file 'fuses.bin' failed

avrdude done.  Thank you.

 

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

Be careful! Fuses that are not explicitly defined may be set to zero, resulting in a bricked MCU that would need 12V programming to ressurect.

 

So don't comment out:

    //  .TCD0CFG    =
    //  .SYSCFG0    =
    //  .SYSCFG1    =

Set every fuse to the value you want, even if it's the default value!

Read this thread carefully: https://www.avrfreaks.net/forum/...

 

Now that the warning is given, the problem you have is that you need to specify the file format explicitly, because ".bin" files really have no format so avrdude can't auto-detect it:

 

avrdude -c jtag2updi -P com5 -p m4809 -U fuse:w:fuses.bin:r

Where ":r" means raw binary.

 

edit: Ah, wait, now I noticed that you are using a mega4809, which has a dedicated UPDI pin, so the chance of bricking it is low.

Last Edited: Sat. Jun 8, 2019 - 10:28 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello, I'm strugling with this sentence in the datasheet of ATtiny404: "Enabling of the 1-wire interface, by disabling the Reset functionality, is either done by 12V programming or by fusing the RESET pin to UPDI by setting the RESET Pin Configuration (RSTPINCFG) bits in FUSE.SYSCFG0."

 

1.- Does it mean that I need another programmer to set that pin configuration register before using this UPDI programmer for Arduino that El Tangas has shared with us?

 

2.- Do I need 12v programming?

 

3.- Or, can I just program a brand new ATtiny404 with the tool that shared El Tangas?

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

A brand new device has UPDI enabled by default (fused), so you can program with any "low voltage" tool. 

If you do happen to change the UPDI pin into GPIO or /reset by changing the RSTPINCFG bits in the SYSCFG0 fuse, then you will need a 12V-capable programmer to get it back into UPDI mode again to be able to program it.

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

mraardvark wrote:
If you do happen to change the UPDI pin into GPIO or /reset by changing the RSTPINCFG bits in the SYSCFG0 fuse, then you will need a 12V-capable programmer to get it back into UPDI mode again to be able to program it.

 

I dont know if this is right. I happen to use the UPDI pin as a GPIO in a tiny412 (Custom board), I didnt need any 12v to get it back to UPDI.

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

Moe123 wrote:

mraardvark wrote:
If you do happen to change the UPDI pin into GPIO or /reset by changing the RSTPINCFG bits in the SYSCFG0 fuse, then you will need a 12V-capable programmer to get it back into UPDI mode again to be able to program it.

 

I dont know if this is right. I happen to use the UPDI pin as a GPIO in a tiny412 (Custom board), I didnt need any 12v to get it back to UPDI.

 

How did you do this exactly?

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

Well, I just configure it as a GPIO, i dont remember if it was an output or input. Using ATMEL-ICE i could use the same pin as UPDI and GPIO...its an old project, I will check if it was an o/p or i/p.

however, what i do remember clearly is that I also didnt need to change the FUSE settings for the UPDI PIN...give it a try

Regards,
Moe

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

okay, so here is the deal. If you want yo use the UPDI pin as a gpio and at the same time as a UPDI without getting into 12v issue, then you can use it in one case...you have to use it as an input pin. otherwise you cant.

only as an input can use the UPDI pin. if you use it as an output then you will get yourself into 12v programming.

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

Interesting. There are two questions remaining:

 

1. What is the chance that signals on the GPIO input may trigger UPDI programming and possibly interfere with program flow?

2. Did you try this with interrupts or only with slowly changing static input signals?

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

Moe123 wrote:

you have to use it as an input pin. otherwise you cant.

only as an input can use the UPDI pin. if you use it as an output then you will get yourself into 12v programming.

In either case, what ever is attached to the UPDI pin must be 12v tolerant or it's all for naught!

 

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: 0

ki0bk wrote:

Moe123 wrote:

you have to use it as an input pin. otherwise you cant.

only as an input can use the UPDI pin. if you use it as an output then you will get yourself into 12v programming.

In either case, what ever is attached to the UPDI pin must be 12v tolerant or it's all for naught!

 

Jim


Jim, the question is whether you can use the pin as UPDI and as GPIO at the same time.

Great, now read the thread again.

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

drei wrote:

Interesting. There are two questions remaining:

 

1. What is the chance that signals on the GPIO input may trigger UPDI programming and possibly interfere with program flow?

2. Did you try this with interrupts or only with slowly changing static input signals?

For 1, I dont have answer, this you have to check it with an osci...in my case i never faced such a problem like this.

For 2: interrupts

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

Moe123 wrote:
I also didnt need to change the FUSE settings for the UPDI PIN...give it a try

 

So the pin is in UPDI mode, but you can still read the input? But in that case, certain input sequences will put the MCU in UPDI mode. You need to be sure such sequences will never happen, right?

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

Its like this, you cant really read the input, BUT you can flash your program again without the need for 12V. this means, the pin may work "fine" for basic functions...but you cant read whats going on...e.g. if you use it for ADC it will not be possible to read it

Last Edited: Mon. Aug 12, 2019 - 08:00 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have tested using the UPDI pin as I/O while keeping it configured as UPDI; you are right, it can be used as digital input for the most part. It's possible to read its logic value, and it can even trigger interrupts and events.

That is, the pin is under control of the UPDI unit, but the CPU unit can monitor and react to what is going on.

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

After several attempts this is my solution that seems to work reliably (tested with ATtiny814):

 

 

It turned out that the UPDI pin (when in its original fuse state) has an internal pullup resistor, approx. 20 to 30 kOhm. This pullup is not disabled even if the GPIO pullup is disabled. Therefore the best solution seems to be an open collector or open drain driver with appropriate decoupling. GPIO initialization in my case is as follows, directly taken from Atmel Start:

 

    OVERC_set_dir(PORT_DIR_IN);            // Set pin direction to input
    OVERC_set_pull_mode(PORT_PULL_OFF);

 

Here the input is used as an overcurrent detect for a CCL logic block.

 

Q1 decouples the rest of the circuit from the UPDI functionality. The jumper is normally not necessary, it can be left closed, UPDI programming works anyway provided Q1 is inactive during programming.

 

 

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

And using the UPDI pin as input also has the advantage that it is high voltage tolerant, so probably you can connect it to 5V logic even if the MCU is running at 3.3V (untested).

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

I would not try that. The voltage level could be near the 12V trigger point so it could inadvertently start the UPDI programming process. On the contrary I have chosen a solution that prevents input voltages exceeding Vcc.

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

drei wrote:
I would not try that. The voltage level could be near the 12V trigger point so it could inadvertently start the UPDI programming process.

 

Yeah, but where exactly is that trigger level? I think I read somewhere that it's about 2x VDD, but does anyone have some actual data?

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

El Tangas wrote:

Yeah, but where exactly is that trigger level?

 

Good question. That's why i would avoid it.

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

Besides, does the 12V UPDI enable actually do anything if UPDI is already enabled by fuse?

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

El Tangas wrote:

Besides, does the 12V UPDI enable actually do anything if UPDI is already enabled by fuse?


The high-voltage pulse won't do anything, but a falling edge on the UPD pin will wake the PDI-oscillator, which consumes some power. After a short period on inactivity it will go back to sleep again.

Pages