Arduino on ATSAM4E16E

Hi all,

I had originally posted this in the Due section - but realised it really belongs here as it's not actually a Due question per se.

Having taken a look at the Due recently, I'm interested in using one of Atmel's ARM MCUs in a development board design I'm working on for my own use.

However, I'd like to run the SAM4E16E (link to page later in post) as opposed to the SAM3X8E that comes as standard on the Due. How would one go about running this device with the Arduino IDE, or really - if it would be simpler - using this device with Atmel Studio, as ultimately that's where I'd like to end up developing the software as opposed to the IDE.

Looking at the Tools section for the device, there is ISP software, but have no idea what to do with this! - http://www.atmel.com/devices/SAM4E16E.aspx?tab=tools

But having never used 32bit devices, only 8bit - clearly my AVR ISP MkII won't work with such a device, so I am a little lost. Any advice would be greatly appreciated!

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.

Why SAM4E?

A number of reasons;

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

Thanks for the quick reply!

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

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.

http://asf.atmel.com/docs/latest/

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.

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)

EDIT - Saying that, there are a number of examples for the EK dev board in the devices ASF section - http://asf.atmel.com/docs/latest/search.html?device=sam4e

Have also found all the schematics, rev history etc for the SAM4E-EK dev board.

jtw11:

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.

http://asf.atmel.com/docs/latest/

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.

The free toolchains, IDEs, user support, reference designs etc are what are keeping me so attracted to Atmel. The Freescale Power PC MCUs are undoubtedly some of the most capable out there, but the IDE is a paid product - and everything seems very hush hush compared with Atmel products.

Maybe what I said sounded a little too negative

Not at all, I understand entirely! I appreciate it's a little more than a small mound to climb.

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.

I initially said the SAM3X as it is of course the chip that comes on the Arduino Due board, but really - the more I've thought about this, the less I see the point in using the Arduino IDE and learning to use a more powerful environment such as Atmel Studio.

I see what you're saying, but really - the eval boards don't appear very attractive to me, partly due to price, but predominantly as mentioned due to the fact they mainly feature the sort of things I'm not using.

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.

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 (J-Link EDU Debug Probe), 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?

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.

I wouldn't be here if I wasn't :slight_smile: Thanks for your input so far! Greatly appreciated.

EDIT -

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

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...

Over a year ago when the Due was going to use the SAM3U I did a design using that chip

Then they changed chips and I lost interest but a small SAM4 board with a decent backplane design and intelligent use of the features would be nice IMO.

Forget the IDE, anyone using such a board will be over that I think. You could use the Due libraries though, most of the peripherals will be the same or pretty close.

These days I'm more into LPCs, but I still occasionally think about resurrecting this design.


Rob

jtw11:
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 (J-Link EDU Debug Probe), 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.

Seems like the Atmel Cortex M4 parts are still fairly new.

It would seem so - they are not even available as samples. Good job I'm not planning to use this chip for a while!