Author Archives: atmelfaebrian

How Bluetooth beacons can put an end to QR codes


Bluetooth beacons can enhance experiences in a way that is truly indistinguishable from magic.


Arthur C. Clarke once stated, “Any sufficiently advanced technology is indistinguishable from magic,” something that holds true when it comes to our ever-connected world. Take a look around and you will surely notice that the Internet of Things phenomenon is growing quite rapidly. So much so that some adopters have become a part of the IoT without even knowing. Many times, these cloud-based data processing solutions appear to the user as only a familiar webpage or mobile application.

The Internet of Things phenomenon is growing quickly around us.

Part of making IoT ubiquitous and nearly magical is awareness of where you are. GPS and cellular location can certainly do a great job outdoors. Cell tower-based location can give a very rough prediction of location indoors or outdoors. Using GPS or tower location, it is likely that an application running on a mobile device would know that you just walked into a particular store or venue.

But what happens if you need to know a more precise location inside? Take for instance, retailers and venues, who want to deliver very specific content based on the exact location of a customer, like a promotion for a particular product on a nearby shelf.

Today, many museums and public venues, such as malls and arenas, have strategically employed QR code barcodes to allow for on-demand access to location-specific information. Patrons can scan the code and automatically launch cloud-based content into an app or browser that is related to particular exhibits and locations. As great as it may be, I have come to realize that it is a real pain because it requires scanning the QR code at every exhibit. For me, this involves entering my PIN to unlock my cellphone, then looking for my QR code scanner app. This takes my attention away from my family and the overall museum experience. Usually by the time I have accessed the information, my family has moved on to the next exhibit without me.

I recently visited the North Carolina Aquarium in Pine Knoll Shores. It is a nice aquarium with thousands of examples of aquatic life from North Carolina’s many inland freshwater bodies, as well as the sea in smaller exhibits cumulating in the large 300,000-gallon tank holding a replica of the German U-352 that was sunken off the coast of North Carolina during WWII. What’s more, there is a 50,000-gallon installation that re-creates the scene as divers discovered the wreck of the Queen Anne’s Revenge, a ship once commanded by the most infamous pirate of them all – Blackbeard. The ship was last seen sinking off the North Carolina coast in 1718. Case in point: as with most exhibits, there are stories to be told that are specific to each one. Getting easy access to those stories easily enhances the overall visitor experience.

I noticed that several of the smaller exhibits at the NC Aquarium had interactive electronic experiences that were not working because they had fallen into disrepair.

I had noticed that several of the smaller exhibits at the North Carolina Aquarium featured interactive electronic experiences that weren’t working because they had fallen into disrepair. A prime example was the amphibian exhibit, which you can press an old-fashioned button and hear what a frog call sounds like.

I can imagine the electronics behind this antiquated pushbutton: probably a voice recorder circuit from the 1990s along with a power supply and speaker. The button most likely stopped working after a few thousand kids pressed it dozens of times each, or the contacts became oxidized and non-conducting because the current through the switch was insufficient to keep the oxidation burned off. Design of switch circuits is another topic and one that hopefully will need to be addressed much less going forward thanks to innovations like capacitive touch for buttons, sliders, wheels, and other user interface elements.

push-buttons-far-from-advance

In this case, the old-school pushbutton that doesn’t work is far from advanced, let alone “indistinguishable from magic.” And for that matter, the QR codes strategically placed at exhibits are clunky as well.

Instead, what if there were little radio transmitters at each exhibit that your mobile device could detect and reliably determine location? As you are well aware, your mobile device comes equipped with Bluetooth and Wi-Fi radios, as well as GPS, cellular and NFC. Of these technologies, we can use Bluetooth to interact with the exhibits by letting the phone seamlessly know where in the building it is located. Introducing self-contained Bluetooth Smart Beacons or iBeacons as a solution to this problem should not be difficult.

These beacons consist of a power source, a Bluetooth Smart radio and an antenna, all housed inside an enclosure. Beacons work by sending out a packet of data at regular intervals, called the advertising interval. In a museum or aquarium where people walk around, the advertising interval could be one second or more. With an advertising interval of a second, a Bluetooth Smart beacon using Atmel’s BTLC1000 SoC can operate at an average current of under 7 µA and last up to four years on a low-cost CR2032 Lithium coin-cell or longer on a pair of AAA batteries. And the best part is that there are no moving parts — nothing to be loaded onto the beacon except a unique ID or serial number associated with the specific location in the museum or other venue. And the technology is real today. In fact, beacons from Apple (known as iBeacons) are already being deployed in select retail locations such as Disney stores and throughout their own Apple stores. Some iBeacons apps simply run on iPhones and iPads, while others use dedicated low-power and low-cost hardware.

fyx-self-contained-bluetooth-beacon

Let’s consider the entire system and the lifecycle cost of a location-based system of beacons and a smartphone application versus individual content loaded at particular exhibit locations. In this scenario, the largest upfront cost of the solution will be that of developing the website and/or the app. The price of the beacons will be negligible by comparison.

Deployment of the beacons can be accomplished using a different app that can register each beacon to a location and associate it with specific content. Once deployed, the beacons need not be reprogrammed or upgraded. Their ID is simply linked to content located on a server, which can be updated whenever necessary.

Another nice feature of this system is that trained employees are accustomed to loading content onto web servers. There are very few people who are adept at re-recording audio files onto a 20-year-old talking box or repairing it’s worn out pushbutton. Deployment of the app would be done through the app stores for Google, Apple and other phone OS suppliers. Maybe you could even get started by scanning a single QR code when you enter the venue. But that would be the last of the dreaded QR codes you would need to scan.

Using Bluetooth beacons, an experience such as the North Carolina Aquarium could actually be enhanced by technology in a way that is truly indistinguishable from magic. Some other applications, many of them not new, that I think could benefit from this technology include:

  • Sports like skating, motorsports, and swimming/diving: to enhance safety and enjoyment.
  • Retail stores: to provide special discounts and on-the-spot information.
  • Car dealerships: to offer information to those driving by.
  • Amusement parks: to advise patrons about waiting times or to help staff manage crowd traffic.
  • Art galleries: to improve spectators’ experiences without taking anything visual away from the exhibits by cluttering the gallery with QR codes.
  • In the dining room: Based on being near a beacon, the entire family’s devices can go into a silent “family time” mode that would turn off ringers and even disable texting. Similarly, restaurants, churches, funeral homes, conference rooms and other settings could implement an automatic cellphone quiet zone for those who didn’t want to forget to turn off their ringers.
  • At home or in the car: to customize the operation of a phone or tablet in specific ways based on a person’s preferences.
  • Public buildings or on streets: to ease wayfinding for the visually-impaired.
  • Senior centers: to help the elderly or those with disabilities regain independence by pairing with a wearable device.

Coincidentally, I saw this on the way home the other day. While I still don’t know any details, the concept of using beacons got me thinking.

city-wide-rezoning-notices-tech-atme

What are the chances that some will pull my car over, get out, and scan the QR code on this outdoor sign? If like me, probably slim to none. The same goes for those who are looking to buy real estate and are driving in their vehicles. What good is the QR code to you in this situation?

remax-encore-bluetooth-beacons

Unless I’m walking or want to go through the trouble of getting out of my vehicle to scan the sign, or worse yet try and scan the sign while driving, I probably won’t utilize the attached QR code. Using beacons will not only eliminate risks, but will expedite the process altogether. What if we enable the real estate apps with access to the mobile device’s Bluetooth? Now we can look for Bluetooth beacons placed strategically at properties that are for sale and collect information about properties without getting out of the vehicle, and even more importantly, without taking our eyes off the road.

There is enormous potential for the use of Bluetooth Smart beacons anywhere signs are posted and wherever further information is available online. The real estate market is just one of many example use cases, where the implementation of beacons could be a key differentiator for companies willing to become early adopters.

You do have to focus on the revenue generating applications, but there are countless other applications where QR codes located on larger signs could be replaced by beacons to make it easier to access information and reduce the total size and number of signs.

One example is this QR code-equipped sign to encourage people to walk instead of driving their cars…

fitness-navigation-cues-as-bluetooth-beacons

Or this one that provides fitness information to those taking a stroll along the public greenway trail…

fitness-trails-as-bluetooth-beacons-atmel

These are just a few the ways that Bluetooth beacons can help make the world a better place. A new thinking in terms of apps and getting people to install them is necessary for success. However, if the value of the information becomes high enough, it will happen. Hopefully you will think of more applications and ways to design Bluetooth Smart beacons to support them. And when you do, be sure to look at the lowest power and lowest total bill-of-material cost solutions from Atmel.

Atmel’s SAM4S clinches highest CoreMark/MHz scores

Atmel’s SAM4S MCU lineup – which clocks in at a top speed of 120MHz+ – is based on ARM’s Cortex-M4 core. The microcontroller series integrates a Flash read accelerator along with cache memory to increase system performance. Additional key specs include a multi-layer bus matrix, multi-channel direct memory access (DMA) and distributed memory to facilitate high data rate communication.

Recently, the EEMBC (Embedded Microprocessor Benchmark Consortium) certified five SAM4S MCU benchmark scores running a version of CoreMark compiled using the IAR Embedded Workbench for ARM version 6.50. As it turns out, Atmel’s SAM4S MCUs racked up the highest CoreMark/MHz for any Cortex-M microcontroller submitted to date.

“The CoreMark benchmark is designed to measure the performance of the processor core alone,” Atmel engineering rep Brian Hammill told Bits & Pieces.

“While the CoreMark may not always convey how well a particular part will perform in a specific application, it does offer an accurate test of core performance and efficiency. As such, CoreMark can be used to understand how the performance of a particular MCU and compiler combination compares to others.”

According to Hammill, the Atmel scores are particularly significant as they illustrate the overall efficiency of the Cortex-M4 cache implemented on the SAM4SA16 and SAM4SD32, as well as the optimized performance of the IAR Embedded Workbench version (6.50).

“Looking at the Atmel SAM4SD32CAU, we see the CoreMark for the IAR EWARM 6.50 was run at both 21 MHz and 123 MHz. If we run the EEMBC CoreMark report or export the data to Excel, here is what we see:

coremarkatmelscores

“As expected, the CoreMark scores are much higher at the faster clock speed. But what is most significant is the difference in the CoreMark/MHz scores. Notice that the 21 MHz CoreMark memory configuration is zero wait states. The memory configuration for the 123 MHz CoreMark is 5 wait states but with prefetch and cache enabled. You see a small difference in the CoreMark/MHz scores between the 21 and 123 MHz benchmarks.”

Why? Well, as Hammill, notes, if you had a perfect zero wait state memory or cache system, the exact same CoreMark/MHz would be returned regardless of the speed.

“Of course it is to be expected that the cache helps – but does not completely cover the wait states of Flash. However, the small difference between 3.32 CoreMark/Mhz at 123 MHz and 3.38 CoreMark/ MHz illustrates Atmel’s SAM4SD32CAU device has a very good implementation of cache and prefetch,” he explained.

atmelcoremark2

“Indeed, if the Atmel cache and prefetch weren’t optimized, you would expect to see a much larger difference in the CoreMark/MHz scores. I would also like to note that the Atmel SAM4SD32CAU require 5 wait states in flash to run at 123 MHz – but with very slight performance penalty as indicated by the CoreMark/MHz scores.”

atmelcoremark1

CoreMark – written in C – was developed in 2009 by Shay Gal-On at EEMBC and contains implementations of numerous algorithms. These include list processing (find and sort), Matrix (mathematics) manipulation (common matrix operations), state machine (determine if an input stream contains valid numbers) and CRC. Like any benchmark, the EEMBC CoreMark clearly isn’t perfect, although it is certainly a fair assessment of overall performance, as well as the core and memory efficiency of a specific processor.

The value of microcontrollers (MCUs) with dual-bank flash

Written by Brian Hammill

Atmel, along with a number of other industry heavyweights, recently introduced a slew of Cortex-M microcontrollers (MCUs) equipped with a dual-bank flash feature.  While single bank flash is sufficient for numerous applications, the dual-bank feature offers significant value in specific scenarios. So let’s discuss the added benefit of dual-bank flash.

Fig 3: Dual bank flash provides a fail safe method of implementing remote firmware upgrades

Dual bank flash provides a fail safe method of implementing remote firmware upgrades

First, we need to understand the role of flash in a MCU.  Just under 100% of the time, the flash memory in your MCU is in read mode.  The processor core is almost always fetching instructions to execute out of the flash. Exceptions? When code is being run from RAM, internal or external, or ROM.  Meaning, with typical flash memory, you cannot read while you are writing to it.  As such, during firmware upgrades and data storage operations, the processor core cannot execute code from the flash.  Either the processor has to wait for the write operation to complete, or the core can continue to execute from other physical memory such as RAM or ROM.

In Atmel’s single bank SAM3 and SAM4 family flash MCUs, this problem has been solved in a somewhat novel manner by providing flash programming code in the factory programmed ROM.  This means that whenever the firmware engineer wants to write the flash, it will buffer the data to be written and make a call to a routine in ROM.  The processor core will then be executing from ROM while the flash is being written.  Since flash erase and programming operations can take milliseconds (a very long time for a MCU core running at up to 150 MHz), the ROM routine may have to sit in a do nothing loop while the flash operation completes.

Admittedly there are limitations, but this method generally works just fine for systems with external storage such as serial flash – retaining downloaded firmware images until they can be written to the internal flash.  It also works well in systems which infrequently write a few bytes of data to the flash.

Firmware upgrades can be risky, especially in applications where firmware images are downloaded across slow unreliable wireless links – or where systems are prone to power failures. In a single bank flash system, ensuring a reliable firmware upgrade means there is a part of the flash that you never erase or write over. The code contained in that part of the flash knows how to detect corrupted code in the rest of the flash.

Using a checksum, CRC, or even a digital signature are common ways to determine the validity of the flash image on boot or reset.  If the check comes out bad, the code in the part of flash that is never over-written knows to look for a backup image and attempt to reprogram the application.  The backup image can be located in an external memory such as a serial flash or if there is enough space, in an unused part of the internal flash.

Managing backup images in internal flash or external serial flash can be done reliably in a well planned system with single bank flash.  The key is well-planned, although the firmware engineer has to jump through some hoops because changing the interrupt table ordinarily means you have to change the very lowest flash addresses.  Plus, you cannot keep that part of flash unchanged over the life of the product in the field.  So it is necessary to have the fixed interrupt vectors point at defined locations where the actual interrupt service routines are located.  And finally, the actual ISRs can be changed when the application is changed by a firmware update, although this can lead to size restrictions or wasted flash space between the ISRs.

Zigbee Smart Energy Profile

The much anticipated Zigbee Smart Energy Profile 2.0 was recently released. Representing an effort spanning more than three years, this milestone includes contributions from NIST, IETF and the Zigbee Alliance. Various companies also participated in the initiative, including utility, meter, silicon and software stack vendors.

Smart Energy – the application profile that drove the Zigbee Alliance development of the Zigbee IP (ZIP) –  is the first public profile requiring ZIP instead of the current Zigbee and Zigbee PRO underlying stacks. Zigbee IP (ZIP) and SEP 2.0 offer TCP/IP based interoperability for smart energy networks, thereby facilitating participation in the Internet of Things (IoT) without the need for special gateways. In fact, ZIP is designed to be physical layer (phy) agnostic and is capable of running across various platforms including 802.15.4 Wireless, WiFi, Power Line Carrier Ethernet and more.

SEP 2.0 is built using numerous mainstream protocols such as TLS/HTTPS, XML, EXI, mDNX  and REST. Each SEP 2.0 device boasts an optimized HTTP server serving up and responding to data objects defined by an XML schema. Security is ensured by familiar HTTPS with strong authentication, while an RFC compliant IPv6 stack provides the network with specific routing and translation layers for the wireless PHY.  The SEP 2.0 presentation from the Zigbee Alliance is available here [PDF].

Two recommended implementation strategies for SEP 2.0 in devices are Single Chip and Multi-Phy. Single Chip implementations use a dedicated microcontroller and RF transceiver (or a combined SoC) running a dedicated stack. This strategy works particularly well when adding Zigbee SEP 2.0 support where there is no other network or TCP/IP stack in low to mid range devices. A good example might be a thermostat or load control device, both of which require communications with other smart energy devices – even if they are equipped with a small processor dedicated to the control and UI functions of the device.

The Multi-Phy implementation –  a new way of looking at Zigbee – offers advantages in devices equipped with multiple network interfaces and/or a capable processor such as an Atmel SAM4, SAM9, or SAMA5 MPU or MCU. In such cases, the 802.15.4 transceiver (like the AT86RF233) becomes the network interface PHY layer underneath the IPv6 stack and SEP 2.0 layers running on the processor. Since the IPv6 stack is a compliant implementation, other network PHYs are also supported by the stack. Running two or more physical interfaces with a single processor is certainly not an issue, as devices that communicate via Zigbee, WiFi, PLC, and Ethernet can be designed. Because a single processor and IPv6 stack are used, the cost will ultimately be lower than duplicating these functions in a separate chip dedicated to Zigbee SEP 2.0.

Single Chip and Multi-Phy implementation

Single Chip and Multi-Phy implementation

The multi-phy implementation is also ideal for gateway devices bridging different physical layers. And since SEP 2.0 is built using standard web protocols, once you bridge the smart energy network to the Internet, managing your home energy devices from a tablet or smartphone is no stretch at all and brings us closer to the reality of the Internet of Things (IoT).

Atmel, along with software stack partner Exegin Technologies, offers robust and compliant solutions for Zigbee IP and SEP 2.0. There is already interest from leading networking and utility companies, with deployment of certified devices expected before the end of 2013. The critical design decision most of us have to consider? Whether to dedicate the cost and complexity of a single chip Zigbee solution – or optimize it and lower cost with a software stack and radio transceiver solution that offers shared resources and the possibility of multiple networks.