Uploading code to new Arduino NANO-EVERY

Go To Last Post
25 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I can build and upload sketches to the new NANO-EVERY board via the Arduino IDE.

 

It looks as if the IDE uses avrdude to program mega4809 chip via the SAMD11 USB-Serial chip using the UPDI protocol.

 

Forcing reset using 1200bps open/close on port COM39
C:\Users\David Prentice\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino16/bin/avrdude -CC:\Users\David Prentice\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino16/etc/avrdude.conf -v -patmega4809 -cjtag2updi -PCOM39 -b115200 -e -D -Uflash:w:C:\Users\DAVIDP~1\AppData\Local\Temp\arduino_build_577104/I2CexpDiag.ino.hex:i -Ufuse2:w:0x01:m -Ufuse5:w:0xC9:m -Ufuse8:w:0x00:m {upload.extra_files} 

avrdude: Version 6.3-20171130
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\David Prentice\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino16/etc/avrdude.conf"

         Using Port                    : COM39
         Using Programmer              : jtag2updi
         Overriding Baud Rate          : 115200
JTAG ICE mkII sign-on message:
Communications protocol version: 1
M_MCU:
  boot-loader FW version:        1
  firmware version:              6.00
  hardware version:              1
S_MCU:
  boot-loader FW version:        1
  firmware version:              6.00
  hardware version:              1
Serial number:                   00:00:00:00:00:00
Device ID:                       JTAGICE mkII
         AVR Part                      : ATmega4809
         Chip Erase delay              : 0 us
         PAGEL                         : P00
         BS2                           : P00
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 0
         StabDelay                     : 0
         CmdexeDelay                   : 0
         SyncLoops                     : 0
         ByteDelay                     : 0
         PollIndex                     : 0
         PollValue                     : 0x00
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           prodsig        0     0     0    0 no         61   61      0     0     0 0x00 0x00
           fuses          0     0     0    0 no          9    0      0     0     0 0x00 0x00
           fuse0          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse1          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse2          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse4          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse5          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse6          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse7          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse8          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           lock           0     0     0    0 no          1    0      0     0     0 0x00 0x00
           data           0     0     0    0 no          0    0      0     0     0 0x00 0x00
           usersig        0     0     0    0 no         64   64      0     0     0 0x00 0x00
           flash          0     0     0    0 no      49152  128      0     0     0 0x00 0x00
           eeprom         0     0     0    0 no        256   64      0     0     0 0x00 0x00

         Programmer Type : JTAGMKII_PDI
         Description     : JTAGv2 to UPDI bridge
         M_MCU hardware version: 1
         M_MCU firmware version: 6.00
         S_MCU hardware version: 1
         S_MCU firmware version: 6.00
         Serial number:          00:00:00:00:00:00
         Vtarget         : 5.0 V

avrdude: jtagmkII_initialize(): Cannot locate "flash" and "boot" memories in description
avrdude: AVR device initialized and ready to accept instructions

I would expect to manually press a Reset button and use:

avrdude -c jtag2updi -p ATmega4809 -P com39

Note that I use the same "avrdude.exe" that comes with the new "megaAVR Core" for m4809 chips.

There does not seem to be an avrdude command to Force reset using 1200bps open/close on port COM39

 

Obviously I can stick with Arduino IDE but I would like to flash the NANO-EVERY via AS7 or CodeVision.

Normally you just use the appropriate avrdude command via the Tools Menu or batch file.

 

David.

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

Apparently they ported my code jtag2updi to run on the SAMD11. They also seem to have patched avrdude 6.3.0 to recognise updi in the avrdude.conf file.

When I wrote jtag2updi, I had to hack avrdude.conf to pretend the updi chips used pdi (the difference is small, anyway... as we all know now, that the AVR-0/1 are xmega variants).

 

These are interesting developments, I hoped something like this would happen when I wrote the program. I even used MIT license instead of GPL to make it more attractive for commercial use.

Now we just need to wait for the final part of my master-plan: $2 Chinese clones smiley

Last Edited: Mon. Jul 1, 2019 - 12:06 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
There does not seem to be an avrdude command to Force reset using 1200bps open/close on port COM39

 

Not sure what your question is.

 

Since avrdude doesn't provide the command, can't you just write a program

to open and close the com port at 1200 baud and add that program to your

batch file that is called from Studio 7?

 

 

 

 

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

The Leonardo also requires COM port to be opened / closed at 1200baud to start the Bootloader.

Yes,  you can put this in your .BAT file

mode %COMPORT% baud=12 > nul
timeout 2 > nul

then call avrdude with the Bootloader COM port.    Avrdude talks to the Leonardo Bootloader.

 

This does not work with the NANO-EVERY jtag2updi bootloader.    

 

Since Arduino seem to have adapted Mr Tangas's code,   I am hoping that he will be able to suggest a fix.

The UPDI pin is not accessible on the EVERY board.   So I can't just connect an ATMEL-ICE.

 

David.

 

Edit.   Woo-Hoo.   I have cracked it:

mode %COMPORT% baud=12 dtr=on > nul
mode %COMPORT% baud=12 dtr=off > nul

 

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

That feature, reset by DTR, was not present in my original code, they added it. It's useful but I couldn't implement it because my code was supposed to run on Arduino nano/uno , so I didn't want to go into the Arduino bootloader every time avrdude started.

 

But now that I think about it, maybe I should look into it.

 

OTOH, programming with avrdude always resets the target. DTR would be useful to reset the programmer when it hangs.

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

I just tried it by guesswork.   I presume that it does the appropriate open/close.

I don't care.    I just wanted to "exercise" CodeVision with NANO-EVERY hardware.

 

It is handy to use the CodeWizard for AVR8X and Xmega chips.

I tend to just write Mega code from scratch.

 

Using the EVERY soon finds incompatibilities in Arduino libraries.

Although the WiFi Rev 2 has been available for a while it has not attracted many users (yet).

 

David.

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

Apparently they ported my code jtag2updi to run on the SAMD11.

Neat!

I hoped something like this would happen when I wrote the program. I even used MIT license instead of GPL to make it more attractive for commercial use.

Thank you for using the permissive license.

Despite the license, and the relatively significant work probably involved in porting to SAMD11, it would have been nice if they had told you they were doing this.  IMO.

 

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

westfw wrote:
(...) it would have been nice if they had told you they were doing this.

 

Well, yeah. But in this day and age, certain people are only polite if legally bound to be so. Sad, but not surprising.

Anyway, the MIT licence must be distributed with the software. So I hope they at least remembered to burn it somewhere in the corner of the SAMD11's flash...

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

David,

 

have you found any information as to which pins on the 4809 are accessible on the Every? For the life of me I cannot find a schematic or other detailed info.

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

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

@Brian,

 

The EVERY is just produced as an Arduino.   You can only program via the SAMD11 jtag2updi route.

 

The pinout is in the pins_arduino.h e.g.

C:\Users\David Prentice\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.1\variants\nona4809\pins_arduino.h

However the Analog pins are wrong in the v1.8.1 Release.   v1.8.2 is due to be released soon.

 

I have attached the corrected version from the Beta on GitHub.

 

I believe you bought a WiFi Rev2 board.   I have only got Nano-Every boards.

Most Arduino projects just build and run.   Some libraries require the odd tweak.

 

It is nice to be able to build and run Codevision programs (via a .BAT file)

I have had a 4809-XPRO for some time but it is good to use the EVERY with an official pinout.

 

David.

Attachment(s): 

Last Edited: Tue. Jul 2, 2019 - 04:07 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi David,

 

thanks.

 

Yes, I do have some WiFi boards but the EVERY seems to be a nice way of using a 4809 'as bare metal as you can get' short of soldering up a naked chip.

 

And, like you, being able to do things inside CVAVR appeals to me.

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

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

 

I am a Shield person.   I put external electronics on shields.

 

I bought a Nano Adapter from Ebay and soldered stackable headers to raise the shield above the Nano-Every

and have ordered this one which has the 3x2 male SPI header and standard Wire header sockets

I also hand-wired an Every to a Protoshield which gives regular Uno+Shield dimensions.

 

Buying ready-made adapters is the quickest way to swap external electronics when prototyping.

 

You might prefer soldering an Every directly to Protoboard for prototyping a project.

 

David.

 

Last Edited: Wed. Jul 3, 2019 - 09:18 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ah, I found the source code for the SAMD11 firmware the Arduino devs use for the Nano Every interface chip:

 

https://github.com/arduino/Ardui...

 

It's based on my code, alright, but I don't see a copy of my licence, maybe I didn't search well... riiiight...

 

Anyway, it's a bit sloppy job, they even left code that is AVR assembly (obviously never gets compiled).

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

Offer them advice.
Or tidy it up and send them a Pull Request.
.
I would agree that it is nice if someone asks or just acknowledges your work.
But at the end of the day, I would not lose any sleep over it.
.
The Arduino code is Open Source. And has a consistent Release strategy. So any improvements get into a Release. And the Board Manager will tell you whether an Update is available.
.
Third parties sometimes distribute code that they have hacked (quite legitimately) from an obsolete version of your code.
It is much safer if you can just install up to date libraries (or core) directly from the IDE.
.
I am sure that the Megaavr Core developers would appreciate your help.
.
David.

Last Edited: Thu. Jul 4, 2019 - 01:07 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
I am sure that the Megaavr Core developers would appreciate your help.

 

Yeah, I may help them latter, but first I'll wait for the code to mature a bit, it has only been posted for 1 month. If I see they don't do any cleanup after a while, I will contribute.

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

They are intending to issue a new Release shortly.   I only replaced the pins_arduino.h from the Beta.

 

You probably noticed my whinge about Third parties.

 

I would be happy to assist "Open-Smart" with support for unusual obsolete TFT controllers.

I have hinted.    They do not even acknowledge.    I would just prefer that if they want to distribute "out of date" code they chose a different class name.

 

OTOH,   other commercial companies are polite.

For example.   Adafruit write a lot of Open Source code that gets hacked.    But they will respond to issues. suggestions and Pull Requests.

This is all to the good of the worldwide Arduino community.    RPi and MBED benefit from Adafruit too.

 

David.

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

UDPI on chips with a dedicated UPDI pin (like the 4809) doesn't even require access to RESET to work, right?
You can use the RESET pin as IO, and still be able to reprogram the chip (unless you've specifically disabled UPDI in the lock bits)?

 

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

Yes, UPDI has nothing to do with RESET on those parts, and you cannot disable the UPDI pin or use it for something else. 

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

You can't access the UPDI pin on the EVERY board. You have no choice but to use the SAMD11 bridge chip.
Fortunately this is possible with (a modified) avrdude via a .BAT file.
.
David.

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

Brian Fairchild wrote:
For the life of me I cannot find a schematic or other detailed info.

Arduino Nano Every

[schematic now in Documentation tab]

due to a new arrival at Mouser

Nano Every - Arduino | Mouser

current Mouser stock is in the mid-50s with a 5w lead-time.

 

P.S.

sale at Arduino

Arduino Official Store | Boards Shields Kits Accessories

[multiple Special Offer]

 

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

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

The Nano Every and the Mega4809 Curiosity Nano are so similar that it's difficult to decide which is better. I suppose it depends whether you want to work with the Arduino IDE or with Microchip's tools.

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

Counted the number of unconnected mega4809 pins in the Arduino Nano Every schematic.

 

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

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

I count 14 unconnected I/O pins, about 1/3 of the total. Yeah, it's a waste.

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

No for the required form in fit, form, and function.

🗿

 

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

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

https://youtu.be/8GLXSebQVCE?t=1209

...

The Nano Every is a Dinosaur because it had to be compatible

...

in Four new Arduino Nano Boards: Test and Comparison (Every, 33 IoT, 33 BLE, 33 BLE Sense) - YouTube (22m14s)

 

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