Yearly Archives: 2012

I’m the PC: Reports of my death have been greatly exaggeraged

If you’ve been following up on the fight between PCs and Tablets, you’ve read many articles claiming that the PC is dead, that everyone  is using tablets and that you should forget about developing for the PC. I have only one word to say to this: Nonsense.
Let me explain why I think the industry is full of it.

First, remember that investors usually look for companies with potential for growth. Go look at any company and whether it makes 1 million or 1 billion doesn’t matter as much as  whether revenues are growing and what is their potential for growth. After all, investors want to end up with more money than they put in, and when a company’s revenues grow significantly quarter after quarter, it’s worth more (and investor’s share is therefore worth more). More importantly, it draws more investors that invest more money and allows earlier investors to cash out. Like any company, there comes a point where the market has been saturated and although you can still make money, the growth just isn’t there.  One example that comes to mind is Coca Cola. This is a very profitable company, but lets face it, anyone who wants a coke can already get it (unless you look at smaller growing markets). This isn’t the kind of thing hungry investors are looking at (no pun intended). Warren Buffet himself had difficulty knowing when to sell coke stock after it stopped rising, demonstrating that companies can be good investments and then
they’ll end up a thing of the past.

When looking at US Census information and other sources, its clear that most households that want a computer have one in the US. One source I found said that in the U.S, 68%
of households have a PC. Year after year, a new Intel processor comes out that’s faster and better; A new version of Windows/Office, etc comes along. Some people upgrade, more people buy. However, here comes the tablet and creates the same innovation paradigm that has happened countless times before: it enables people who previously didn’t have access to a computer to use a tablet to do many of the same things. At the same time, it cannibalizes PCs when people who aren’t power users just want
to surf the web and find a tablet more convenient.
This doesn’t signify the death of the PC. It signifies the death of the PC and its software as a hot investment area (which as I keep saying is all the industry is looking for and all most
want to report about).

Looking at many new software companies, making apps for iPhone/iPad/Android is the cool thing to do. This has an impact investment in development of products targeted for the PC. But the PC is still the workhorse for most, especially for professionals. In many cases, the tablet is inconvenient to work with. As an engineer, none of my engineering software runs on tablets. CAD design and similar work necessitates a mouse. Graphics Designers, game players, Video Editors, are just a few categories that might find tablets interesting for a few applications but could not afford to switch completely. So, unless someone realizes how to get a tablet to do all that nicely, switching just isn’t happening.

The tablet apps industry reminds me of the late 1990’s and early 2000’s, when everyone was trying to figure out how to make money off of anything internet related. Many companies spent large amounts of money acquiring customers with free products and services,hoping to convert them into paying customers. Some succeeded, most failed. A similar thing is happening with apps for tablets. Many apps are free or have a
paid version, with some apps copying others. Actually getting people to pay for apps is hard, especially when someone comes by and copies your app because you failed to find a sustainable competitive advantage. Unless you’re Rovio with Angry birds or you’re in the top apps list, you’re probably not rolling in cash.

With Microsoft now entering with its Surface tablet, I am betting some apple developers will switch to developing on Windows tablets as if it were the 1849 gold rush simply because it will seem like greener pastures and because early on it’s easier to differentiate yourself when the number of apps is relatively small. Microsoft is also apparently offering incentives which is what it did in the early windows days). Of course, this actually would required that the Surface tablet gains a measurable foothold with customers.

It’s easy to get caught in the hype. Looking around, tablets and ARM is everywhere, and everyone who can is building either apps processors or software apps. I believe in a few years it will mature and shed itself of the useless and hyped aspects of the industry (anyone remembers the I’m rich app for the iPhone?). Many companies developing Apps processors will be gone simply because they jumped on the same ship
as everyone else, only to realize margins are razor thin, R&D is very expensive and differentiation is difficult; aside from the fact that the major player Apple makes its own. If you’ll look around, PCs will still be there and software will still be developed for it. It will be done by fewer people, but it will also be more specialized and focused on core areas such as Math, Engineering, etc. All this will be painful, but it will set the stage for the next ideas to come around and attract the attention of investors.

Open Source UART Driver now on github

To  make it easier to access the code, I’ve added and improved it on github. It lets me fix and add features quickly.

I’ve restructured the code so the actual UART driver is separate from the example code. Adds a bit more complexity to the project, but makes it easier to reuse code.
It’s a nice example of creating portability in CCS projects.
The EZ430-RF2500 project also compiles but I haven’t tested it on real hardware yet.



Announcing: Free Open Source MSP430 UART Driver

I’ve received a lot of questions and requests for information and help on the MSP430 UART, so I decided to make available an driver for it. It’s simple but has plenty of flexibility.
Even more important, it abstracts a lot of the register controls to a level that most users should be comfortable using.

You can find the Driver and MSP430F5438 sample code for CCS here:

Download MSP430 UART Driver with F5438 Example

The code is heavily commented. More than just a useful driver, I intended it to be easy to use and a guide on using the UART module. My code uses plenty of tricks and pointers to make it flexible (and I might have overdone some of it), but I expect in the near future to complete support for the USART module (USCI is what the MSP430F5438 and similar devices have). Some basic support is there but USART isn’t tested.

UART Driver Organization


You can import the CCS project compile and run it on an F5438 Experimenter board.  Using it in your own project is simple, just import uart.h and uart.c and make sure to call the right functions.

Ultimately I have the following goals:
1) Support for most MSP430 devices and UART modules
2) Basic framing including CRC generation and checking
3) Example code for a variety of hardware platforms and variety of use cases

If you use it, feel free to let me know.

IMUs For all – Why IMU vendors are going to complete solutions

A Hidden Technology
Hidden inside phones, tables, hard drives, computers and countless other products made today are inertial and magnetic sensors. These sensors do everything from stop the hard drive head from damaging itself to enabling a tablet to switch from portrait to landscape mode seamlessly. These sensors are completely self contained and use the earth’s gravitational and magnetic fields, as well as some physical phenomena to operate.
This type of technology was relegated in the past to missiles and navigation systems,
but it’s rapidly coming to the palm of your hand.

If you look at Accelerometer, Gyroscope and Magnetometer vendors and their products, you’ll quickly see a pattern. Most started with single axis devices, then moved to complete 3 axis solutions. The trend is slowly to provide integrated solutions such as 6 Degree of Freedom Accelerometer/Gyro combo, or 9 Degree of Freedom Accelerometer/Gyroscope/Magnetometer combo. Although board space and complexity are simplified in these cases, there is a more powerful motivation: The power of Inertial Measurement Units comes from leveraging multiple pieces of information together to get the right data and eliminate errors such as drifts and biases.

Sensor Synergy

Consider the accelerometer. It measures two forces, both the static (gravity) force
and the dynamic (translational) force. If you’re using only an accelerometer to measure orientation, then the platform has to be mostly still to be able to measure the gravity vector and figure out the device’s orientation. On the other hand, a gyroscope measuring angular rates using the Coriolis effect has no sense of absolute orientation and will tend to quickly drift but will tell you the angular rate if it’s for a short period of time. The accelerometer excels in providing absolute measurement, while the gyro excels in short quick durations. Put them together and you will get better orientation. Better off, throw in a magnetometer and it will be able to bound drift (provided that there aren’t any magnetic interferences around, but there are techniques for dealing with this).

Given the fact that all sensors are needed, it only makes sense for vendors
to package them all together in a single IC if a product needs quick and accurate orientation estimation. But, even in this case, leveraging these sensors can be a daunting task.

To actually get the orientation, you’ll find that the typical solutions involve a complementary filter or even a Kalman Filter. The reality is that vendors really need to provide complete 9 or even 10 Degrees of Freedom (pressure sensor) solutions if they wish to broaden the kind of customers that can use the technology.The IMU IC should provide a complete attitude solution. As with most technologies such as GPS that trickled down from military to commercial uses, simplifying and lowering the costs play a key role in their adoption. Though Apple/Samsung and other Tier 1 manufacturers can afford to employ experts in Inertial Measurement Units, small companies that want to leverage the technologies are left to find someone qualified or are at the mercy of the vendors, which can’t themselves support everyone. As with most technologies before it, enabling everyone requires providing some general solution that provides a complete attitude.

Being an engineer that deals with IMUs all day, you might think I am putting myself out of a job to suggest the industry should continue in this direction and take the step of putting everything in one chip. The reality is that there are plenty of applications that can use these solutions out of the box and work. Others, like the ones I work on, need models, filters, tuning, and testing to achieve the needed performance.

Where are we now?

What is the current state of affairs? Several vendors already provide 6 DOF and 9 DOF filters that have been tested with their parts. Typically these filters run on the application processors of the product. This introduces several issues in itself:

1) Kalman Filters are very processing intensive, especially if they’re floating point, and limit thetype of processors that can be used. This results in increased cost and more board space if another microcontroller is used

2) The filters need to be integrated into software, which can be time consuming, especially
since vendors provide object code that might need to be recompiled for the target platform.

These things clearly can be attacked by the single chip solution.
Why haven’t vendors done it? As always, cost is at the forefront of the issue.
Integrating sensors and processing in a single chip can be expensive, and IMUs are not likely to be at the top of the phone/tablet designer’s list. What’s more, MEMS – the technology used to build the inertial devices – is still developing and requires more research to find techniques to lower cost and improve performance.

I’ve seen the signs of vendors moving to provide a complete solution.
I know they will do it, their customers are counting on it.

Arduino: Signature and stk500_getsync() not in sync resp=0x30 or 0x00 Issues

I recently built my own Arduino clone board. I even assembled it myself (QFN and all), but when it came down getting the Arduino GUI to actually download the sketch I ran into a few issues. Hopefully my work can help others since I was able to resolve those issues.
The Arduino UNO includes 2 microcontrollers (in the version I built): the ATMega8u2 which acts as a USB to serial converter and the ATMega328 which is the primary microcontroller.
Using a avrispmkii I tried to download the bootloader to the device. This is the piece of software that enables the ATMega328 to receive software through UART (via the ATMega8u2). Since I was using a newly bought part, I had to do this myself but I ran into the signature error:

Expected signature for ATMEGA328P is 1E 95 0F Double check chip, or use -F to override this.

Well, I did buy ATMega328 and I didn’t particualrly note that I bought a P version. Both parts are identical, differing AFAIK only in the signature. This is an easy fix. Simply look for ATMega328 in the avrdude.conf that’s in the Arduino GUI folders at

Then change the line 0x1e 0x95 0x0F to 0x1e 0x95 0x14

Once this was done, I used the DFU capability of the ATMega8u2 to upload the file:


However, I quickly discovered the dreaded getsync error that seems quite widespread with Arduinos. After a lot of searching and trying, I resolved it. Basically if the RX LED blinks 3 times it means that the ATMega8u2 on the board is sending the data. However, when I looked in the logic analyzer at it, the baudrate was incorrect. The loopback test was running fine but the baudrate was still correct. Further, when I downloaded a sketch using a programmer that used the serial, I could see that the ATMega328 was sending data properly. Therefore the issue is the serial software in the ATMega8u2. Note that this is a brand new device. It did enter to DFU mode but the serial part is damaged. To resolve this, you must use a programmer such as AVRISP mkii to download the combined dfu and serial firmware called UNO-dfu_and_usbserial_combined.hex

You can use avrdude with the following command to download it:

C:\Arduino\hardware\tools\avr\bin> avrdude -p atmega8u2
-F -P usb -c avrispmkii -U flash:w:UNO-dfu_and_usbserial_combined.hex -U lfuse:w
:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m -C "C:\avrdude.conf"

Note that it will work inf the hex file is in the folder of the avrdude.exe (the bin folder). Point to the right place for your avrdude.conf file. If all is OK it will download successfully. And will show up as AT90USB82. Then remove the ICSP cable and let it boot up as the application (serial converter) by connecting and disconnecting the USB cable.
If it needs drivers, use those in the Arduino folder. In my case, the device showed up as Communications Port COM5. Then download the sketch as you would always do (select the Arduino UNO, then the right COM port).

USB to UART for EZ430 Boards

The EZ430 boards from TI are great little gadgets that can be used to start development. However, the programming board limits the UART baudrate to 9600 baud. This slows down everything since each character takes so long to get sent. Becuase of this I designed and built a few USB to UART adapters in the same form factor as the EZ430 boards. It works great, although it’s very simple and don’t have any programming ability. It uses the FT232 device from FTDI Chip.

The board was designed for milling and manual assembly, so they’re pretty simple and have relatively large holes. Could use a bit of rework but since I have no current need for them, I’ll leave it to you.
A header is used for selecting between 3.6V and 5V on the FT232 I/O voltage. You should select 3.6V for an MSP430.

The EAGLE source files are provided so the board can be modified as needed.

USB to UART Design Files

MSP430 Tutorial v0.4 – Flash Memory

Flash is currently the nonvolatile storage of choice for microcontrollers. Fast and reprogrammable, it replaces the ROM devices of the past and enables field software upgrades that are essential for every product. Because of the importance of understanding the underlying flash, I have added it as a new chapter in my MSP430 tutorial. Granted, there are more topics and example code to be used, but the information in the tutorial is good to get a start.

As always, comments are more than welcome.


Macs and Malaware: Apple’s increasing challenge to maintain security in its brand

It’s been all over the news for a while that around 600,000 Mac computers have been infected with a malaware that takes advantage of a loophole in Java. I won’t discuss the details since they’re available in many other places. My interest is rather in discussing how this might affect Apple’s branding, especially long term.

Macs have normally been considered to be safer than Windows, and it is true for some reasons. Inherently OS X can be made safer, especially compared to other operating systems. However, the biggest advantage that OS X had for a long time is that it was the small fish in a big pond. Statistically, users creating malaware for profit (as it is almost always the case) target the biggest fish because, as an old saying that is attributed (likely incorrectly) to WIllie Sutton goes: it’s best to rob banks because that’s where the money is.

Slowly but surely, Apple is becoming, or has already become, a “bank”. With its success of iPod, iPhone and iPad, Mac computers have surged in popularity and they are grabbing market share, making them attractive targets. However, the issue is larger than that because the malaware was actually made for Windows. Why did it infects Macs? Because apple didn’t patch the hole in time, and this is the most concerning fact. Microsoft and other companies have worked (and sometimes failed) to patch vulnerabilities whenever they can, but Apple might be slowly waking up to a situation where it will have to dedicate more resources to the issue than it has in the past.

Is it that Apple is slowly becoming like Microsoft and other companies with traditional security issues? Apple already has for years worked in this sense, but it wasn’t being actively attacked as now, where it’s actually going to affect a large number of users. This gave Apple the ability to claim that their products were safer and better. From the security aspects, this is not necessarily true. A system is only secure when it has been thoroughly tested and when it can withstand attacks. Security analysts have a saying that “anyone can create a system that they cannot break”. Windows and other OSes have been targeted for years, and although they have many holes, many of them are known. In Apple’s case, the illusion of security is much greater, but no one knows what exploits lurk beneath the surface.

Another interesting fact in all this is the fact that Apple’s other products such as the iPhone have been hacked and rooted, and this is something many users want to do. Arguably this was done through bugs and loopholes in the software. But, with each generation, Apple has improved the system to patch the holes and fix them (sometimes without letting anyone know). This seems to me to be driven primarily by the fact that Apple enjoys locking their devices and controlling them. Will Apple realize that security is not just being able to control the device to ensure you can make money off of it? Locking down devices does bring some security, but loopholes remain.

What should Apple then do? First of all, they must react faster to vulnerabilities, especially when the issue is known and patched by other entities. Not doing so makes them look like they don’t care. I truly believe that the perception of the whole situation would have been better had no one known about the issue. They could then claim that they didn’t find the issue. This isn’t acceptable from the security standpoint, but it makes sense from Apple’s point of view.

More than anything, Apple should remember that they enjoy a great brand name that makes customers willing to pay a premium for many things. One of these is security. In the end, they should not let the brand erode so easily for something as silly as not trying to patch a well known issue.

The proliferation of bad code

For most people, programming is a skill acquired through books and tutorials. I believe that few people actually learn formally in classes, and even then its through books. Most of these sources include the basic how-to snippets of code to use this or that function, leaving out any form of error handling. Is anyone surprised then that most code produced doesn’t meet the needed quality and is full of bugs? No one can write bug free code, but I’m surprised by the horrendous quality that comes out, where all that matters is that the code works by hacking it, rather than write good code that can whistand the test of time., I am guilty of this at times as most people are. The issue seems to me to be that error and exception handling, as well as general checking, is not covered or addressed in most material. if it is, it is usually at the end or as a footnote. Although this tends to produce less lines of code that a novice can see and understand, it misses the critical error handling that is so much needed . The student is then left to fend for their own and try to come up with ways to make their code more robust. Usually, they won’t unless it breaks down (and by then it’s too late).

I’m of the persuasion that you have to hit the iron while its hot. Most people tend to keep the conventions and customs they learned at the beginning of studying a subject, and these are usually hard to break. Error handling seems to me to be at times more important than than an actual working code. Why you might ask? You write code once but run it a thousand times. The code will likely run fine when you write it at first. However, it will invariably break down during runtime because of this or that. The only way to handle it properly and understand the issue immediately is to handle errors the proper way.

Enabling immediate comments

I’ve decided to allow immediate comments to the website. Despite the risk of people garbage comments showing up (people who spend their time trying to create Google backlinks), I believe most site visitors are honest actors just looking for some information. Feel free to comment in the blog, ask questions.