Category Archives: Uncategorized

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.

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.

www.glitovsky.com/Tutorialv0_4.pdf

 

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.

Solving the GUI framework cannot be initialized error in Miktex

Miktex 2.8 and 2.9 seem to suffer from a known issue with the package manager. Simply put, the package manager GUI will fail and then no packages can be fetched if the Yes or Ask options are selected for the package manager (contrary to some online information, selecting Yes doesn’t seem to work).
The solution isn’t too pretty: Open the mo (miktex options) GUI that’s in the bin folder of the miktex installation folder. For example in Windows 7 this is:
C:\Program Files (x86)\MiKTeX 2.9\miktex\bin>

Then just run mo.exe. IN the General screen, select the “No” option for whether packages should be downloaded automatically.

Here is the difficult part: you now will need to download the necessary packages manually. It’s a pain, but can be done quickly. Simply run miktex and see what package is missing from the error. Using the package manager (also available in mo.exe in the Packages tab), locate the packages and install them.

The blog over the last year

Over the last year, I’ve made little changes or additions to the blog due to being so busy with work and family. Some interesting trends developed while I was “away”.
My bandwidth requirements have spiked significantly. My MSP430 shows up as one of the top results in Google. I’ve never publicized it anywhere so I can only assume that users have been posting links to my blog. At 1MB a pop for the PDF, my BW gets quickly eaten up but I’m working to get more.
There have been many of you that have thanked me for the tutorial and I am very happy to know that you find it useful. I really make nothing out of it except knowing that some of
my knowledge about the MSP430 gets passed down.
There have been even more that have clamored for more material. I am happy to say that I’m working on just that. The MSP430 is a device with many features and peripherals, and on top of that I’m hoping to add some practical tutorials on debuggers, compilers, etc. Please feel free to e-mail me with material suggestions or corrections gustavo [at] glitovsky (dot) com

And as always, plenty of spammers have tried to craft intricate messages for me to approve in the Blog. I have to say it probably didn’t work 😀 Sorry!

Using Doxygen

If you haven’t used Doxygen or a similar documentation generator, start using it. If there’s something worse than bad code is bad or uncommented code. Doxygen is so easy to use that there’s really no excuse. There is one exception: there’s not always easy examples of how to use it and nothing really practical. Here’s my attempt at correcting that mistake:

/** \defgroup Example Example
*  @{
*/
/*!
 * \brief Sample Function that’s commented
 *
 * This is an extended description about the function
 *
 * \par More information here is in bold and indented
 *
 * @param param1 is the first parameter
 * @param param2 is the second parameter
 *
 * \return 0 if successful, 1 if failed.
 *
 * \par Example Usage:
 *      doxyFunctionExample1(1, 1);
 */
int doxyFunctionExample1(int param1, int param2)
 {
 return 0;
 }
/** @}*/

I apologize for the formatting. Using the template above you get the following results:

Doxygen OutputThe example contains a lot of details left out in many Doxygen tutorials/docs and should cover most cases. You can use the \par to create a custom paragraph, such as the example usage one above.