About Mary Wilson

Mary Wilson is Circuit Cellar's Managing Editor. You can reach her at mwilson@circuitcellar.com and @mgeditor_cc.

A Trace Tool for Embedded Systems

Tracing tools monitor what is going in a program’s execution by logging low-level and frequent events. Thus tracing can detect and help debug performance issues in embedded system applications.

In Circuit Cellar’s April issue, Thiadmer Riemersma describes his DIY tracing setup for small embedded systems. His system comprises three parts: a set of macros to include in the source files of a device under test (DUT), a PC workstation viewer that displays retrieved trace data, and a USB dongle that interfaces the DUT with the workstation.

Small embedded devices typically have limited-performance microcontrollers and scarce interfaces, so Riemersma’s tracing system uses only a single I/O pin on the microcontroller.

Designing a serial protocol that keeps data compact is also important. Riemersma, who develops embedded software for the products of his Netherlands-based company, CompuPhase, explains why:

Compactness of the information transferred from the embedded system to the workstation [which decodes and formats the trace information] is important because the I/O interface that is used for the transfer will probably be the bottleneck. Assuming you are transmitting trace messages bit by bit over a single pin using standard wire and 5- or 3.3-V logic levels, the transfer rate may be limited to roughly 100 Kbps.

My proposed trace protocol achieves compactness by sending numbers in binary, rather than as human-readable text. Common phrases can be sent as numeric message IDs. The trace viewer (or trace ‘listener’) can translate these message IDs back to the human-readable strings.

One important part of the system is the hardware interface—the trace dongle. Since many microcontrollers are designed with only those interfaces used for specific application needs, Riemersma says, typically the first step is finding a spare I/0 pin that can be used to implement the trace protocol.

In the following article excerpt, Riemersma describes his trace dongle and implementation requiring a single I/O pin on the microcontroller:

This is the trace dongle.

This is the trace dongle.

Photo 1 shows the trace dongle. To transmit serial data over a single pin, you need to use an asynchronous protocol. Instead of using a kind of (bit-banged) RS-232, I chose biphase encoding. Biphase encoding has the advantage of being a self-clocking and self-synchronizing protocol. This means that biphase encoding is simple to implement because timing is not critical. The RS-232 protocol requires timing to stay within a 3% error margin; however, biphase encoding is tolerant to timing errors of up to 20% per bit. And, since the protocol resynchronizes on each bit, error accumulation is not an issue.

Figure 1 shows the transitions to transmit an arbitrary binary value in biphase encoding—to be more specific, this variant is biphase mark coding. In the biphase encoding scheme, there is a transition at the start of each bit.

Figure 1: This is an example of a binary value transferred in biphase mark coding.

Figure 1: This is an example of a binary value transferred in biphase mark coding.

For a 1 bit there is also a transition halfway through the clock period. With a 0 bit, there is no extra transition. The absolute levels in biphase encoding are irrelevant, only the changes in the output line are important. In the previous example, the transmission starts with the idle state at a high logic level but ends in an idle state at a low logic level.

Listing 1 shows an example implementation to transmit a byte in biphase encoding over a single I/O pin. The listing refers to the trace_delay() and toggle_pin() functions (or macros). These system-dependent functions must be implemented on the DUT. The trace_delay() function should create a short delay, but not shorter than 5 µs (and not longer than 50 ms). The toggle_pin() function must toggle the output pin from low to high or from high to low.

For each bit, the function in Listing 1 inverts the pin and invokes trace_delay() twice. However, if the bit is a 1, it inverts the pin again between the two delay periods. Therefore, a bit’s clock cycle takes two basic “delay periods.”

Listing 1: Transmitting a byte in biphase encoding, based on a function to toggle an I/O pin, is shown.

Listing 1: Transmitting a byte in biphase encoding, based on a function to toggle an I/O pin, is shown.

The biphase encoding signal goes from the DUT to a trace dongle. The dongle decodes the signal and forwards it as serial data from a virtual RS-232 port to the workstation (see Photo 2 and the circuit in Figure 2).

Photo 2: The trace dongle is inserted into a laptop and connected to the DUT.

Photo 2: The trace dongle is inserted into a laptop and connected to the DUT.

This trace dongle interprets biphase encoding.

Figure 2: This trace dongle interprets biphase encoding.

The buffer is there to protect the microcontroller’s input pin from spikes and to translate the DUT’s logic levels to 5-V TTL levels. I wanted the trace dongle to work whether the DUT used 3-, 3.3-, or 5-V logic. I used a buffer with a Schmitt trigger to avoid the “output high” level of the DUT at 3-V logic, plus noise picked up by the test cable would fall in the undefined area of 5-V TTL input.

Regarding the inductor, the USB interface provides 5 V and the electronics run at 5 V. There isn’t room for a voltage regulator. Since the USB power comes from a PC, I assumed it might not be a “clean” voltage. I used the LC filter to reduce noise on the power line.

The trace dongle uses a Future Technology Devices International (FTDI) FT232RL USB-to-RS-232 converter and a Microchip Technology PIC16F1824 microcontroller. The main reason I chose the FT232RL converter is FTDI’s excellent drivers for multiple OSes. True, your favorite OS already comes with a driver for virtual serial ports, but it is adequate at best. The FTDI drivers offer lower latency and a flexible API. With these drivers, the timestamps displayed in the trace viewers are as accurate as what can be achieved with the USB protocol, typically within 2 ms.

I chose the PIC microcontroller for its low cost and low pin count. I selected the PIC16F1824 because I had used it in an earlier project and I had several on hand. The microcontroller runs on a 12-MHz clock that is provided by the FTDI chip.

The pins to connect to the DUT are a ground and a data line. The data line is terminated at 120 Ω to match the impedance of the wire between the dongle and the DUT.

The cable between the DUT and the trace dongle may be fairly long; therefore signal reflections in the cable should be considered even for relatively low transmission speeds of roughly 250 kHz. That cable is typically just loose wire. The impedance of loose wire varies, but 120 Ω is a good approximate value.

The data line can handle 3-to-5-V logic voltages. Voltages up to 9 V do not harm the dongle because it is protected with a Zener diode (the 9-V limit is due to the selected Zener diode’s maximum power dissipation). The data line has a 10-kΩ to 5-V pull-up, so you can use it on an open-collector output.

The last item of interest in the circuit is a bicolor LED that is simply an indicator for the trace dongle’s status and activity. The LED illuminates red when the dongle is “idle” (i.e., it has been enumerated by the OS). It illuminates green when biphase encoded data is being received.

After the dongle is built, it must be programmed. First, the FT232RL must be programmed (with FTDI’s “FT Prog” program) to provide a 12-MHz clock on Pin C0. The “Product Description” in the USB string descriptors should be set to “tracedongle” so the trace viewers can find the dongle among other FTDI devices (if any). To avoid the dongle being listed as a serial port, I also set the option to only load the FTDI D2XX drivers.

To upload the firmware in the PIC microcontroller, you need a programmer (e.g., Microchip Technology’s PICkit) and a Tag-Connect cable, which eliminates the need for a six-pin header on the PCB, so it saves board space and cost.

The rest of the article provides details of how to create the dongle firmware, how to add trace statements to the DUT software being monitored, and how to use the GUI version of the trace viewer.

The tracing system is complete, but it can be enhanced, Riemersma says. “Future improvements to the tracing system would include the ability to draw graphs (e.g., for task switches or queue capacity) or a way to get higher precision timestamps of received trace packets,” he says.

For Riemersma’s full article, refer to our April issue now available for membership download or single-issue purchase.

A Workspace for Microwave Imaging, Small Radar Systems, and More

Gregory L. Charvat stays very busy as an author, a visiting research scientist at the Massachusetts Institute of Technology (MIT) Media Lab, and the hardware team leader at the Butterfly Network, which brings together experts in computer science, physics, and electrical engineering to create new approaches to medical diagnostic imaging and treatment.

If that wasn’t enough, he also works as a start-up business consultant and pursues personal projects out of the basement-garage workspace of his Westbrook, CT, home (see Photo 1). Recently, he sent Circuit Cellar photos and a description of his lab layout and projects.

Photo 1

Photo 1: Charvat, seated at his workbench, keeps his equipment atop sturdy World War II-era surplus lab tables.

Charvat’s home setup not only provides his ideal working conditions, but also considers  frequent moves required by his work.

Key is lots of table space using WW II surplus lab tables (they built things better back then), lots of lighting, and good power distribution.

I’m involved in start-ups, so my wife and I move a lot. So, we rent houses. When renting, you cannot install the outlets and things needed for a lab like this. For this reason, I built my own line voltage distribution panel; it’s the big thing with red lights in the middle upper left of the photos of the lab space (see Photo 2).  It has 16 outlets, each with its own breaker, pilot lamp (not LED).  The entire thing has a volt and amp meter to monitor power consumption and all power is fed through a large EMI filter.

Photo 2: This is another view of the lab, where strong lighting and two oscilloscopes are the minimum requirements.

Photo 2: This is another view of the lab, where strong lighting and two oscilloscopes are the minimum requirements.

Projects in the basement-area workplace reflect Charvat’s passion for everything from microwave imaging systems and small radar sensor technology to working with vacuum tubes and restoring antique electronics.

My primary focus is the development of microwave imaging systems, including near-field phased array, quasi-optical, and synthetic-aperture radar (SAR). Additionally, I develop small radar sensors as part of these systems or in addition to. Furthermore, I build amateur radio transceivers from scratch. I developed the only all-tube home theater system (published in the May-June 2012 issues of audioXpress magazine) and like to restore antique radio gear, watches, and clocks.

Charvat says he finds efficient, albeit aging, gear for his “fully equipped microwave, analog, and digital lab—just two generations too late.”

We’re fortunate to have access to excellent test gear that is old. I procure all of this gear at ham fests, and maintain and repair it myself. I prefer analog oscilloscopes, analog everything. These instruments work extremely well in the modern era. The key is you have to think before you measure.

Adequate storage is also important in a lab housing many pieces for Charvat’s many interests.

I have over 700 small drawers full of new inventory.  All standard analog parts, transistors, resistors, capacitors of all types, logic, IF cans, various radio parts, RF power transistors, etc., etc.

And it is critical to keep an orderly workbench, so he can move quickly from one project to the next.

No, it cannot be a mess. It must be clean and organized. It can become a mess during a project, but between projects it must be cleaned up and reset. This is the way to go fast.  When you work full time and like to dabble in your “free time” you must have it together, you must be organized, efficient, and fast.

Photos 3–7 below show many of the radar and imaging systems Charvat says he is testing in his lab, including linear rail SAR imaging systems (X and X-band), a near-field S-band phased-array radar, a UWB impulse X-band imaging system, and his “quasi-optical imaging system (with the big parabolic dish).”

Photo 3: This shows impulse rail synthetic aperture radar (SAR) in action, one of many SAR imaging systems developed in Charvat’s basement-garage lab.

Photo 3: This photo shows the impulse rail synthetic aperture radar (SAR) in action, one of many SAR imaging systems developed in Charvat’s basement-garage lab.

Photo 4: Charvat built this S-band, range-gated frequency-modulated continuous-wave (FMCW) rail SAR imaging system

Photo 4: Charvat built this S-band, range-gated frequency-modulated continuous-wave (FMCW) rail SAR imaging system.

Photo 5: Charvat designed an S-band near-field phased-array imaging system that enables through-wall imaging.

Photo 5: Charvat designed an S-band near-field phased-array imaging system that enables through-wall imaging.

Photo 5: Charvat's X-band, range-gated UWB FMCW rail SAR system is shown imaging his bike.

Photo 6: Charvat’s X-band, range-gated UWB FMCW rail SAR system is shown imaging his bike.

Photo 7: Charvat’s quasi-optical imaging system includes a parabolic dish.

Photo 7: Charvat’s quasi-optical imaging system includes a parabolic dish.

To learn more about Charvat and his projects, read this interview published in audioXpress (October 2013). Also, Circuit Cellar recently featured Charvat’s essay examining the promising future of small radar technology. You can also visit Charvat’s project website or follow him on Twitter @MrVacuumTube.

Mandalas Blend Technology and Spirituality

Multimedia artist Leonardo Ulian’s work includes his stunning “Technological Mandala” series, in which he precisely arranges tiny electrical and computer components to create colorful and symmetrical mandalas. In Hindu and Buddhist cultures, a mandala is a geometric and spiritual artwork representing the universe and is used in meditation. In this interview, Leonardo discusses his background, artwork, and inspiration for blending technological and ephemeral themes.—Mary Wilson, Managing Editor

 

MARY: Where were you born and how long have you lived in London?

LEONARDO: I come from a little village called Ruda, situated in the northeast region of Italy, Friuli-Venezia Giulia. I have lived in London since 2004.

Technological Mandala 17: Electronic components, copper wire, paper, 72 cm x 72 cm, 2013 (closeup),

Technological Mandala 17: Electronic components, copper wire, paper, 72 cm x 72 cm, 2013 (closeup). (Photo courtesy of Leonardo Ulian)

MARY: I understand you started out pursuing a degree in micro-electronics, then trained as a graphic designer before earning a fine arts degree. Can you tell me about your education and what made you turn your training toward the arts?

LEONARDO: My first attempt to do art was more related to the activity of just making things. Since I was very young, I always liked to play with hammers, nails, pieces of wood, and other bits and pieces in order to make my own little toys. But more than anything else, I liked to open old radios to see what was hiding inside.

In the 1980s, I attended an electronics school, also because I was fascinated by the new technology revolution of that period. I do remember myself stuck in front of the television watching an American TV series about robots, computers, and all that sort of stuff. While I was studying electronics I attended an art course and I specialized in airbrush hyper-realistic painting techniques. I then studied graphic design and I worked as a graphic designer and photo-retoucher for several years until I moved to London where I obtained my BA degree in fine art.

Technological Mandala 17: Electronic components, copper wire, paper, 72 cm x 72 cm, 2013.

Technological Mandala 17: Electronic components, copper wire, paper, 72 cm x 72 cm, 2013.

MARY: How did you come up with the idea for the “Technological Mandala” series? What was your inspiration and what are you trying to convey with these pieces that solder together electrical components, circuitry, and microchips?

LEONARDO: I liked the idea of combining different worlds such as spirituality and mandalas with technology and underlining the fact that electronic technology devices have become fundamental for our daily lives, almost something to worship.

I am also fascinated by the pure exercise of geometry used for the construction of the traditional mandalas—an ordered representation that is used to explain something that probably has nothing to do with geometry, which is the meaning of everything we perceive around us as living beings. I guess my artistic and spiritual research have led me to discover the world of mandalas.

I am not a spiritual person, or at least not in the traditional manner. And I am not particularly polarized with a specific belief. But I do like the idea of a world made with infinite connections among persons, objects, or places, like the connections I make in my technological mandalas. I also like to believe that what happens in one of the parts of the connection can affect the others as well.

Electronic components have always fascinated me; there was something in them that has attracted my fantasy since I was very young. I always asked myself how these little things were able to do what they do within electronic devices. After my studies in fine art, I started to think about my old passions and interests in a different way. This is why now, in my eyes, the electronic components have lost their real functionality in order to become ephemeral objects able to trigger the eyes and minds of the viewers, but in a different manner.

Technological Mandala 38: Electronic components, white Perspex, triple mounting board, 60 x 60 cm, 2013 (close up).

Technological Mandala 38: Electronic components, white Perspex, triple mounting board, 60 cm x 60 cm, 2013 (close-up). (Photo courtesy of Leonardo Ulian)

MARY:  Can you describe how you created the pieces? The materials and techniques you used?

LEONARDO: I make the basic geometry design in a computer. I print the resulting image onto paper, and then I bring in countless electronic components—some recycled but most bought from online websites—to fill in the shape I have created. I spend hours online researching nice and colorful electronic components. The difficulty is that nowadays technology is moving toward miniaturizing the electronic components, and quite often they do not have any color code.

MARY: You started the series two years ago. Is it now complete?

LEONARDO: The series isn’t yet completed, it’s a work in progress and I do not know when it will be finished. I guess the series is evolving as the technology—especially the electronic one—is changing rapidly.

Technological Mandala 02 (the beginning). Electronic components, microchip, wood frame, 120 x 20 cm, 2012.

Technological Mandala 02 (the beginning). Electronic components, microchip, wood frame, 120 cm x 20 cm, 2012. (Photo courtesy of Leonardo Ulian)

MARY: Do you have other artwork, such as “Technological Mandala,” that presents technology in an unconventional and thought-provoking way? Can you tell me more about that work?

LEONARDO: One of my early pieces is called “Now and Forever.” It’s an old petrol lantern modified in order to have, instead of the real flame, a mini-LCD screen with a video of it. The virtual flame within the mini screen is powered by a DVD player instead of the petrol, and it could run forever—or at least until there is no longer electricity available.

"Now and Forever" (Photo courtesy of Leonardo Ulian)

“Now and Forever” (Photo courtesy of Leonardo Ulian)

MARY: What technologies most interest you? Do any of them intrigue you as inspiration for future projects? If so, how might you use them?

LEONARDO: I do not have a particular interest in a specific piece of technology; I like to pick up things that stimulate my imagination. But, among other things, I am fascinated by magnetic fields and how the spectator could interact with them in order to generate art.

The piece “Close to the Essence” explores my interest in magnetic fields. It is a system of elements, like a hi-fi system, that becomes a totem able to interact with the spectator. The whole structure becomes a giant theremin I made using three simple AM radios, and the sound generated by the sculpture varies according to the proximity of the viewers.

"Close to the Essence" (Photo courtesy of Leonardo Ulian)

“Close to the Essence” (Photo courtesy of Leonardo Ulian)

MARY: What project are you currently focusing on?

LEONARDO: At the moment I am focused on further developing the idea started with the “Technological Mandala” series.

MARY: Do you have a dream project, something you are resolved to do sometime during your artistic career?

LEONARDO: I do not have a specific dream project, although my sketchbooks are full of ideas. I try to work day by day in order to produce things I am happy with. I have to say that almost always I have doubts about the things I make, but this keeps me going forward to create the next piece.

Technological Mandala 05: Electronic components, microchip, wood frame, 60 x 57 cm, 2012. (Photo courtesy of Leonardo Ulian)

Technological Mandala 05: Electronic components, microchip, wood frame, 60 cm x 57 cm, 2012. (Photo courtesy of Leonardo Ulian)

'Dardoby"

“Dardoby” (Photo courtesy of Leonardo Ulian)

MARY: You are a self-described multimedia artist. Can you tell me about some of your other artistic pursuits, including The Apathy Band you co-founded?

LEONARDO: I do like to think that art can explore different fields, as the great master Leonardo da Vinci did in his practice. The Apathy Band is an open project created by the artists Bob and Roberta Smith and I am one of the co-founders. The instruments I play in the band are toys I have accurately modified, like old electronic keyboards or electronic gizmos and animated toys. Two examples are the Dardomin, a theremin I created using AM radios, and the Dardoby, a circuit-bent Furby toy puppet I use to generate unexpected sound. I have also collaborated with the artistic duo Marotta & Russo to create the soundtracks of their videos. (Refer to “Timeline” and “Netopia.”)

Leonardo Ulian has had numerous solo exhibitions in London and elsewhere. He is the recipient of the Owen Rowley Award, London (UK), and the Italian national prize Stamps of the XX Century. You can follow Leonardo on Twitter at @ulianleonardo.

Technological Mandala 29: Electronic components, copper wire, paper, 120 cm x 120 cm, 2013. (Photo courtesy of Leonoard Ulian)

Technological Mandala 29: Electronic components, copper wire, paper, 120 cm x 120 cm, 2013. (Photo courtesy of Leonardo Ulian)

 

Centrical Bonsai Tree: Electronic components, cement and steel base, 135 cm x 35 cm x 35 cm, 2013 (close-up).

Centrical Bonsai: Tree, electronic components, cement and steel base, 135 cm x 35 cm x 35 cm, 2013 (close-up). (Photo courtesy of Leonardo Ulian)

Centrical Bonsai Tree: Electronic components, cement and steel base, 135 cm x 35 cm x 35 cm, 2013 (close-up).

Centrical Bonsai: Tree, electronic components, cement and steel base, 135 cm x 35 cm x 35 cm, 2013. (Photo courtesy of Leonardo Ulian)

 

All-Programmable SoC Solution

Anyone creating a complex, powerful digital design may want to turn to a single device that integrates high-speed processing and programmable logic.

In Circuit Cellar’s April issue, columnist Colin O’Flynn explores using the Xilinx Zynq  Z-7020 All Programmable SoC (system-on-a-chip) as part of the Avnet ZedBoard development board.

“I used a Xilinx Zynq SoC device, although Altera offers several flavors of a similar device (e.g., the Cyclone V SoC, the Arria V SoC, and the Arria 10 SoC), and Microsemi offers the SmartFusion2 SoC FPGA,” O’Flynn says in his article. “The Xilinx and Altera devices feature a dual-core ARM Cortex-A9 processor, whereas the Microsemi devices feature a less powerful Cortex-M3 processor. You may not need a dual-core A9 processor, so ‘less powerful’ may be an advantage.”

While O’Flynn’s article introduces the ZedBoard, he notes many of its specifics also apply to the MicroZed board, a less expensive option with a smaller SoC. Xilinx’s Zynq device has many interesting applications made highly accessible through the ZedBoard and MicroZed boards, he says.

O’Flynn’s discussion of the Zynq SoC device includes the following excerpt. (The April issue, which includes O’Flynn’s full article, is available for membership download or single-issue purchase.)

WHERE’S THE BEEF?
Originally, I had planned to describe a complete demo project in this article. I was going to demonstrate how to use a combination of a custom peripheral and some of the hard cores to stream data from a parallel ADC device into DDR memory. But there wasn’t enough room to introduce the tools and cover the demo, so I decided to introduce the Zynq device (using the ZedBoard).

A demo project is available at ProgrammableLogicInPractice.com. Several tutorials for the Zynq device are available at xilinx.com and zedboard.org, so there isn’t any point in duplicating work! I’ve linked to some specific tutorials from the April 2014 post on ProgrammableLogicInPractice.com. Photo 1 shows the hardware I used, which includes a ZedBoard with my custom OpenADC board connected through the I/O lines.

An Avnet ZedBoard is connected to the OpenADC. The OpenADC provides a moderate-speed ADC (105 msps), which interfaces to the programmable logic (PL) fabric in Xilinx’s Zynq device via a parallel data bus. The PL fabric then maps itself as a peripheral on the hard-core processing system (PS) in the Zynq device to stream this data into the system DDR memory.

Photo 1: An Avnet ZedBoard is connected to the OpenADC. The OpenADC provides a moderate-speed ADC (105 msps), which interfaces to the programmable logic (PL) fabric in Xilinx’s Zynq device via a parallel data bus. The PL fabric then maps itself as a peripheral on the hard-core processing system (PS) in the Zynq device to stream this data into the system DDR memory.

FPGA PROCESSOR DESIGN 101
Even if you’re experienced in FPGA design, you may not have used Xilinx tools for processor-specific design. These tools include the Xilinx Platform Studio (XPS) and the Xilinx Software Development Kit (SDK). Before the advent of hard-core processors (e.g., Zynq), there have long existed soft-core processors, including the popular Xilinx MicroBlaze soft processor. The MicroBlaze system is completely soft core, so you can use the XPS tool to define the peripherals you wish to include. For the Zynq device, several hard-core peripherals are always present and you can choose to add additional soft-core (i.e., use the FPGA fabric) peripherals.

In a future article I will discuss different soft-core processor options, including some open-source third-party ones that can be programmed from the Arduino environment. For now, I’ll examine only the Xilinx tools, which are applicable to the Zynq device, along with the MicroBlaze core.

The ARM cores in the Zynq device are well suited to run Linux, which gives you a large range of existing code and tools to use in your overall solution. If you don’t need those tools, you can always run on “bare metal” (e.g., without Linux), as the tools will generate a complete base project for you that compiles and tests the peripherals (e.g., printing “Hello World” out the USART). To give you a taste of this, I’ve posted a demo video of bringing up a simple “Hello World” project in both Linux and bare metal systems on ProgrammableLogicInPractice.com.

The FPGA part of the Zynq device is called the programmable logic (PL) portion. The ARM side is called the processing system (PS) portion. You will find a reference to the SoC’s PL or PS portion throughout most of the tutorials (along with this article), so it’s important to remember which is which!

For either system, you’ll be starting with the XPS software (see Photo 2). This software is used to design your hardware platform (i.e., the PL fabric), but it also gives you some customization of the PS hard-core peripherals.

This is the main screen of the Xilinx Platform Studio (XPS) when configuring a Zynq design. On the left you can see the list of available soft-core peripherals to add to the design. You can configure any of the hard-core peripherals by choosing to enable or disable them, along with selecting from various possible I/O connections. Additional screens (not shown) enable you to configure peripherals addressing information, configure I/O connections for the soft-core peripherals, and connect peripherals to various available extension buses.

Photo 2: This is the main screen of the Xilinx Platform Studio (XPS) when configuring a Zynq design. On the left you can see the list of available soft-core peripherals to add to the design. You can configure any of the hard-core peripherals by choosing to enable or disable them, along with selecting from various possible I/O connections. Additional screens (not shown) enable you to configure peripherals addressing information, configure I/O connections for the soft-core peripherals, and connect peripherals to various available extension buses.

MAKING THE CONNECTION
For example, clicking on the list of hard-core peripherals opens the options dialogue so you can enable or disable each peripheral along with routing the I/O connections. The ZedBoard’s Zynq device has 54 multipurpose I/O (MIO) lines that can be used by the peripherals, which are split into two banks. Each bank can use different I/O standards (e.g., 3.3 and 1.5 V).

Enabling all the peripherals would take a lot more than 54 I/O lines. Therefore, most of the I/O lines share multiple functions on the assumption that every peripheral doesn’t need to be connected. Many of the peripherals can be connected to several different I/O locations, so you (hopefully) don’t run into two peripherals needing the same I/O pin.

Almost all of the peripheral outputs can be routed to the PL fabric as well under the name EMIO, which is a dedicated 64-bit bus that connects to the PL fabric. If you simply wish to get more I/O pins, you can configure these extra pins from within XPS. But you can also use this EMIO bus to control existing cores in your FPGA fabric using peripherals on the Zynq device.

Assume you had an existing FPGA design where you had an FPGA core doing some processing connected to a microcontroller or computer via I2C, SPI, or serial. You could simply connect this core to the appropriate PS peripheral and port the existing code onto the Zynq processor by changing the low-level calls to use the Zynq peripherals. You may eventually wish to change this interface to the peripheral bus, the AMBA Advanced eXtensible Interface (AXI), for better performance. However, using standard peripherals to interface to a PL design can still be useful for many cores for which you have extensive existing code.

The MIO/EMIO pins can even be used in a bit-banging fashion, so if you need a special device or core control logic, it’s possible to quickly develop this in software. You can then move to a hardware peripheral for considerably better performance.

O’Flynn’s article goes on to discuss in greater detail the internal buses, peripherals, and taking a design from hardware to software. For more, refer to Circuit Cellar‘s  April issue and related application notes posted at O’Flynn’s companion site ProgrammableLogicInPractice.com.

MCU-Based Experimental Glider with GPS Receiver

When Jens Altenburg found a design for a compass-controlled glider in a 1930s paperback, he was inspired to make his own self-controlled model aircraft (see Photo 1)

Photo 1: This is the cover of an old paperback with the description of the compass-controlled glider. The model aircraft had a so-called “canard” configuration―a very modern design concept. Some highly sophisticated fighter planes are based on the same principle. (Photo used with permission of Ravensburger.)

Photo 1: This is the cover of an old paperback with the description of the compass-controlled glider. The model aircraft had a so-called “canard” configuration―a very modern design concept. Some highly sophisticated fighter planes are based on the same principle. (Photo used with permission of Ravensburger.)

His excellent article about his high-altitude, low-cost (HALO) experimental glider appears in Circuit Cellar’s April issue. The MCU-based glider includes a micro-GPs receiver and sensors and can climb to a preprogrammed altitude and find its way back home to a given coordinate.

Altenburg, a professor at the University of Applied Sciences Bingen in Germany, added more than a few twists to the 80-year-old plan. An essential design tool was the Reflex-XTR flight simulation software he used to trim his 3-D glider plan and conduct simulated flights.

Jens also researched other early autopilots, including the one used by the Fiesler Fi 103R German V-1 flying bomb. Known as buzz bombs during World War II, these rough predecessors of the cruise missile were launched against London after D-Day. Fortunately, they were vulnerable to anti-aircraft fire, but their autopilots were nonetheless mechanical engineering masterpieces (see Figure 1)

“Equipped with a compass, a single-axis gyro, and a barometric pressure sensor, the Fiesler Fi 103R German V-1 flying bomb flew without additional control,” Altenburg says. “The compass monitored the flying direction in general, the barometer controlled the altitude, and the gyro responded to short-duration disturbances (e.g., wind gusts).”

Figure 1: These are the main components of the Fieseler Fi 103R German V-1 flying bomb. The flight controller was designed as a mechanical computer with a magnetic compass and barometric pressure sensor for input. Short-time disturbances were damped with the main gyro (gimbal mounted) and two auxiliary gyros (fixed in one axis). The “mechanical” computer was pneumatically powered. The propeller log on top of the bomb measured the distance to the target.

Figure 1: These are the main components of the Fieseler Fi 103R German V-1 flying bomb. The flight controller was designed as a mechanical computer with a magnetic compass and barometric pressure sensor for input. Short-time disturbances were damped with the main gyro (gimbal mounted) and two auxiliary gyros (fixed in one axis). The “mechanical” computer was pneumatically powered. The propeller log on top of the bomb measured the distance to the target.

Altenburg adapted some of the V-1′s ideas into the flight control system for his 21st century autopilot glider. “All the Fi 103R board system’s electromechanical components received an electronic counterpart,” he says. “I replaced the mechanical gyros, the barometer, and the magnetic compass with MEMS. But it’s 2014, so I extended the electronics with a telemetry system and a GPS sensor.” (See Figure 2)

Figure 2: This is the flight controller’s block structure. The main function blocks are GPS, CPU, and power. GPS data is processed as a control signal for the servomotor.

Figure 2: This is the flight controller’s block structure. The main function blocks are GPS, CPU, and power. GPS data is processed as a control signal for the servomotor.

His article includes a detailed description of his glider’s flight-controller hardware, including the following:

Highly sophisticated electronics are always more sensitive to noise, power loss, and so forth. As discussed in the first sections of this article, a glider can be controlled by only a magnetic compass, some coils, and a battery. What else had to be done?

I divided the electronic system into different boards. The main board contains only the CPU and the GPS sensor. I thought that would be sufficient for basic functions. The magnetic and pressure sensor can be connected in case of extra missions. The telemetry unit is also a separate PCB.

Figure 3 shows the main board. Power is provided by a CR2032 lithium coin-cell battery. Two low-dropout linear regulators support the hardware with 1.8 and 2.7 V. The 1.8-V line is only for the GPS sensor. The second power supply provides the CPU with a stable voltage. The 2.7 V is the lowest voltage for the CPU’s internal ADC.

It is extremely important for the entire system to save power. Consequently, the servomotor has a separate power switch (Q1). As long as rudder movement isn’t necessary, the servomotor is powered off. The servomotor’s gear has enough drag to hold the rudder position without electrical power. The servomotor’s control signal is exactly the same as usually needed. It has a 1.1-to-2.1-ms pulse time range with about a 20-ms period. Two connectors (JP9 and JP10) are available for the extension boards (compass and telemetry)..

I used an STMicroelectronics LSM303DLM, which is a sensor module with a three-axis magnetometer and three-axis accelerometer. The sensor is connected by an I2C bus. The Bosch Sensortec BMP085 pressure sensor uses the same bus.

For telemetry, I applied an AXSEM AX5043 IC, which is a complete, narrow-band transceiver for multiple standards. The IC has an excellent link budget, which is the difference between output power in Transmit mode and input sensitivity in Receive mode. The higher the budget, the longer the transmission distance.

The AX5043 is also optimized for battery-powered applications. For modest demands, a standard crystal (X1, 16-MHz) is used for clock generation. In case of higher requirements, a temperature-compensated crystal oscillator (TCXO) is recommended.

The main board’s hardware with a CPU and a GPS sensor is shown. A CR2032 lithium coin-cell battery supplies the power. Two regulators provide 1.8  and 2.7 V for the GPS and the CPU. The main outputs are the servomotor’s signal and power switch.

Figure 3: The main board’s hardware with a CPU and a GPS sensor is shown. A CR2032 lithium coin-cell battery supplies the power. Two regulators provide 1.8 and 2.7 V for the GPS and the CPU. The main outputs are the servomotor’s signal and power switch.

Altenburg’s article also walks readers through the mathematical calculations needed to provide longitude, latitude, and course data to support navigation and the CPU’s most important sensor— the u-blox Fastrax UC430 GPS. He also discusses his experience using the Renesas Electronics R5F100AA microcontroller to equip the prototype board. (Altenburg’s glider won honorable mention in the 2012 Renesas RL78 Green Energy Challenge, see Photos 2 and 3).

The full article is in the April issue, now available for download by members or single-issue purchase.

One of the final steps is mounting the servomotor for rudder control. Thin cords connect the servomotor horn and the rudder. Two metal springs balance mechanical tolerances.

Photo 2: One of the final steps is mounting the servomotor for rudder control. Thin cords connect the servomotor horn and the rudder. Two metal springs balance mechanical tolerances.

Photo 2: This is the well-equipped high-altitude low-cost (HALO) experimental glider.

Photo 3: This is the well-equipped high-altitude low-cost (HALO) experimental glider.