Tag: embedded

Writing Better Embedded Firmware

Co-operative multitasking I think this is the most simple, organized and suitable way to write code for real-time embedded systems. This is simple state machine based model which responds well in real-time. In this case I am using PIC32MX340F512L MCU, you can adopt this code for your favorite microcontroller.

First we write a simple main function where other functions will be called:

// main.c file
// add pic32 lib
#include
 
// prototype the functions
void blinky_init(void);
void blinky(void);
void button_init(void);
void button(void);
 
int main (void)
{
	// initialize the apps
	blinky_init();
	button_init();
	// ....
 
	// run the app(s)
	while (1)
	{
		blinky();
		button();
		// ....
	}
}

In above code snippet we have added processor related libraries, declared the prototypes of the functions which we are going to use and then started the main function. In the main function, we have first initialized the peripherals which we are going to use. In this case only two types, an LED and a push button. The main operations of the peripherals are handled in the blinky(); and button(); functions. Now we look at these functions: (continue reading…)

Share

Embedded Control or PLC?

This is a hot topic in every services based company. Often the manager question the engineers about what the solution should be based upon. Here are a few things which we need to consider before deciding what to propose:

  • The time: Time is probably the most important deciding factor to decide. Embedded systems need some considerable time on R&D. They often need revision both in firmware as well as hardware. This may cause to miss the opportunity window. And the opportunity is missed, R&D and expertise aren’t going to buy investment returns and the very continuation of business is endangered.
  • The application: Often the application itself defines what to use. A small wrist watch like device for patient pulse monitoring can never use a PLC. Similarly PLCs are preferred in industrial applications. This reduces the dependency on a particular control developer and the industrialist can choose from the pool of control engineers readily available in the market.
  • The quantity: Small quantities favor PLC as the investment in R&D does not worth small quantity. PLC is ready-made product and with right application development skills you can save some investment on time hence the profit is better. When the quantity is huge, Embedded control systems are preferred choice.
  • Your expertise: You are a PLC expert and have never taken a commercial project based on embedded systems, go with PLC. If you confident on your embedded skills then try to en-cash that.
  • Development budget: Who will invest in R&D when the customer is only willing to pay which hardly covers the equipment and installation costs? Embedded controls need special investment during the development process. If there are available modules which need to be integrated, even then there is development cost which can not be over-sighted or ignored.
  • End solution price per unit: Price per unit decreases with increase in quantity and Embedded controls favor this.
Share

Embedded Systems for Electronics Engineers

Embedded systems is a very interesting field which needs to deal with software as well as hardware at the same time. To write proper software it is necessary to understand the underlying hardware. Also software knowledge is a must to actually perform useful tasks. Often software engineers only write the software for embedded devices which we call firmware. They do it because they are taught and trained to do so. On the other hand, hardware or electronics engineers are more inclined towards the “hardware” which include analog and digital circuit design, PCB design, troubleshooting, hardware installation and support. Writing code is not their primary job as taught in university courses. However, they have a great advantage over software engineers that they understand the hardware architecture better. They know how the processor has to interact with the analog circuitry and how it will affect the overall performance. Often there are things that can be done either through hardware or software. For example an application requires a trigger over a certain voltage input. Now is it feasible to use a fixed voltage comparator in the hardware or to read the analog value and define the threshold in the software? Only a person familiar with the actual analog signal and its behavior can decide what to do. That is why electronic engineers with strong firmware/software skills are preferred.

However, sometimes hardware skills are relatively irrelevant; for instance embedded Linux development. In this case software engineers have clear advantage as the very knowledge of every register and flag bits is not necessary. However, as I learned through my experience, if you are learning embedded Linux for the first time, it does not make you very different from the software guys as even they come up to a newer field except somebody is a Linux guru. An electronics engineer still has great chance to learn Linux during his course of career.

As the time is passing by, more and more products carry intelligence deeply embedded in them. Small, low-cost, power efficient microcontrollers are widely used to make things smarter. Every household product carries a small electronics running a little RTOS or pseudo code carrying that “little intelligence” to make them so. Therefore electronics engineers with strong background of hardware development must also invest some time and effort to learn writing firmware and should master C language as it is de-facto standard in embedded world. I remember when I was at University and used to pay special attention to the my C language course. This was because I liked coding. This effort paid me back in my professional career as I have been coding in C for more than seven years now. All in all, embedded systems is a great career for electronics engineers. However, they need to pay special attention to firmware as well as getting familiar with embedded Linux.

Share

What an Embedded Systems Developer Should Learn

I wonder there are so many things to learn for an embedded systems developer. This field is rapidly changing. What to learn to keep oneself up to date? Generally this industry is segmented into two portions. One the people who which design advanced DLD systems. These usually work on FPGA based SoC designing. Their tools and skills may include learning an IDE like that of Xilinx. The other guys usually used MCUs and microprocessors (like me). They write the firmware for these device and (usually) design the PCB as well. My focus is on the second type of people as this relates to me better.

Here are the things which I think, are necessary to learn:

  1. Hands on experience of at least two MCU families. One on the higher end and the other on the lower end. The higher end may be the ARM architecture. The low-end party should be the one which has tiny-miny MCUs like PIC or 8051 or may be AVR. There are times when you don’t need to use the horse power of ARM, so you need a small companion for that.
  2. Good PCB design tool like Diptrace (please forgive if you don’t like it). The Altium designer is a complete design suit not just for a single developer but for a whole team to system design, PCB design, software development and mechanical assembly in a single unified tool. Some people still are in love with older tools like OrCAD. I just prefer Diptrace over OrCAD.
  3. At least 2 good RTOSs
  4. Embedded Linux. Well, you at least need to have know-how of Embedded MPUs like Cortex-M8/9. Linux seems to me, the future and it would be norm to use Linux in most of the designs.
Share

This Industry is All About Change

“This industry is all about change. Those that facilitate change will win. Those that resist will suffer”.

Some days ago I was reading an online article. It was about 8-bit microcontroller market, probably some new series launch by a vendor. Above phrase was basically a comment which I loved so much that I decide to write a post about it. It touched my heart, basically!

Embedded systems is all about change. every now and then a new ASIC, microcontroller family, software, development kit etc. is added. A developer like me always wonders what to do and what to leave. There are so many things to do and an engineer’s resources are so small. Time is also an issue and managing time these days is difficult. But one thing is clear, this is the era of “change or die”. If you will change, you will live; if not, you are a dumb; and “dumb one will always die”.

There are some many fields within Embedded Systems, like MCUs, FPGAs, RF, HF, Control systems, Smart Energy, Power Electronics and bla bla with variety of tools to learn. As the time passes by, the need to change oneself rapidly also increases. Well, it’s a tough field, the Embedded Systems. But we have no option but to update ourselves, have we?

Share

Embedded Internet and Options

The largest part of my career was to design network connected devices also called “internet of things”. Ethernet has a very effective way to collect alarms and pass to a remote server, translate other protocols like RS232/485 to TCP, alarm systems, home automation and other applications. I had the chance to “taste” different embedded microcontrollers and TCP/IP stack to encounter. Device in the list include PIC18, PIC32, Stellaris controllers while the stacks include Microchip’s propriety TCP/IP stack, lwIP, uIP.

uIP is the simplest and smallest stack with minimal footprint, however, the available stack APIs are limited.

lwIP is probably the most used embedded TCP/IP stack used by dozens of vendors. Because of open source nature and the “operating system emulation layer”, it is adopted by many MCU vendors including some 8051 variants and ARM “cousins” use the same stack with necessary relative adoption.

Microchip TCP/IP has the limitation that it can be used only on Microchip product. However, it is the most complete and greatly organized TCP/IP stack I have seen. It has every thing, every set of protocols a developer may need with the great thing inherited by Microchip is the great documentation; everything very well explained with examples. The stack has built-in support for Ethernet as well as WiFi. Microchip has its own WiFi modules available which can be integrated with PIC MCUs via SPI bus. The stack fully supports TCP, UDP, HTTP, SNMP, SNTP, and virtually every protocol which an average Embedded Systems Engineer needs.

In a practical implementation of Ethernet connected devices, I came across on implementation of lwIP over Stellaris. One thing which stung me was that you need to build the file system (fs) using “makefsfile” utility just like “MPFS2″ utility. But it will give you plan C files to be compiled with source to burn into the device. Unlike this MPFS2 give a separate .bin file which you can upload onto the device “on-the-go”. This seems to me a big advantage of Microchip tools over lwIP implementation for Stellaris.

Welcome to the internet of things!

Share

Being an Embedded Designer in Pakistan

Being an embedded systems designer is itself very challenging. However, it further becomes difficult when you are in a country like Pakistan. There are many reasons which I have learnt through my personal experience of seven years in this industry. I am trying to summarize these here:

  • Getting a job is your dream field is difficult. There are a few companies who are in this field. There are even fewer who are actually doing the R&D, rest are in services. Because a lot of electronics, computer and software engineers come out of educational institutes and the business conditions are not great (2012), the competition is tough. You wouldn’t get great salary even if get the job. There are practically no funds available to get own business started (except ICT which is already controversial).
  • It is hard to get quality, quick and cheap PCB fab services here. There are only a few vendors and even a few who happily accept prototype quantities. People don’t understand that before going into production, several revisions may happen to finalize the PCB. And those who come to you for small quantities are your future potential customers bringing high volumes. But the mentality of doesn’t seem to change. The only service which I recommend is Elite Screens from Karachi.
  • You will need to import most of the components. The SMT components are just “unseen” here in under-educated market and modern designs use SMT components. The through-hole days are long gone.
  • Pakistani managers are carried away with wind and don’t undertake their limitations. even the designers get carried away. Everybody knows that ARM Cortex-A8 based Beagle board has come up with big success but trying to shift every design on it without actually analyzing the requirements is too ambitious. And most importantly the meager resources of a small company actually don’t allow to do so. Less than a 100o unit does not justify the price economics and with economics, you just can not proceed with a product launch.
  • As a matter of fact, our universities do not equip the young engineers with enough tools to fight in the market. The market is not local market but a global market. So we have to strive for at least two years to come with an idea what we are doing.
  • Project management is as important as designing. The manager must know what projects are being carried out, what resources are being used for what purpose, at a particular time, which resource is doing what. Unfortunately the lack of proper documentation and simple project management is lacking in our complete engineering environment.
  • Hardware takes much time to develop compared to software, so it must be planned well. Before designing or finalizing hardware design, near future needs must be considered. The hardware must be flexible enough to accommodate several niche of applications.
  • Getting good quality training sessions not so often and in some cases not at all also creates a widening gap between wish-list and actual development.
Share

Embedded Systems and Embedded Systems Developers

Although modern day technologies have now converged practically into embedded systems still there are people among us who still question what an embedded system is?

The field of embedded systems is a unique combination of softwar and hardware where the whole intelligence of the system is confined into the firmware of hardware residing indide hardware itself. Now what is firmware? Firmware is the software or intelligence portion of the systems which resides in the hardware, takes directions from hardware peripherals, processes  information, takes decisions and issues control signals to actuate outputs. The formost effrot in designing embedded systems is to reduce the physical footprint of the system to fit it into the space and weight constrained applications. Another design goal is to keep the cost as low as possible. The advantage of embedding the intelligence into the small hardware is to make efficient and cost effective systems, basically, to make small ordinary things much more smarter than before.

The example of embedded systems are everywhere which we use on daily bases like cell phones, the control in washing machine, tv and tv remote etc. One distinctive difference between general purpose computers and embedded computers is that they are application specific. Also the embedded systens are “all in one” systems based on small computer, peripherals, sensors, indicators, actuators and everything necessary to carryout a specific task, to fulfil a certain objective.

Becuase of their nature, the embedded systems designers must understand both software as well as hardware. only electronics engineer can not design good embeded systems and a software-only guy is incompatible with this field. There are two models of job models followed by companies mainly based on their resources. The large companies have specialist of hardware and software so the engineers need not to design everything. This does not mean that they don’t need to be familiar with each other’s domain as they need to coordinate with each other constantly and regularly. In small companies, the same guy has to do everything. the hardware as well as the firmware (embedded software). Also there are many other things which need to done like casing designs or at least considerable effort in determining the right enclosure of the product and its overall shape.

All in all embedded systems is an interesting field but it is demanding at the same time.

Share

  • Follow

  • Just a Moment Please

    Did you find what you were looking for on this website?






  • Disclaimer

    The information on this website is based on my personal views which may differ from my employer(s). The free material here to download is the work I have done in my free time and, though may seem resembling, does not belong to my current or previous employer(s). It is solely my own intellectual property.
  • Copyright © Electrodesigns.net 2011-12
    iDream theme by Templates Next | Powered by WordPress