Arduino Due on a Breadboard
Moderators: adafruit_support_bill, adafruit

Re: Arduino Due on a Breadboard

by ajienikicio on Fri Aug 30, 2013 12:30 am

Alright then, sorry for the misunderstanding.
Thank you so much, Rick! I'll test the chip along with the other supporting components on a perfboard soon and connect it to atmel studio. I will get back to you again soon if you don't mind :)
ajienikicio
 
Posts: 24
Joined: Tue Aug 27, 2013 11:20 pm

Re: Arduino Due on a Breadboard

by ajienikicio on Fri Sep 13, 2013 1:21 pm

Hello again Rick and thank you so much for the earlier replies!

I've assembled a prototype board based on an AT91SAM3S4A, and my current plan is to work on the software (C language based) using Atmel Studio via JTAG.

Could you please give me some suggestions on starting working on the software using Atmel Studio? Maybe something like where I should start from, getting the necessary libraries etc.

Thanks :)
ajienikicio
 
Posts: 24
Joined: Tue Aug 27, 2013 11:20 pm

Re: Arduino Due on a Breadboard

by adafruit_support_rick on Fri Sep 13, 2013 1:50 pm

You can download Atmel Studio from here:
http://www.atmel.com/microsite/atmel_studio6/

When you first start it up, it will display a "Start Page" with loads of links to help you get started. There is also an "Extensions Manager" where you can download and install additional tools you might find handy.

But I believe the main download comes with the Atmel Software Framework (ASF) already installed, but if not, you can add/update it through the Extensions Manager. The ASF contains sample code and drivers for all sorts of Atmel processors. You can browse through it and pick the ones you want to experiment with.

You might want to think about picking up a SAM3S evaluation kit from Atmel. It can be difficult to get started with using new software on an untested hardware platform. If it were me, I'd use an eval kit to get up to speed on Atmel Studio, before I tried to develop anything on new hardware. The Eval kits generally come with example software and peripheral hardware to help you get going.
SAM3S Evaluation Kits

adafruit_support_rick
 
Posts: 13801
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Arduino Due on a Breadboard

by ajienikicio on Sat Sep 14, 2013 8:55 am

Yes I've thought about getting Atmel's evaluation board, but unfortunately I have a time constraint and so I decided not to get one. Well instead, actually I'm testing some codes on Arduino Due using the Atmel Studio soon. As it uses a similar chip, I think it's also relevant this way.

For my custom board design I've always mentioned, I copied most stuffs (clock circuit, jtag, decoupling caps) from Atmel's evaluation board and Arduino Due schematics, and in addition to that, I double checked with this particular note called the Schematic Check List (http://www.atmel.com/Images/11061.pdf). So currently I don't think there is a critical need to get Atmel's eval board.

But actually I am concerned about this particular information given inside the note. It's about the decoupling caps (page 3). It says: "Warning: At power-up VDDIO needs to reach 0.6V before VDDIN reaches 1.0V". How do I verify this? Will the chip be damaged if the warning isn't satisfied?
ajienikicio
 
Posts: 24
Joined: Tue Aug 27, 2013 11:20 pm

Re: Arduino Due on a Breadboard

by adafruit_support_rick on Sat Sep 14, 2013 11:27 am

ajienikicio wrote:But actually I am concerned about this particular information given inside the note. It's about the decoupling caps (page 3). It says: "Warning: At power-up VDDIO needs to reach 0.6V before VDDIN reaches 1.0V". How do I verify this? Will the chip be damaged if the warning isn't satisfied?

I don't know for sure, but I kind of doubt that the chip will be damaged. More likely, it just won't run properly. The way you would observe the timing to verify the sequence is with a dual-trace oscilloscope.

adafruit_support_rick
 
Posts: 13801
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Arduino Due on a Breadboard

by ajienikicio on Sat Sep 14, 2013 11:51 am

Alright thanks! I'll just go ahead using an oscilloscope then. I was afraid if I power my board up, the chip will be damaged, as to use the oscilloscope, the board has to be powered up anyway.

I have another issue, again on the software part. I'm planning to use JTAG (SAM-ICE) to load codes into my board, and if I plug off the JTAG cable, the software needs to stay in the chip and run whenever I trigger a reset.

Noting the above requirement I mentioned, can I use the Atmel Studio (along with its Atmel Software Framework) directly and run an application e.g. control an LED?
ajienikicio
 
Posts: 24
Joined: Tue Aug 27, 2013 11:20 pm

Re: Arduino Due on a Breadboard

by adafruit_support_rick on Sat Sep 14, 2013 12:50 pm

The JTAG pod will always load your code into the on-chip flash memory. The code will execute whether the pod is connected or not.

You may be thinking of an In-Circuit Emulator (ICE) - that's not what JTAG is.

adafruit_support_rick
 
Posts: 13801
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Arduino Due on a Breadboard

by ajienikicio on Sat Sep 14, 2013 9:22 pm

You may be thinking of an In-Circuit Emulator (ICE) - that's not what JTAG is.


But doesn't the ICE function just like any other JTAG pods? According to the application notes I can use this to program my board. What kind of JTAG pod have you been using with Atmel Studio then?
ajienikicio
 
Posts: 24
Joined: Tue Aug 27, 2013 11:20 pm

Re: Arduino Due on a Breadboard

by adafruit_support_rick on Sun Sep 15, 2013 9:10 am

I use the JTAGICE3 with AVR parts and the SAM-ICE with ARM.
In spite of the "ICE" in the names, these are not in-circuit emulators. Real ICEs physically replace the CPU with an interface chip.

JTAG is a high-speed serial interface built directly into the ARM processor. Through this interface, the JTAG pod can monitor the current state of the processor, including the current instruction address. When you set a breakpoint, the pod can detect when the processor is about to execute that instruction, and it can halt the processor. The JTAG interface also allows the pod to read and write memory, CPU registers, and I/O registers. So that's how it can load your code into the processor's flash memory.

But it doesn't replace the processor in any way - it just has a privileged window into the inner workings. When you disconnect the pod, the guy looking over the its shoulder goes away but nothing else changes for the processor.

adafruit_support_rick
 
Posts: 13801
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Arduino Due on a Breadboard

by ajienikicio on Sun Sep 15, 2013 3:04 pm

I see. So I can use my SAM-ICE then!

But I'm still confused. Can I code into my SAM3S directly? Because it doesn't have anything inside yet.
I found some atmel's application notes on things like SAM-BA, ISP, GNU software package, IAR EWARM, etc. Do I really need to touch on these before I can code in Atmel Studio?
ajienikicio
 
Posts: 24
Joined: Tue Aug 27, 2013 11:20 pm

Re: Arduino Due on a Breadboard

by adafruit_support_rick on Sun Sep 15, 2013 3:15 pm

All you need to do is download Atmel Studio and start coding. There will be samples in there that you can start with.

adafruit_support_rick
 
Posts: 13801
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Arduino Due on a Breadboard

by ajienikicio on Wed Sep 25, 2013 8:11 am

Hello again Rick!

I've managed to blink an LED using my custom board. But I found some problems and need to debug the lines of code. Is it possible to use a sort of printf function to print stuffs to the window? Is this achievable with the SAM-ICE?
ajienikicio
 
Posts: 24
Joined: Tue Aug 27, 2013 11:20 pm

Re: Arduino Due on a Breadboard

by adafruit_support_rick on Wed Sep 25, 2013 11:16 am

Not need at all for printf debugging. With your JTAG pod, you can set a breakpoint in the code, and then single-step through each line of your program. You can look at the current values of all of your variables.

In the top menu bar, you should see a dropdown box where you can select either "Debug" or "Release". Set it to "Debug".
atmel_studio_debug.png
atmel_studio_debug.png (32.34 KiB) Viewed 636 times


In your code window, there is a vertical gray bar along the left side. Click in there, and a red dot will appear. That is a breakpoint. Your code will execute until it reaches that point, and it will pause there.
atmel_studio_breakpt.png
atmel_studio_breakpt.png (18.59 KiB) Viewed 636 times


Use the 'Step Over' button to execute the instruction, and pause at the next instruction
Use the 'Step Into' button to step into a function, and pause at the first instruction
Use the 'Step Out' button to step out of a function, and stop at the next instruction after the function call.
Set the cursor on a statement, and then click the 'Run To Cursor' button to run to that statement with the cursor and pause there.
Click the 'Start/Continue' button to resume normal execution (and stop at the next breakpoint).

You should see some windows with debug information. You should be able to select 'Locals', 'Auto', 'Memory', and a few others.

'Locals' will list all of the variables currently in scope, and their values. Structures will have a little '+' icon - if you click that, the structures will expand so you can see the contents.

'Auto' shows you the variables associated with the current instruction.

'Memory' allows you to see the current contents of any memory address, including eeprom, SRAM, and flash. You can modify the contents of SRAM.

There will also be a window where you can inspect and modify all of the CPU registers, and another where you can inspect and modify all of the I/O device registers.

adafruit_support_rick
 
Posts: 13801
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Arduino Due on a Breadboard

by ajienikicio on Wed Sep 25, 2013 10:20 pm

Thanks for the detailed explanation!

Yes I actually tried using the breakpoint etc. I'm gonna need to get myself used to it.

I'm having this problem: I noticed that my code always enters the dummy_handler function inside exceptions.c before entering the loop i.e. while(1). But I managed to blink my LED without the use of the loop.
Do you know what may have caused the code to hang inside the dummy_handler?
I'm still in the process of troubleshooting my code though.

I think I have properly selected the libraries required, as I followed the Getting Started Example of the SAM3S-EK2 and the Arduino Due, except that at the beginning of making a new project, I selected the device to be SAM3S4A (which is what I'm using)
ajienikicio
 
Posts: 24
Joined: Tue Aug 27, 2013 11:20 pm

Re: Arduino Due on a Breadboard

by adafruit_support_rick on Thu Sep 26, 2013 9:24 am

I guess I'd have to see your code. But it sounds like you are throwing a run-time error and going into the default exception handler.

adafruit_support_rick
 
Posts: 13801
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY