Pages: [1]   Go Down
Author Topic: Atmel Studio With Arduino Due  (Read 6827 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have just started using Atmel Studio with Arduino Due board. I have installed the latest ASF(Atmel Software Framework). When I then start a new project I can choose arduino due board. I am trying to use C code to turn on a led but I get error. Why can't I use the IODIR or IOCLR?


   IODIR = led;
   while(1){
      IOCLR = led;
   }
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi arduino2012,

you find a good "getting started" on youtube.

Atmel Software Framework, Getting Started, Part 1


Atmel Software Framework, Getting Started, Part 2

Logged

Germany
Offline Offline
Jr. Member
**
Karma: 0
Posts: 57
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello arduino2012, I give you a fair warning. This stuff is not for the heart-fainted. The whole architecture of the software is totally different to the previous Arduinos like 328 amd Mega. While reading the data sheet (>1400 pages!) for the SAM3X8 even the single parallel IO scared the heck out of me. It took me several hours (working with AVR/PIC for some years now) to fully anderstand the rationale of the SAM I/O.

Not before the user has taken a approach of some in-depth programming, he realises what our italian overlords have created with the convinience of the Arduino IDE...
« Last Edit: March 01, 2013, 03:50:18 pm by Transistorfips » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My criteria for wanting to use the Atmel Studio IDE with the SAM3X is you've got the lovely exquisitely "just works" Arduino IDE humming and its just taking toooooo long to compile those expanding programs ....
AND you want some symbolics with a JTAG
AND you've read a goodly portion of the SAM3X manual and you really really REALLY want to try out some of those features that are implemented in hardware  with all your other modules
AND using the Arduino IDE & your favourite editor is just so frustrating navigating Arm Toolchain directories

THEN
the Atmel IDE is worth digging into - and its got a very nice helper to dig through all the .h files in the ARM environment to help you.
Also the ASF gives you an idea of what can be done with the hardware, and of course the objective is to write a C++ object to make it all work.
BUT the Atmel Studio is built has its own quirks, built on M$ Studio
and you have to learn (and praise/curse/grin/growl about) the ARM architecture - now why do so many people like it, of yes its common across all the modern processors.
...........a 2cents throwaway
« Last Edit: March 04, 2013, 10:50:35 pm by neil12 » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the information you gave me.

I have a question. Do I need a bootloader to run Arduino Due with Atmel Studio. How come I need a bootloader because when I start a project I choose ArduinoDueBoard. Doesnt Atmel Studio automatically choose a bootloader when I start the project with Arduino Due board?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi arduino2012,

you can use this
http://arduino.cc/forum/index.php/topic,151223.msg1138871.html#msg1138871
bat-file for flasching your arduino due board.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 44
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi!
How did you setup your project?
I am trying to set up a compiling project for two days now - without success.
First i tried the "Arduino Due/X - ATSAM3X8E" C/C++ template delivered with Atmel Studio. This creates a main.c and in the project properties only the c compiler is listed. I'd like to use the Arduino-library. Therefore i need a C++ compiler (right?). Any suggestions how to get him in there? Do you know what the template configueres?
---Didn't get the C++ compiler in smiley-sad so i tried setting up a custom project

I started with the "GCC C++ Executable Project" Template and choose the ATMSAMX38E as device. Now i see the C++ compiler in the project properties. He got some additional informations:
- the directories /variants/arduino_due_x, /system/libsam, and /sam/cores
- the symbols ARDUINO=152, and F_CPU=84000000
- the linker to the libcore.a - compiled for the Programming Port Arduino Due
- i copy pasted the content of the Arduino-Software compiled .cpp into the main.cpp
---> and end up with 5 errors: "use of enum 'adc_resolution_t' without previous declaration", "use of enum 'adc_channel_num_t' without previous declaration"...in adc.h.
So i visited adc.h and found a lof of lines like: "#if SAM3S_SERIES || SAM4_SERIES || ...." followed by definitions of the variables described in the errors. Could it be that i need to tell my code somewhere else that i use a SAM3X8E?

I got quite stuck here. Does anyone else have similar problems?
Thank you for your help!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I found this as well and posted my fix
http://arduino.cc/forum/index.php/topic,134907.msg1144567.html#msg1144567

The fix seems to be change AS6 to be the sames as the arduino-1.5.1r2 in
C:\Program Files\Atmel\Atmel Studio 6.0\extensions\Atmel\ARMGCC\3.3.1.128\ARMSupportFiles\Device\ATMEL\sam.h
/* Entire SAM3XA series */
#define SAM3XA_SERIES (SAM3X4 || SAM3X8 || SAM3A4 || SAM3A8)
from
#define SAM3XA_SERIES (SAM3A4 || SAM3A8)

I got it from
\My Documents\Arduino\arduino-1.5.1r2\hardware\arduino\sam\system\CMSIS\Device\ATMEL\sam.h
/* Entire SAM3XA series */
#define SAM3XA_SERIES ( SAM3X4 || SAM3X8 || SAM3A4 || SAM3A8)
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 44
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi!
Thank you neil for your advice!
I got rid off the "no previous declaration" errors! smiley
But.... smiley-sad
Now i am facing 58 errors like: undefined reference to 'GetTickCount' in wiring.c, undefined ref. to 'PIO_GetOutputDataStatus' in digital_wiring.c...and so on.
I only include Arduino.h like in the temporary compiled cpp from the arduino sdk.
Please help me out! This is so demotivating! I really don't know what i am doing wrong!
This was so easy with Uno...i did it many times without these strange probs....i am looking forward to loading the code up from atmel-studio...  smiley-cry
Can't somebody post a compiling example-atmel-solution?
That would be great!

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi!
Thank you neil for your advice!
I got rid off the "no previous declaration" errors! smiley
But.... smiley-sad
Now i am facing 58 errors like: undefined reference to 'GetTickCount' in wiring.c, undefined ref. to 'PIO_GetOutputDataStatus' in digital_wiring.c...and so on.
I only include Arduino.h like in the temporary compiled cpp from the arduino sdk.
Please help me out! This is so demotivating! I really don't know what i am doing wrong!
This was so easy with Uno...i did it many times without these strange probs....i am looking forward to loading the code up from atmel-studio...  smiley-cry
Can't somebody post a compiling example-atmel-solution?
That would be great!



I second this, I still am unable to get Atmel Studio to compile with the Arduino libraries.
Logged

Austin, Texas, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Has anyone figure this one out. I'd really love to be able to use Atmel Studio with my Arduino!
Logged

Iowa
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

There is an add-in for Atmel Studio called Visual Studio (free).

I have tested it with the Due, Uno, Mega 2560 and it works fine.

Since the 1.5 is still beta there may be some issues with the Due, but I haven't had any yet. I'm still trying to decipher the timers and counters on the Due.

Check it out http://VisualMicro.com

It also has a pretty cool software based debugger with it.
« Last Edit: May 29, 2013, 11:40:42 pm by garballz » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sir I  dont want Visual Micro as its not possible to do hardware debugging with it....
Can you please provide any link which gives us atmel to use for arduino due...
I am using Atmel studio 6.1 with Arduino IDE
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 55
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Try doing everything with CooCox. Don't get me wrong, Arduino is great, but I find that when you need help with non arduino stuff, the AVR forum is full of people on high horses and the arduino forums is sort of limited (do not get me wrong, lots of talent here). That said, I find Atmel manuals harder to understand than PIC manuals. I can only imagine what it would be like with ARM stuff.  Also, with CooCox, you will be able to go beyond just Atmel chips (although, you will be limited as to what JTAGS you can use).....the only issue is that it is open source, so  you will have to manually do the tool chains, but you will have a greater understanding of what is really going on so when you circle back to Atmel Studio, everything becomes so easy because it is done for you.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I found this as well and posted my fix
http://arduino.cc/forum/index.php/topic,134907.msg1144567.html#msg1144567

The fix seems to be change AS6 to be the sames as the arduino-1.5.1r2 in
C:\Program Files\Atmel\Atmel Studio 6.0\extensions\Atmel\ARMGCC\3.3.1.128\ARMSupportFiles\Device\ATMEL\sam.h
/* Entire SAM3XA series */
#define SAM3XA_SERIES (SAM3X4 || SAM3X8 || SAM3A4 || SAM3A8)
from
#define SAM3XA_SERIES (SAM3A4 || SAM3A8)

I got it from
\My Documents\Arduino\arduino-1.5.1r2\hardware\arduino\sam\system\CMSIS\Device\ATMEL\sam.h
/* Entire SAM3XA series */
#define SAM3XA_SERIES ( SAM3X4 || SAM3X8 || SAM3A4 || SAM3A8)


Hi,

I got this working. First off... ignore what he said above, don't modify the Atmel include files, just add the path to the sam.h file in the arduino structure, and remove the default paths from the list. If you build the Blinky sample application in Arduino IDE with verbose output enabled, you can get all the include paths needed to build with. (they begin with -I)

To get rid of the "GetTickCount" undefined references, you need to add a second library to the same location as you put your core.a file. This file is libsam_sam3x8e_gcc_rel.a and you can get it's location from the buildprefs.txt file located in the temporary build folder where you copy the core.a file from.

Then... it should build... at least mine did.
Logged

Pages: [1]   Go Up
Jump to: