Tag Archives: ASF

28 new application notes for Atmel | SMART SAM4S devices

Atmel engineers recently published 28 application notes for the company’s comprehensive Atmel | SMART SAM4S devices. Based on the powerful ARM Cortex-M4 core, this Atmel | SMART product line extends our Cortex-M portfolio to offer:

  • Increased performance and power efficiency
  • Higher memory densities: up to 2MB of Flash and 160KB of SRAM
  • And a rich peripheral set for connectivity, system control and analog interfacing

According to an Atmel engineering rep, the application notes target the use of peripheral modules and are based on drivers already available in the ASF (Atmel Software Framework).

“The application notes highlight the availability of the drivers and offers the reader relevant details about the API (application programming interface),” the rep told Bits & Pieces.

“This significant increase in the number of application notes for the SAM4 series gives the engineer a better starting point for using the products. More specifically, the new application notes cover the Atmel SAM4S/SD, SAM4N, SAM4L/LS, SAM4E, and to some extent, also the SAM4C and SAM G51/53 families.”

atmel_SMART_Microsite_980x352

So without further ado, the following app notes are now available from the Atmel website in PDF format:

Electronics Weekly talks Atmel Studio 6

Atmel’s Studio 6 – which supports a wide range of ARM Cortex-M and AVR microcontrollers – allows applications to be written in C/C++ or assembly code. As Jonathan Page of MSC Gleichmann notes in a recent Electronics Weekly article posted by Richard Wilson, Atmel’s IDE facilitates a “top-down design approach” for embedded systems development.

“As a result it can avoid the need to rewrite significant portions of the code for each port to a different MCU variant or architecture,” Page explains. “With Atmel’s Software Framework (ASF), functions are implemented using a common API that abstracts away the device-specific features to maximize the portability of application-level code. This allows code developed for one target MCU to be recompiled for a new target device.”

More specifically, ASF utilizes a layered architecture with four primary categories: component, service, peripheral and board. The starting point in the ASF design process is at the top with the user application.

“This normally interfaces directly to the component and service modules unless the application needs direct access to any low-level device functions provided by the peripheral and board layers, [as] the service layer takes care of all the MCU’s internal hardware features,” Page continues. “Standardization is key to making ASF easy to use, meaning that modules operate in a consistent way using API calls like module_start(…) and module_stop(…).”

In this way, says Page, ASF enables common code development for 8-bit and 32-bit targets, providing not only a standard software library of functions and peripheral drivers but also enabling third party code libraries and associated tools.

“For example, Atmel Gallery provides a moderated App Store feature for Atmel Studio 6.0 extensions that allows access to free, evaluation and paid-for content from Atmel-certified third party development partners,” Page points out. “Typically up to 50% of the code requirements for a new project can be realized from these libraries, to say nothing of the savings that can be achieved when retargeting an application to another MCU.”

Software frameworks, once the domain of enterprise computing, are now clearly delivering productivity and efficiency benefits in embedded applications.

“The concerns of conservative developers, previously reluctant to move beyond the comfort of familiar IDE tools, can be finally been allayed with a software framework providing a true top-down design solution,” Page adds. “This approach achieves all the benefits of hardware abstraction and design portability across a wide range of target devices while losing none of the performance advantages.”

The full text of the Electronics Weekly article is available here.

FreeRTOS with Atmel’s SAM D20 Xplained Pro

Atmel’s SAM D20 lineup is based on the ARM Cortex- M0+ core, setting a new benchmark for flexibility and ease-of-use. The microcontroller (MCU) series is ideal for a number of low-power, cost-sensitive industrial and consumer devices, such as GPS trackers, appliance controllers, intelligent remotes and optical transceivers.

As William Wong of Electronic Design notes, the SAM D20 specifically targets the entire low-end space currently handled by 8- and 16-bit microcontrollers, while also hitting the low-end 32-bit space.

“The SAM D20 incorporates high-end support like the high-speed bus matrix linked to three AHB/APB bridges. System and power controllers can be found off one bridge. Memory controllers are found off another,” Wong wrote in an article posted on Electronic Design earlier this year. “The third bridge handles the convention interfaces that include up to six programmable serial ports, eight timers, a 20-channel, 350-ksample/s analog-to-digital converter (ADC), a pair of comparators, and a 10-bit, 350-ksample/s digital-to-analog converter (DAC). There is also Atmel’s touch interface controller.”

Recently, a detailed SAM D20 demo project went live on FreeRTOS.org (FreeRTOS, FreeRTOS+CLI).  The demo – which targets Atmel’s SAM D20 Xplained Pro evaluation board – leverages the FreeRTOS ARM Cortex-M0 GCC port and builds with the free Atmel Studio IDE (using the Visual Studio framework and kernel aware FreeRTOS plug-in).

Meanwhile, the command line interface character input and output employs drivers provided Atmel’s Software Framework (ASF), with a #define tasked with switching the build between a simple blinky style application and a comprehensive test/demo application that incorporates the FreeRTOS+CLI component.

Want to build and run the ARM Cortex-M0+ RTOS Application? It should probably be noted that the FreeRTOS download contains the source code for all FreeRTOS ports, so obviously there is a surplus of unneeded files for this specific SAMD20 demo. As such, it might be a good idea to check out the the Source Code Organization section for a description of the directory structure. The Atmel Studio solution file is called RTOSDemo.atsln, which is located in the FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained directory.

Building and running the ARM Cortex-M0+ RTOS application

  1. Open FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo.atsln in the Atmel Studio IDE.
  2. Locate the mainCREATE_SIMPLE_BLINKY_DEMO_ONLY definition at the top of main.c.
  3. Set mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to 1 to create the simple blinky demo, or 0 to create the comprehensive demo that also includes the command line interpreter.
  4. Select “Rebuild RTOSDemo” from the Atmel Studio “Build” menu (or press F7) to build the demo project.
  5. Connect a USB cable between the USB port on the SAMD20 Xplained Pro board and the host computer.
  6. Select “Start Debugging and Break” from the Atmel Studio “Debug” menu to program the microcontroller flash memory and kick off a debug session.

Interested in learning more about running FreeRTOS on Atmel’s SAM D20 Xplained Pro? Be sure to check out the official FreeRTOS demo here.

AVR ATtiny10 runs LED blinker for 6 months

Check out our new AVR site. In celebration, I want to tell you about a neat project. My buddy Wayne Yamaguchi had a whole bunch of tiny coin cells left over from a project. So he whipped up a little AVR blinker using an AVR ATtiny10. The one he gave me flashes every two seconds and is quite bright. Wayne’s design intent was to put this inside a phosphor-coated globe and have a UV LED charge up the phosphors every few seconds. For this round he is just using a white LED, but you can see “UV” on the silkscreen. Wayne has done some quick calculations and it looks like if you slow it down to one 3mA flash every 8 seconds it should last for 6 months. Wayne’s trick it to take the AVR out of active mode and put it to sleep, and use the Watch Dog Timer to wake it up, flash the LED and then go back to sleep. Wayne describes the ATtiny10 project here.

ATtiny10-blinker_Yamaguchi_finger

This flasher works 6 months off a CR1220 lithium cell. Using the ATtiny watchdog timer is the secret to such miniscule power consumption.

It’s interesting to note that Wayne started out with a MCU from an Atmel competitor and found it unsuitable. As many other friends have noted about these other MCUs, Wayne said, “…a lot more coding had to be done to get the job accomplished.” He also ran into limitations where he had to do a work-around in the competitor’s chip. Another friend has commented that competing MCUs can often do one thing well, but when it needs to do two tasks, even simple ones, there are real headaches. That is why they love AVR chips. AVRs were “invented” as a complete modern architecture. Once you know one chip, it’s easy to move around to others in the AVR family, even the AVR 32-bit chips.

The only reason Wayne did not start with the AVR is that he thought he could not keep his obsolete Studio 4 install, which he knows and trusts, and still program the ATtiny10. I asked around, and my Atmel pals told me that everything Wayne would need is in the Atmel Software Framework (ASF). Sure enough that lead Wayne to a solution, and he had his ATtiny10s working under Studio 4. I kept telling Wayne to just upgrade to Studio 6, which will let you program AVR-32 and our ARM-based MCUs as well as all the 8-bit AVRs. Wayne did not want to risk changing environments, since he has several existing products that he changes and customizes and supports with Studio 4. My friends say the answer there is to just run virtual computers with VM Ware or Virtual Box. You can have Studio 4 on one Windows install and Studio 6 on another. Or you can set restore points and go back and forth between the two Studios on one install.

ATtiny10-blinker_Yamaguchi_prototype

Wayne Yamaguchi uses toner-transfer and a homemade acid bath to make prototypes in an hour.

Another interesting thing in Wayne’s blog linked above is a picture he has of the prototype. At first blush it looks like he used a router like a LPKF machine to do the board. But if you look closely, you can see some un-etched copper at the edges. Wayne uses toner transfer and a ferric chloride tank to make his own PCBs in a couple hours. The reason they look like routed boards is that Wayne is smart enough to generate the Gerbers this way so that he uses the minimum amount of ferric chloride to etch the copper. Why etch off big areas if you don’ have to? He outlines this technique in an article about prototyping I wrote a few years ago.

Now wayne did the prototype raw-copper PCB in a day to get started, but he wanted a nicer board for development (see pics and below). For this he turned to OSH Park up in Oregon. He panalized the boards as you can see from the break-away tabs on the edge. The bottom line is each PCB ended up costing him a dollar. I think he was out 20 bucks for the order and got 18 boards. OSH Park collects orders for small lots and puts them all onto a 18×24 panel used in the PCB fab industry. I like the looks of the boards since you get a silkscreen and soldermask. Don’t think, “Its just a prototype, I don’t need a silk or soldermask.” It’s you the one soldering on the board and a silkscreen tells you what goes where. It’s you re-soldering stuff and hand-soldering stuff and the soldermask is a blessing, especially with tiny parts. You want your prototype to be as close to production as possible. OSH Park panelizes two-layer boards every other day and gets a four-layer panel together every four days. You might wait a bit, but I have heard of several happy customers. For small boards like the Blinkie, they make great sense. For anything more serious I will stick with Proto-Express, right here in Silicon Valley. They do 4-mil spacing, can do 24oz copper (not at the same time!) and once your board is perfect, they have a partner in China to do high-volume for cheap. Three standard 2-layer boards in 4 days for about $90 and three 4-layer boards for $150 or so. And that is silk both sides if I remember right.

In addition to the info on his blog post linked above, Wayne sent me an email with the information about the flasher. He uses Evernote to store his notes as he does a project, so below are his notes to himself. I put in current Digi-Key pricing.

Wayne-Yamaguchi_Blinkie-LED-flasher

Wayne Yamaguchi shows the Blinkie flasher he designed.

Wayne did this project a couple months ago. What was interesting was how much longer the flasher ran compared to his calculations. We are not sure if this is because the batteries really have more energy when you discharge them this way, or maybe there is some other factor we don’t understand. It’s good news nevertheless. I can tell you the flasher he gave me a couple months ago is still flashing every 2 seconds. Here are Wayne’s notes:

CR2016, CR2032 Battery Info UV Blinker

2016 – 90mAH

2032 – 240mAH

Compute the average current if LED is pulsed 1 sec every 10 minutes.

1 minute = 60 seconds, 10 minutes = 600 seconds.

1 out of 600.  0.17% duty cycle.

If the LED current is 10mA then average is 17uA.

Attiny10 Power down supply current @3V is 4.5uA.

Attiny10 pricing (Sept 17, 2013):

All prices are in US dollars.
Digi-Key Part Number ATTINY10-TSHRCT-ND Price Break Unit Price Extended Price
Quantity Available Digi-Key Stock: 21,464

1

0.69

0.69

Can ship immediately

25

0.576

14.4

Manufacturer Atmel

100

0.464

46.4

1,000

0.4256

425.6

Manufacturer Part Number ATTINY10-TSHR
Description IC MCU 8BIT 1KB FLASH SOT23
Lead Free Status / RoHS Status Lead free / RoHS Compliant

CR1220 battery Energizer Specifications.  Typical Capacity 40mA/Hr.  down to 2V.

$0.90 each at Digi-Key (Panasonic)

The Nichia 310 in the open bag measure 3mA @3V.

Watch Dog Timer table (from ATtiny10 full datasheet):

ATtiny10_WDT_prescale

CR1220 UV Blinker Board as rendered by OSH Park.

Yamaguchi_CR1220_PCB

Here is the PCB layout for the CR1220 battery Blinkie

 Using 3mA for LED current and 40mA/hr battery capacity gives these run-times:

Delay

tiny10current

average LED current

Estimated Run Time

1 sec

4.5uA

30uA

1,159hrs – 48.3days (~1.61 mos)

2 sec

4.5uA

15uA

2,051hrs – 85.47days (~2.84 mos)

4 sec

4.5uA

7.5uA

3,333hrs – 139 days (~4.62 mos)

8 sec

4.5uA

3.75uA

4,848hrs – 202 days  (~6 mos)

0.25 sec

4.5uA

120uA

240hrs – 10.04 days

0.125 sec

4.5uA

240uA

163.6hrs – 6.82 days

64mS

4.5uA

480uA

82hrs – 3.4 days

CR2016 (20mm lithium) UV Blinker Board as rendered by OSH Park.

Yamaguchi_CR2016_PCB

Here is a PCB layout for the Blinkie using the larger CR2016 battery.

Note to self: It appears that the ISPmk2 (in-circuit programmer) does program at 3V or other voltages.  The error message during programming is verification failed.  But, it appears to be programmed correct.

As a side note, future blinkies should have the LED driven from the free pin PB2.

Run-time test: 64ms sec Blinkie.  1220 battery.

6/22/2013 2.975v

6/26/2013 – 2.750V 6:16   (Should have ended today)

6/27/2013 – 2.736V 10:08am

6/28/2013 – 2.728V 2:06pm

7/3/2013 – 2.43V 9:57am

7/4/2013 – no LED.  Could be still running, but, LED is not visible.

Wayne-Yamaguchi_Francis-Lau_Blinkie-LED-flasher

Wayne Yamaguchi (L) explains the LED flasher held by crack protégé Francis Lau. Lunch was at the Pho Kim restaurant in San Jose.

ATtiny10-blinker_Yamaguchi_flash

It took a few tries, but I finally caught the Blinkie flashing when I snapped the picture.

-30-

Wearable computing with Atmel MCUs

Atmel is smack in the middle of the rapidly evolving wearable tech revolution. First off, Atmel’s SAM4S and tinyAVR MCUs are inside the Agent smart-watch which recently hit Kickstarter.

Atmel MCUs have also tipped up in a number of Maker projects for wearable tech, like the LED pocket watch we featured earlier this month, as well as Adafruit’s Flora, which is built around Atmel’s Atmega32u4 MCU.

And why not? Simply put, Atmel offers a wide range of wearable computing platforms designed for ultra-low power consumption – both in active and standby modes. Indeed, Atmel’s EventSystem with SleepWalking allows peripherals to automatically connect with each other even in ultra low power modes, thereby simplifying sensor interfacing and further optimizing power consumption. Meanwhile, “Wakeup” times are minimized, facilitating the use of low-power modes without missing communications data or sensor events.

In addition, Atmel devices integrate numerous features to save circuit board space, such as USB transceivers and embedded termination resistors. Many devices are offered in very small form factor packages, a critical characteristic for engineers and Makers designing wearable tech.

On the software side, the Atmel Software Framework (ASF) includes communications libraries to support external Wi-Fi and Bluetooth radios, mesh and point-to-point networking on Atmel’s 802.15.4/Zigbee AT86RF radios as well as a full range of USB drivers. The ASF also contains libraries and driver functions for many popular third-party sensors such as accelerometers, gyroscopes and magnetometers.

In addition, standalone Atmel controllers support off-the-shelf capacitive buttons, sliders and wheel (BSW) implementations. Plus, all our microcontrollers can directly manage capacitive buttons via provided software libraries, while the maXTouch series of capacitive touchscreen controllers are capable of managing optically clear touch sensors overlaid on LCD displays.

And last but certainly not least, Atmel’s touch platforms may be tuned to function when moisture is present – which is often a key requirement for wearable applications. Interested in learning more? Check out Atmel’s white paper on wearable tech here.