Show Posts
Pages: 1 [2] 3 4
16  Using Arduino / Programming Questions / Re: Quesiton about how to not block processor execution when programming on: March 06, 2013, 05:12:03 pm
I think you would need at least a different variable to record previousMillis for red and blue LEDs.
17  Using Arduino / Microcontrollers / Re: Arduino on ATSAM4E16E on: March 04, 2013, 11:23:56 am

This response, and really the question that prompted it is where I'm lacking on the knowledge front mostly. Just taken a look at the Jlink unit (, so - are devices like that programmers, or just debuggers for the JTAG interface? (JTAG is something I've never worked with before either)

If yes, do they program over an SPI interface the same as the AVR ISP does with the 8bit AVRs?

JTAG is a general purpose test/debug interface, it includes a serial interface like SPI. It allows "back door" access to any CPU register or address bus, and also to an on-chip debugger. This allows breakpoints, watchpoints to be set, and allows interruption of the CPU execution so that external access can be made. So you can do a lot of things, including programming internal and external flash, debugging.

Saying that, I can't seem to find the 4E chips for sale by any of the big vendors in the UK. Or anywhere outside of the UK for that matter...
Seems like the Atmel Cortex M4 parts are still fairly new.
18  Using Arduino / Microcontrollers / Re: Arduino on ATSAM4E16E on: March 03, 2013, 06:21:58 am
Why SAM4E?

A number of reasons;

- integral FPU
- largest SRAM & flash of all the ARM MCUs
- highest number of timers

The Cortex M4 parts are pretty beefy, and price not much greater than Cortex M3, so I see the attraction.

I've just taken a look in the ASF documentation - whilst the SAM4E-EK board is not supported, the SAM4E devices themselves are, and the typical features present on the eval boards such as LCD displays, QTouch etc are not features i'm remotely interested in using. The target application for my personal dev board is automated control applications, without the need for screens etc.

Ah, my mistake, I was looking at older version of ASF. The latest ASF has SAM4E stuff in. One thing Atmel are pretty good on, is documentation, examples, reference designs, framework code, etc, and they make it all easy to get hold of. So if I was starting with a new design, Atmel is a good choice from that point of view. I actually prefer NXP or ST ARM chips over Atmel, but Atmel ARM chips are good enough.

Perhaps as you mention - working with the SAM3X in my own board first would be a better option, as a revision down the road to switch to the SAM4E would be less of a jump, but then again - my board design currently uses a AVR 2560, so that board revision from AVR to SAM3X would be enormous as is, so it seems to make logical sense to jump straight to the intended device.

I wouldn't necessarily recommend SAM3X as first option, I was thinking more of something like SAM3S. I am a believer in incremental change, or at least starting with something that is known to work. I would generally start with an off the shelf eval board, and find an IDE with a project ready for the board (setting up all the project options is tricky enough). Then I go to my own hardware, a different toolchain, and create projects from scratch.

If you can find the right eval board, extra cost incurred may be only a few $. Official manufacturer eval kits tend to be stupidly expensive, with a few notable exceptions (e.g ST Discovery boards) but there are people like Olimex who create low cost options. If you need to run a sample project built for IAR, Keil etc, there are usually free/limited "lite" versions you can use, but for Atmel you probably don't need to look further than Atmel Studio.

This switch isn't planned for probably 9 months, I'm just looking to get thoughts into it - but ultimately how to upload to the SAM devices from Atmel Studio, like I say - I've only ever worked 8-bit with the AVR ISP MkII programmer. (or of course the Arduino IDE)

Atmel Studio + Segger Jlink EDU version is a great combo for bare metal programming. The ASF provides a pretty useful peripheral library, but not as easy to use as Arduino libraries.

Maybe what I said sounded a little too negative, Cortex parts are relatively easy to use, though still a step up from AVR. There has never been a better set of freely available tools and resources to help designers. So go for it, just beware there may be a fairly steep learning curve. Some people enjoy the challenge, and if motivated it's not a problem.
19  Products / Arduino Due / Re: Compiling Error for DUE, but not for MEGA ? on: March 02, 2013, 09:45:06 pm
Interesting, seems to be a bug in the GCC code, reent.h should have "#ifdef DEBUG"?

I'm slightly puzzled as to why this problem does not occur more often, it seems like it should happen whenever DEBUG is not defined.
20  Using Arduino / Microcontrollers / Re: Arduino on ATSAM4E16E on: February 28, 2013, 06:56:12 pm
Why SAM4E?

If you've never used a 32 bit before, designing a new board with a SAM4E may be a little ambitious. Getting SAM4E to work with Arduino IDE is not a trivial exercise. I think you would be better off with Atmel Studio. Normally I would suggest using the corresponding eval board as a reference, but there appears to be no support for SAM4E-EK in the ASF yet, and setting up for a custom board is not a trivial exercise either.

I would strongly recommend starting with something more widely supported with documented samples to start with. For a first project, get familiar with the toolchain, the IDE, the driver libraries and the chip capabilities first, then you will be in a much better position to branch out with a custom design.
21  Products / Arduino Due / Re: Looking for a cheap JTAG adapter on: February 25, 2013, 07:17:11 pm
I've not found any cheap JTAG adapters to be very reliable, and usually take a good deal of effort to work at all. For some combinations of OS, software, drivers and hardware they can work well, but it seems pretty hit and miss.

The professional level JTAG adapters are usually pretty reliable, some are better than others, but to get that quality for a specialist product inevitably costs money. It depends on how you value your time, but I do a lot of embedded programming so I prefer spending the money for the ease of use.

With Atmel, we are in luck, because there is an Atmel version of the Segger J-Link, which are pretty good and widely supported, and the Atmel version is considerably cheaper than the full Segger J-Link. I believe they work with OpenOCD and Atmel studio. There is an "educational" version of Segger J-Link as well which is cheaper than the full version.

For the 20 to 10 pin adapter, these can be got from ebay for a few $, Olimex also do one for €5.
22  Products / Arduino Due / Re: AVR Library with Arduino Due? on: February 23, 2013, 08:14:06 am
I am still puzzled by what you mean by the "AVR library".  There are many AVR libraries, do you have a specific one in mind?
23  Products / Arduino Due / Re: Confusion as to which header to use for SPI on Due - ICSP or SPI on: February 20, 2013, 06:58:40 pm
On the Due use the header marked SPI for SPI smiley-wink I think the ICSP is for the 16U2 only, could be wrong.
24  Products / Arduino Due / Re: Arduino IDE direct to different MCU in SAM3X family? on: February 20, 2013, 04:29:49 pm
You raise an interesting question, I was also considering use of Arduino IDE for different CPUs.

So in the end the question boils down to whether or not I can make the present IDE seamlessly play nicely with different SAM3 processors.

As you used the word "seamlessly", the easy short answer is no.  smiley Only chips from the same family are likely to be that similar, even there they may be significant differences. In order to create a smooth experience for the user, the platform has to be carefully designed with portability in mind, and the user and any third-party library writers very careful not to bypass the APIs and access peripherals directly. For small microcontrollers most people don't want to take that route, and tend to code specifically for their target chip.

For a limited subset, and for your own use, you should be able to create the required drivers to run your project on different chips but there is going to be a lot of porting involved, and ongoing effort for any additional library you want to use.

I would suggest the best bet to retain the most compatibility with Arduino IDE is with the SAM3X4C, but I haven't looked into specifics. If you want go outside of Arduino, then I would look closely at building a framework on something like ChibiOS.

I was going to suggest that someone might produce a "Due module", like the Arduino Micro, but just looking at the Due there is not a lot of opportunity for size reduction.

25  Products / Arduino Due / Re: Project targeting AVR and Due on: February 17, 2013, 10:05:09 am
Thanks Jim, that's worth noting.

Of course, I have "unstated requirements"  (aren't there always? smiley) I want to share my project via github, so can't make assumptions about where files are located.

For the moment, I will try to create a makefile project which uses the Arduino toolchain, and maybe figure out how to make it IDE compatible later.

Just as a little background, I am porting RepRap 3D printer firmware to Due. Currently most Repraps run on Arduino or AVR variant, and the existence of the Arduino platform has been a great help to Reprap. I am hoping that success will continue with Due.
26  Products / Arduino Due / Re: Project targeting AVR and Due on: February 16, 2013, 12:08:18 pm
Ok, the answer is kinda obvious, the IDE copies source files from the sketch directory to a temp folder, and compiles there. So any subfolders from the sketch folder do not exist in the temp folder.

Seems like the only way to do something similar is with libraries, but that is not a satisfactory solution. I think that the Arduino IDE is probably not a suitable tool for me.
27  Products / Arduino Due / Re: Project targeting AVR and Due on: February 16, 2013, 11:37:58 am
I can't this to work. My sketch is:

#include "sub/mydriver.c"

void setup() {
  // put your setup code here, to run once:


void loop() {
  // put your main code here, to run repeatedly:

sub/mydriver.c :
int  myfunc (int a)
return a*a;

The compiler output is :
C:\Programs\arduino-1.5.2\hardware\tools\avr\bin\avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -MMD -mmcu=atmega1280 -DF_CPU=16000000L -DARDUINO=152 -IC:\Programs\arduino-1.5.2\hardware\arduino\avr\cores\arduino -IC:\Programs\arduino-1.5.2\hardware\arduino\avr\variants\mega C:\Users\bob\AppData\Local\Temp\build2805575431420087737.tmp\sketch_feb16b.cpp -o C:\Users\bob\AppData\Local\Temp\build2805575431420087737.tmp\sketch_feb16b.cpp.o
sketch_feb16b.ino:2:26: error: sub/mydriver.c: No such file or directory
sketch_feb16b.ino: In function 'void loop()':
sketch_feb16b:11: error: 'myfunc' was not declared in this scope

Using Arduino 1.5.2. I am doing something dumb?

ETA: I though that using chevron quotes #include <sub/mydriver.c> was finding the file but not compiling it, but in fact the include is ignored completely, and doesn't complain about missing files.

ETA2: Yes, I realize the above is from the AVR compiler, but the same applies for the ARM compiler. See below smiley-wink
28  Products / Arduino Due / Re: shield layout for DUE/Mega on: February 13, 2013, 05:05:11 pm
I started with the Arduino files here by nicholasclewis.

My adapted versions for Due on my github All the Kicad footprints I use are under, in the RMC.* files, and files from nicholasclewis. To use symbols or footprints you need to explicitly add them to you Kicad projects.

The Due shield I have been working on is under RAMPS-FD (

If you find anything missing or broken, please let me know, some things get overlooked or reorganised. For queries on Kicad, the group is usually helpful. The site at also has lots of useful info and downloads.
29  Products / Arduino Due / Re: shield layout for DUE/Mega on: February 13, 2013, 04:05:40 pm
I believe your pin spacings are correct, although I haven't looked at the ICSP header.

There is a free version of Eagle which I use to examine the Arduino reference files.

For creating PCBs, I use Kicad. There are some Arduino footprints already available for Kicad. I can provide some Due footprints for Kicad if you like.
30  Products / Arduino Due / Re: MII/RMII bus on arduino due, where is? on: February 10, 2013, 01:06:47 pm
Unfortunately, the ETH connector is in the reference schematic but not placed on the reference board. I guess that the designers were unable to find space for it. I don't know if this will be included in a future revision of the design.

The TAIJIUINO which is similar to the Due does have a footprint for an ETH connector on the board.
Pages: 1 [2] 3 4