7th ict Handshake event

Last Friday (2020-05-15) in the 7th ICT handshake organized by University Of Nicosia we presented technologies that will be used for the Mari-Sense project. In this presentation we explained the function and design process of embedded systems and how these will be used to enhance processing at the edge (in Greek).

Platforms

The Problem

Hardware and Firmware development is essential for the age of Internet of Things or for the more traditional term embedded systems. Recently more and more processing is required to be performed closer at the physical locations where the sensory or IoT devices exist, called edge processing. The traditional way of developing such systems is using application processor systems running on Linux.

Development of such products is fast due to the ecosystem using commercially available platforms and proof of concept projects are easy to achieve; However when someone tries to make the necessary modifications to create a custom product, comply with certifications and perform changes required to make it a viable product, soon he/she may fail short, as:

  1. There is not much control for customizing the core boards; Design from scratch is the only option if a single board is needed
  2. The base hardware is complicated for the majority of  applications
  3. Highly skilled hardware engineers and sophisticated tools are needed
  4. Cost for production of a custom featured PCB usually is much higher for individual production
  5. Critical parts are hard to source in small quantities
  6. Designs may not be efficient from power or performance perspective

So many times we are obliged to select and change parts because of the limitations of our mainstream microcontrollers to a higher end one or we need to add external logic and circuits to accommodate richer input-output architecture.

Wouldn’t be great to have a uniform polymorphism platform that can scale easily to work with for the majority of our projects?

Another aspect that is considered is design verification. Embedded systems usually need to have real-time performance, thus classic debugging (step-through) under real-time conditions is not always possible or is an additional challenge. Stack checking on RTOS or timings are not easily observed with accuracy without an impact on performance.

Wouldn’t be great to have a much easier time to debug embedded systems?

our Solution

Microcontrollers offer a small footprint system with high level of integration (memories, peripherals etc), but sometimes the internal peripherals or the processing capacity are not adequate to tackle with more demanding applications. FPGA on the other side are more flexible and capable but usually they are not the best for control flows and require more knowledge for development. Edge processing sometimes require a higher processing capacity at a lower power rate.

We created an embedded platform with its firmware ecosystem, that allows fast application development, without compromising the later steps for final production. In order to combine the benefits of both microcontrollers and FPGAs the PerseusCLE was built.

This platform provides the following key features:

Key Features

  1. Simple 2 or 4 layer PCB, which is within a medium skilled engineer to modify
  2. 32-bit microcontroller
  3. Programmable Hardware to create custom peripherals and interfaces
  4. A firmware framework that allows fast development in C language
  5. A compact and extensible platform
  6. Support of External Hardware parts for specific interfaces (motors, servos etc)

Specs

  1. Wide range DC 9-36V ac/dc supply voltage
  2. MCF52258 Coldfire @48MHz, 512KB Flash, 64KB RAM
  3. Spartan XC6S-9LT FPGA @48MHz
  4. 24MB/sec Link between MCU-FPGA, memory mapped
  5. RTOS based design framework
  6. Developed with and supporting TDD or Unit Testing
  7. Olimex UEXT Connectors for external modules

The platform allows for companies or individuals to develop prototypes fast, but at the same time  provide easier migration to a final product, with parts and designs that can be manipulated by a medium skilled engineer.

The programmable hardware can provide one more level of expansion thus providing a more reach peripheral set than the ones included in of the shelf microcontrollers.

This is a simple universal design that integrates a microcontroller and an FPGA in order to perform hardware acceleration, functional and I/O expansion, or design verification of an embedded system, using a minimum amount of chips.

PerseusCLE Architecture
PerseusCLE Architecture

The two major parts are interlinked with a high speed connection to enable FPGA mapping inside the microcontroller’s memory space, giving programming simplicity for the firmware, while achieving high speed transfers, and allows use of the internal MCU DMA. Eventually this provides a two chip solution and simple two layers PCB which allows low cost on low production quantities.

Perseus CLE Board
Perseus CLE Board

To support the potential uses of the hardware a firmware stack is also provided, that enables programming the FPGA configuration from the SD card, and provides the access methods to the FPGA side along with drivers for Serial, USB, SD, FATFS etc. The stack is based on a modified version of FunkOS RTOS, and the extensions provided are developed using TDD to ensure high quality and reliability of the system.

Using FPGAs moves the programmable barrier lower to the layer stacking of a product.

Example:

On the left side we see the traditional CPU stack. If we upgrade the CPU we need to change the Driver/OS layer to fit the new CPU/Hardware

On the right side the FPGA device is replaced. We need to “recompile” the FPGA-Logic (Program) to the new device. Driver/OS do not need to change!

MCU vs FPGA Layer Stack Comparison
MCU vs FPGA Layer Stack Comparison

The FPGA VHDL code flow for simulation uses UVVM and OSVVM to support a solid verification strategy. Along with the hardware, we provide source code with examples for the microcontroller, and example VHDL interface.

Applications

This platform can be used very effectively for the following applications.

Drones/UAV

As the hardware is flexible, controlling multiple motors and acquiring sensor data from multiple sensors, make this platform ideal. The MCU can be off-loaded from low-level motor driving, while concentrating on the main control system. The FPGA can handle the low level functions along with the sensor fusion for multiple sources (ie. camera).

3D Printers

Having a platform that can handle more motors can create a more capable 3D printer or even a 3D printer in combination with a lathe. Again the high level functions can run on the controller while the FPGA keeps track of the precision in time.

Small Video Applications

The video signals stopped to be analog and transformed to high-speed interfaces. The Spartan 6 series can handle these and create video input or output generators (or a combination there-off) while the microcontroller can handle the content (ie. transfer it through the USB). No more complex CPU high frequency arrangements are required.

Edge Processing

As the FPGA can offer a high degree of parallelization, applications that require a high number of parallel units or hardware acceleration are good candidates for this platform. For example this platform is going to be used in the MARI-Sens project for signal classification at the edge.

Embedded System Controller

Controlling a divert number of actuators and sensors hasn’t be easier. Controlling Stepper motors, LED arrays, BLDC or gathering sensor data from different sources can be done easily. The FPGA can include the low level logic of control and pre-processing while the MCU handles the control and connectivity side of the application.

Embedded Design Verification For many applications the FPGA is overkill device to have. However you may be able to test the real-time embedded firmware, without any performance impact if you use the FPGA for capturing processor data. For example stack checking in hardware is very efficient and accurate. So you can use the combined system to trace events, check stacks, and any other aspects of your embedded system before you deploy it and gain more confidence of the quality of your product. 

Other solutions

Well, why should I use this platform while I can get similar setups from the FPGA vendors? I can get single or dual ARM cores along with a larger set of available logic.

This is true, however, these solution are micro-processor based and not micro-controller based. The devices are huge BGA, and they still need a lot of peripherals to make it work (SDRAM, Flash etc). Our solution offers a two-chip solution (MCU and FPGA) which is more compact and less power hungry and within design reach of a small or medium sized company.

What is the advantage over microcontroller based solution that contains logic?

Using an external FPGA device your solution is not bonded to a specific microcontroller or FPGA device. The split architecture allows more flexibility. You can scale up capacity for example using the same footprint (just replace the FPGA with a higher capacity logic one), or you may decide you need another processor (ie. Coldfire or Kinetis) that support the same inter-chip interface.

If you are interested to learn more send us a message.

Firmware and Software

In embedded systems the term firmware is very common and describes the software that runs close to the hardware usually with limited resources and almost always in a deterministic execution time frame. Don’t be fooled however; Firmware can be many thousands of code lines and be a complete application.

And how you debug such a piece of software? It is often stated that debugging is an art. Imagine a motor control system where you need to step code (ie. stop executing the program) while the motor is running. It would be really hard to trace a problem in this case. So experts in the field use multiple approaches often not found in usual software development projects to trace intermittent errors or problems that relate with the unpredictable environment under real-time.

Software/firmware quality is something which cannot be easily assessed by non-experts. There are a few guidelines though, which give an indication of the written code quality.

  • How many bugs are revealed during testing?
  • How difficult are these faults to be pinpointed?
  • How easy is to change operation or add features?
  • How fast can you port to other architectures?

The first rule of debugging in embedded systems is to avoid creating the bugs in the first place. A good architectural design and coding practice are required to achieve a low bug count and reduce debug time. On a medium scale of an embedded project expect a significant amount of time before you see any actual line of code. This time goes for architectural decisions and tests that will pay-off later with faster coding and a quality product.

From almost 18 years of embedded firmware experience we have mastered these techniques. Using Test Driven Development methods, layered architectures, timing evaluations, best coding practices and system testing we achieve our goals on time. Furthermore we leave support for debugging in cases these are needed during later phases of the product’s lifecycle.

We use C and Assembly, creating code that can be ported to different microcontroller architectures fast and support development or product with Python and GUI scripting. Our debug strategies include combination of debuggers, oscilloscopes and logic analyzers to effectively pin-point difficult to resolve issues if ever arise.

Hardware Picture

Hardware Design

Hardware design starts from the requirements document. Then a detailed specification is created which drives the schematic drawing phase. An often neglected part is the selection of parts to accomplish an electronic design. Selecting parts with high availability and less lead delivery times is an important task. Another aspect is selecting the components packages as these affects the board (PCB) area and the assembly process. A denser PCB may require higher manufacturing class and thus increase production costs. A good understanding of the PCBA production phases is required to have an efficient design that can be produced smoothly in quantities without disruptions.

Producing is not the end of the line though. Testing is another major factor which should be considered. There are many test strategies employed depending on technology used, production quantities and yield.

Understanding the above issues explains why there are many failures in kick-start type projects when it comes to hardware. Take the wrong decisions and you may end up well out of your estimated cost and time budget.

Our experience in hardware offers many years of expertise in embedded systems design starting from specifications down to product support. Our portfolio of work includes dc motors, sensing, microcontrollers and FPGAs.