Reddit Secret Santa 2010

Posted on 2010-12-02 17:01 in Blog • Tagged with holiday, reddit, shopping

The snow is flying, Christmas music can be heard on the radio, and thousands of Redditers are decending upon online retailers everywhere. Thanks right, time for Reddit Secret Santa 2010.

I really enjoyed the gift exchange last year. I was assigned a local redditer. I gathered up some interesting stuff: dark chocolate orange, set of Russian shot glasses, two puzzle mystery sets, and giant coffee mug. Wrapped everything up and hand delivered it. It was a blast. Two weeks later, my gift arrived in the mail: seasons one and two of the IT Crowd. An absolutely hilarious show.

Yesterday, I logged onto the Secret Santa site to learn who my match was this year. This year, it is a Redditer out on the coast, so I don’t plan on hand delivering the package. I read through their comment history but didn’t get a good feel for what they like. There was a comment regarding the difficulty of finding a few different kinds of candy. For my gift, I plan on sending them a small box of candy, making an Orange-Red envelope, and ordering them a box from SomethingStore.

Christmas is such a great time of year, and I’m glad that I can be someone’s Santa again.

Thought of the day:

Either:

1) Santa exists

2) There is a GIANT conspiracy involving thousands of parents, teachers and friends throughout the entire world to lie to children and deliver presents.

Which one is more likely?

roguebluejay


A Frigid Morning in Line

Posted on 2010-11-30 22:05 in Blog • Tagged with holiday, shopping

Waking up at 3 o’clock in the morning to stand in line for two hours in single digit numbers doesn’t sound like a valuable use of time. But come Black Friday (day after Thanksgiving), that’s exactly where you’ll find me. Initially, I was drawn to the stores for the deals. I remember waiting to buy a 4 GB flash drive years ago for the low, low price of $40; a bargain in 2005. That drive served me well all through college, and continues to provide useful server to this day.

I’ve been braving the cold for five years running. Initially I was standing in line to buy the latest electronic trinkets for myself. Lately, however, I’ve found myself crossing items off my Christmas shopping list. This year was a little different. This is the first year where I didn’t purchase a single item for myself. I still spent a fair amount of money. I purchased gifts for my mom, dad, sister, younger brother, and my girl friend. Only three names remain on my gift list, and I have almost a month to find then something.


Interrupt Madness

Posted on 2010-10-11 22:44 in Blog • Tagged with work, programming

The other day I ran into a very strange issue while debugging a problem at work. We were evaluating a new microprocessor for use in one of our products and had been trying to exercise all the different functionalities the processor had to offer.

I was testing out the input capture functionalities and discovered that the first capture (rising edge of input pulse) always worked correctly, but the second edge was never detected. After some digging, it appeared as though the I2C communication routines were interfering with the capture.

I turned on debugger, ran code and it broke inside the I2C routine, hanging waiting for a reply which was never going to come (test code had no time outs). I commented out all calls to the I2C code within the program, reran it, and the debugger once again broke inside the I2C routine. Somehow, the program counter was jumping to an unused block of code. I know it was unused because the compiler complained about the unused segment.

Putting on my debugger hat, I placed a break point immediately after the first capture, and stepped through the code, one line at a time. On the following line, something strange happened

counter += 1;

Instead of advancing to the next instruction, the program jumped almost to the beginning of memory (15 bytes after the end of the memory mapped register range). I repeated this several times, always with the same result. As an experiment, I rearranged a few lines of code and reran. This time, the code jumped on a different line, but landed in the same location.

The only thing I know of in microprocessor land which can change your execution point is a faulty processor, or more likely, a interrupt occurring. After poking though the map file, I realized the I2C routine was the first executable block in code, and the decoded instruction 0xFF which fills all unused space is a move instruction.

MOV A, B

It makes sense, that a bad jump into unused space would eventually land the code in the I2C routine, but that was triggering the interrupt? A five minute search yielded the solution.

The code we were using was based on example code provided by the vendor. I hacked the various pieces together and changes from interrupt driven function to polling driving functions. Unfortunately, I missed the line in the initialization routine where the input capture interrupt occurred. Most surprisingly, the compiler allows us to enable an interrupt, without defining an interrupt handler. (In this processor, all interrupt controls had direct bit access. They were not grouped together requiring a byte mask.)

The interrupt event occurred and the program counter was loaded with the default value from the interrupt table. We have no idea how 0xFFFF from the table was translated into 0x034A which is where execution picked back up. Commenting out the interrupt enable line resolved our issue and we were able to finish evaluating the board.

Morals:
1) Interrupts are evil. They introduce too much variability into the execution process.
2) Sample code is a great place to start from, but don’t base your demonstration code on it
3) Debugging takes time and patience, take a break once in a while to relax and clear your thoughts


Importance of Using Correct Units

Posted on 2010-08-04 22:38 in Blog • Tagged with space, work

I first encountered the concept of unit conversion in the second grade. Where I was taught to convert pints to gallons, feet to inches, and ounces to pounds. Event with constant practice, there were a few units that I was just never able to get, such as the peck, fathom, or the hogshead. It amazes me to this day, that these units (all of the above) are still in use, when there is a clean, simple unit of measurement that has been accepted by the majority of the world: SI (metric).

Having a mixture of different methods to report the same concept (different units) introduces many engineering challenges. Primarily, one needs to be constantly vigilant when reporting data or receiving data, that the data has been properly labeled with the correct units. All data sheets should have standard locations to list units and software APIs should explicitly and cleanly state units on parameters and returned values.

The most famous example if software routines using the wrong units was the Mars Climate Orbiter probe that crashed due to a software conversion. In a nut shell, a routine was called to determine the amount of force exerted by the space craft thrusters after firing. The exerted force was factored into the navigation routines to determine the craft's new trajectory as it guided itself towards mars. The trajectory routines expected data in newtons (metric force unit) but was given thrust data in pound-force (imperial force unit). This resulted in a small amount of error each time a course correction was performed. Over the multi-million mile journey to Mars, the craft drifted roughly 45 km. A very small distance, but large enough to spell doom for the craft.

Earlier today, while sitting at my desk I overheard a conversation between two of our system's engineering engineers, taking about a small collection of requirements they had received from one of our customers. The two requirements dealt with the types of storage environments our final products would have to survive (temp, humidity, dust, ect). One in particular caught my ear. The requirement was worded similar to as follows:

The device shall not be damaged by dust particles, 100-500 micrometers in diameter, traveling at 50 mph.

Hearing this stopped me cold; one requirement mixed two different systems of measurements. I pointed this out to the guys and they laughed. Then they showed me an even more distressing requirement.

The device shall do something at either X g/ft or Y g/m^3.

In this instance, not only were systems of measurement mixed, the two provided units could not be converted into one another. One was mass per distance, and the other was mass per volume. I got assurances from the requirement guys that they would have the customer clarify what they meant. I then took a drink of coffee, put my headphones back on, and got back to work. My first order of business, verifying I'd documented all the units for my public facing routines in my code.


Computer Donation

Posted on 2010-07-23 00:00 in Blog • Tagged with hardware

My old computer has left and gone to a better place. Hopefully to a place where it will once again be actively used as a family's primary machine. I donated it.

During my sophomore year in high school, I took a 'Computer Engineering' course designed to teach the fundamentals about how computers functioned, what the components were, and to serve as a prep course for A+ certification. During this time, 'luckily' my family's computer up and died (motherboard gave out), and I was able to convince my dad to let me build the replacement system.

I spent days pouring over different component reviews, struggling to find the perfect match of performance and price. Finally, I had my system:

  • AMD Athlon 1800+
  • 512 MB Ram (DDR 2100)
  • 80 Gig
  • 32 MB Radeon
  • DVD +- R/RW
  • 17” CRT Monitor

All of this glory for only $400. My dad was so impressed, he bought three systems. The system I build was my primary PC for the next six years. It was replaced after I purchased my laptop for use at college.

Since that time, the PC has sat mostly idle under my desk. I would boot it from time to time to place games, but mostly I used it as a file repository. As external drives became cheaper, I found my use of the PC becoming less and less often; until I was only turning it one once every other month. Finally, I decided it was time for it to go.

"Old Computer Boxed Up"

I found a regional charity, PCs for People, that collects used computers and distributes then back to people in need. Sounds like a perfect fit. So, I backed up all my files, whipped the drive, and packaged it all up. This afternoon, I drove across town and dropped it off. Farewell.