Atmel Studio 7 and Arduino Nano Every

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

Hi,

my intention is to use AS7 and ATMEL ICE to write and debug software for ATmega4809 using the libraries from Arduino.

My first step is to start with Arduino Nano Every (ATmega4809).

I have a sketch Blink.ino from Arduino IDE.

Now I want to import this sketch in AS7 with all the libraries.

I open AS7 - File - New project - Create project from Arduino sketch - 

The problem is that in the Board list there isn't ARDUINO NANO EVERY, so I can't select the Device ATmega4809.

 

Thank you for suggestions.

 

Livio

 

P.S. AS7 is the last version: 7.0.2397

 

Last Edited: Wed. Jan 22, 2020 - 01:59 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You must install the Arduino megaAVR core.   e.g. via the IDE Boards Manager.

 

Then you can write regular Arduino programs as Nature intended.    The official libraries should all work.    Sketches compile, upload via bootloader, run in the normal way.

 

You might have difficulty with some third party libraries.   If you do,  write a message on the Arduino Forum.    Then those library authors might update library versions to support the EVERY.

 

I see little point in using AS7.0 unless you are VERY familiar with AS7.0 and importing Arduino sketches.

The Arduino IDE is a safer choice.

 

If you just want to learn about the ATmega4809,   buy a Curiosity Nano.    It has everything you need.   Onboard debugger,   USB Serial,   access to most 4809 pins.

 

Yes,  I have run non-Arduino programs from AS7.0 that upload and run on NANO-EVERY boards.

 

David.

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

Thank you David for your answer.

I want to use AS7.0 instead of Arduino IDE because I have the Atmel ICE and I want to make a debug with breakpoints etc.

I have already used AS7 with ATmega2560 and Atmega2561, both with Arduino libraries.

Now my difficult is to set a project in AS7 with all the files that Arduino IDE use to compile a simple example as led blink.

Now I have the 40 pins ATmega4809 on a breadboard connected to ATMEL ICE, this is working, I can read the device signature (0x1E9651).

The problem is to have in the window Solution Explorer all the files (from Arduino IDE) I need to compile a simple example.

Livio

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

Importing to AS7.0 for Zero or Due definitely does NOT work.

 

I will attempt to import an Arduino project for NANO-EVERY (which has a microscopic UPDI pad)

and also for NANO-THINARY (which has a pin for UPDI and AT4808)

 

You are familiar with importing a project for Mega2560 (JTAG loses some Arduino Analog pins)
 

David.

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

I tried importing an empty sketch for NANO-EVERY to AS7.0

 

The build fails due to <string.h> and "String.h" anomalies (I think)

 

It looks as if AS7.0 has imported the correct set of source files for ArduinoCore.

I suspect that the header file problem is something trivial.   But I have not investigated.

 

Life is much easier if you let the Arduino IDE build the project.elf and use AS7.0 to "Open Object File for Debugging"

You can use ATMEL-ICE, PICKIT4, SNAP to communicate with the ATmega4809 via UPDI.

 

David.

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

 

I thank you very much for your time.

I followed your suggestion to use "Open object file for debugging" and now I can upload the code inside ATmega4809 on the breadboard with ATMEL-ICE via UPDI.

Now I have to investigate if I can use this way of working even with a more complex project than a blink.

Thanks again.

Livio

 

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

Solved.

Now I have a project in AS7 that can blink a led on an ATmega4809 (40 pin dip version on a breadboard) connected wit ATMEL-ICE via UPDI.

 

The step to do this are:

 

- Download the files from  https://github.com/arduino/ArduinoCore-megaavr and from  https://github.com/arduino/ArduinoCore-API

 

- On AS7 I open a new GCC  C++ Executable Project and I inserted the files found on Github in the project.

- In main.cpp I inserted the code to blink a led connected to pin 21 (PE2).

 

It works !

 

Livio

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

Hi Livio,

Sorry to be dense, but if you could give some more detail of exactly how you "inserted the files found on GitHub in the project" or upload a zip of your project it would really help me. I am bringing up a complex program I had working on PIC but ported to Arduino on a AVR128DA28 chip. I desperately need a debugger. Using the DxCore from SpenceKonde. I can compile and run using the Arduino IDE. AS7 won't import my sketch because it doesn't recognize any third party cores. 

 

This looks like a perfect solution. I never liked the idea of the "automagic" AS7 sketch import anyway, this site is full of examples where the auto wasn't magic and the thing didn't work.

 

Thanks in advance,

Bill

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

Well if it is Spence Konde's DXCore you want then I guess you would go here:

 

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

 

and get those files (they are probably already on your drive anyway if you have added the core to the Arduino IDE). Then put them all in your AS& project directory and add all the .c and .cpp to your project.

 

(if you wanted to get real fancy, in an AS7 solution you could actually create two projects. One for your project executable and one for a static library - perhaps call if "libcore" - then add the core files to the static library. Have it build to create libcore.a then just have this as a linker input for your actual project- but the only real advantage of this is that it would let you keep the DXcore files in a separate, more upgradeable/maintainable place than if you mixed them in with your own project files).

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

Looks like these files:

https://github.com/arduino/ArduinoCore-API  

Are already included in Spence Konde's DxCore. 

 

You have to set up the build environment, i.e. the list of includes and all the #defines in order to use any Arduino Core. Normally this is done when a sketch is imported. But because DxCore doesn't show up for AS7 Arduino imports trying to import my sketch fails. This is why I ditched the tool in the first place...

 

I think to blink an LED a lot of this is unnecessary. But if you want to use all the bells and whistles on the chip then it is. 

 

I am trying to work around this debugger thing to get the project out the door. If push comes to shove I may have to revisit now instead of later. Any comments on what I wrote above appreciated.

 

Best regards,

Bill