Tag Archives: Flash

Measuring flash speed with AVR


How fast is your flash?


Whether you’re a Maker or a photographer, there’s nothing more interesting than learning about timers, interrupts and input capture on AVR MCUs. And, if you’re a flash fanatic like Matt Kane of Vela Labs, you’re sure to love his latest project: a low-cost, high-speed timer for camera flashes as an Arduino shield.

flahs

When it comes to measuring flash speed, it is typically done in one of two ways. One is determining the lag time between the trigger signal at the hotshot or sync cable and the light emitting from the flash. If this remains consistent, everything is fine. The other is the speed of the pulse width, which refers to the amount of time that the lamp is shining. This is analogous to shutter speed, and combined with the luminosity of the flash gives the exposure. When varying the “power” of a speed light, it doesn’t actually change the brightness of the flash; instead, it simply alters the pulse width. This is why for high-speed photography you need your flash to be on its lowest power setting.

“For most high speed photography, lag isn’t a major problem as long as it’s consistent. If you’re capturing a bullet you can compensate for lag by simply moving the camera further from the gun. If it’s inconsistent then it’s more of a problem, as this makes it very hard to align shots. The really important thing is the pulse width. The longer the pulse, the more motion blur you’ll get in your shot. Sure you can test this by trial and error, but it’s a lot easier if we measure it first as it means we can easily calculate what sort of speed of object we can capture with the flash,” Kane explains.

While usual equipment like a photodetector and oscilloscope that can do the trick, it will generally set someone back quite a few bucks. However, Kane’s DIY project is a much more affordable, easy-to-use way to measure both types of flash speed. In fact, the Maker used a $0.50 photodiode that is sensitive to visible light and a 3.5mm jack that ties into the flash remote, both of which are wired to an Arduino Leonardo (ATmega32U4). The current measured through the device indicates the brightness of the shining light, while an added RC filter helps avoid high frequency noise interfering with their readings. Meanwhile, a 50ohm load resistor provided Kane with enough voltage to measure with the Arduino.

schematic

A push button was tasked with the triggering. To get a reading for just the pulse width, Kane pointed the flash towards the detector and fired away. It then printed the pulse width over serial. As Kane advises, if you want to measure the lag as well, then the flash must be connected the shield and pointed at the detector, while pressing the shield’s button. This will then allow the user to receive both values over serial.

So why turn to AVR for the project? “ATmega chips have a built-in analog comparator which is great for this. This measures whether the voltage on one pin is higher or lower than the reference voltage and generates an interrupt or sets a register accordingly. The reference voltage can either be the micro’s internal reference voltage, or a voltage on an external pin. We’ll be using the latter so that we can set our threshold. Once the voltage from the photodiode goes over that threshold it will trigger an interrupt. A little trial and error with the oscilloscope showed that 100-200mV was a good threshold, so I used a voltage divider to generate this.”

With just some work around high-speed timers and interrupts on Arduino, you too can determine the speed of your flash. Head over to the project’s official page to get an in-depth breakdown of the build.

Atmel celebrates 50 billion with ARM

ARM – which employs over 2,000 people around the globe – has billions of RISC-based processors in the wild and powers approximately 95% of the world’s smartphones. Recently, the British company marked a major milestone: 50 billion ARM-powered chips shipped.

Commenting on the milestone, Reza Kazerounian, Senior Vice President of Microcontrollers at Atmel, noted that ARM helps embedded developers significantly accelerate the development cycle by offering access to standard cores and an extensive ecosystem, including software and reference designs.

Kazerounian also said the next 100 billion chips will likely be led by intelligent connectivity, primarily in the context of the Internet of Things (IoT).

As we’ve previously discussed on Bits & Pieces, Atmel offers an extensive portfolio of microcontrollers (MCUs) and microprocessors (MPUs) based on the world’s most popular 8- and 32-bit architectures: Atmel AVR and ARM. Indeed, Atmel’s two decades of microcontroller leadership and innovation include many industry-firsts:

  • The first Flash microcontroller, the first ARM7-based 32-bit Flash microcontroller
  • The first 100nA microcontroller with RAM retention
  • The first ARM9-based Flash microcontroller

“In order to simplify the embedded design process, we’ve meticulously built a robust ecosystem around our ARM microcontrollers,” an Atmel engineering rep told Bits & Pieces. ”Meaning, Atmel offers a wide range of software tools and embedded software that support leading operating systems, along with low-cost evaluation kits.”

In addition, Atmel’s flexible and highly integrated ARM-based MCUs are designed to optimize system control, user interface (UI) management and ease of use. That’s why our ARM Cortex-M3 and M4 based architectures share a single integrated development platform (IDP): Atmel Studio 6. This platform offers time-saving source code with more than 1,600 example projects, access to debuggers/simulators, integration with Atmel QTouchtools for capacitive touch applications and the Atmel Gallery online apps store where embedded software extensions can be downloaded.

Meanwhile, Atmel ARM-based MPUs range from entry-level devices to advanced highly-integrated devices with extensive connectivity, refined interfaces and ironclad security.

“Whether you are working on new, existing or legacy designs, a wide range of Atmel ARM-based devices provides the latest features and functionality. These devices also feature the lowest power consumption, a comprehensive set of integrated peripherals and high-speed connectivity,” the engineering rep added.

Interested in learning more about Atmel’s extensive ARM portfolio? You can check out our ARM MCUs here and our ARM MPUs here.

Designing UL/IEC/EN60730-compliant appliances with Atmel

UL/IEC/EN60730 are a comprehensive set of safety standards for various household appliances, such as washing machines, stoves and refrigerators.

On a hardware level, key design considerations for UL/IEC/EN60730-compliant appliances include POR, BOD, RAM, Flash, EEPROM, WDT, ADC, clock/zero cross detector as well as immunity from noise, EMC and humidity. Software features typically comprise a 60730 code library, spread spectrum and FMEA (Failure Mode and Effects Analysis).

compliantappliances2

A number of current-gen Atmel components can be used to design UL/IEC/EN60730-compliant appliances, including ATxmega MCUs, AT42QT14811, AT42QT1244/1245, AT42QT2640 and UL/IEC/EN60730 certified touch controllers.

“Simply put, megaAVR and AVR XMEGA – with application notes (AVR998 and AVR1610) – provide proven solutions to address household appliance design requirements,” an Atmel engineering rep told Bits & Pieces.

“An Atmel-powered platform offers developers access to the most efficient 8-bit microcontroller core; POR, BOD and watchdog with an independent oscillator; integrated RC oscillators, RTC, EEPROM, ADC Converter/Comparator; 25×4 and 40×4 segment LCD driver options, as well as certification of the XMEGA code library.”

compliantappliances3

In terms of electrical performance, Atmel offers a high current sink and source for GPIO, temperature range from 850C up to 1500C and EMC robustness (low emissions). On the touch side, Atmel provides pre-certified capacitive touch controllers and Failure Mode Effects Analysis (FMEA) module for improved safety.

As noted above, devs can access Atmel application notes for AVR998 and certified AVR1610, including safety related code. Last but certainly not least, manufacturers have easy access to Atmel Studio 6 and its Integrated Development Environment (IDE).

Interested in learning more about designing UL/IEC/EN60730-compliant appliances with Atmel? Be sure to check out the following links below:

Atmel ships new ARM Cortex M0+ processor-based MCUs in volume

Atmel is now shipping its recently launched SAM D20 microcontroller (MCU) lineup in production quantities. As previously discussed on Bits & Pieces, the SAM D20 is the first series in a new family of ultra-low power embedded Flash microcontrollers based on ARM’s powerful Cortex-M0+ processor.

thinkbeyondcore

“In this era of the Internet of Things (IoT), products used in building automation, consumer electronics, smart metering and industrial controls are becoming smarter and more connected,” Mr. Ingar Fredriksen, Atmel’s Sr. Director of Flash-based Microcontrollers, explained. “With Atmel’s new SAM D20 MCU available to the mass market, designers now have access to a new Cortex M0+ based MCU to easily add more intelligence and connectivity to next-gen IoT devices.”

According to Mr. Fredriksen, the new series combines innovative and proven technologies, including intelligent peripherals with Atmel’s Event System as well as capacitive touch support for button, slider and wheel capability and proximity sensing.
The new SAM D20 series is also supported by the latest version of Atmel Studio and Atmel Software Framework, the integrated development platform of choice for developing and debugging ARM Cortex-M and Atmel AVR MCU-based applications.

“We’ve built our decades of innovation and experience in embedded Flash MCU technology into our new Atmel SAM D20 family,” Mr. Fredriksen continued. “That is why the SAM D20 sets a new benchmark for flexibility and ease-of-use, while combining the performance and energy efficiency of the ARM Cortex-M0+ core with an optimized architecture and peripheral set. We’ve brought true differentiation into this new family, making it the ideal MCU for low-power, cost-sensitive industrial and consumer applications.”

Additional information about Atmel’s SAM D20 can be found here.

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.

Atmel expands ARM Cortex-M4 Flash lineup with SAM4N series

Atmel has expanded its ARM Cortex-M4 Flash lineup with the entry-point SAM4N series. The new microcontrollers – which feature a 100MHz operating frequency – boast up to 1MB of Flash memory, multiple serial communication peripherals and analog capability.

“This combination of features, coupled with low power consumption, makes the SAM4N series ideal for a wide range of applications, including the industrial automation, consumer appliance and energy metering markets,” an Atmel engineer told Bits and Pieces.

“In addition, the SAM4N series offers pin-to-pin compatibility with the Atmel SAM4S, SAM3S, SAM3N and SAM7S devices – facilitating easy migration within the SAM lineup.”

As noted above, the SAM4N is built around a low power sipping design, achieving real-world consumption levels down to 170µA/MHz in active mode; down to 20µA in sleep mode with full RAM retention & wake-up time down to 10µs; and down to 1µA in backup mode with the RTC running.

Key hardware specs include fast serial communication with 7 UARTs, four SPIs and three I2Cs; 12-bit ADC, 10-bit DAC, integrated voltage reference, multiple timers and PWM.

On the software side, there is full IDE support for Atmel Studio 6, IAR and Keil, while a Modbus Demo (RTOS + Modbus RTU) will go live later this month. In addition, Atmel’s SAM4N Xplained Pro is available as a starter or evaluation kit – and is probably the most ideal platform for evaluating and prototyping with the SAM4N. Of course, extension boards can also be purchased individually. Additional information about Atmel’s new SAM4N lineup can be found here.