Sunday, May 8, 2011

The engines that I work on

Saturday has just fallen off the cliff. Sunday has entered the scene and is now trying its best to put up a good stunt. 
No matter how hard it tries to climb the jagged rock wall, 24 hrs later it too shall meet the same fate and fall and end up back in the line behind the 6 other contenders. One hour into the show, Sunday's act was proving to be boring. So I drifted, thinking of the previous one's performance.


This Saturday was different. It was my first working weekend at my third job. Reflecting back on the day, I realised, I had solved three major issues at work. Three issues which had cascaded to result in an irritable bug on the Head Unit of our in car entertainment system - the master microcontroller wasn't able to talk properly to the radio tuner chip. Integrated Circuits and the computers made of them can be made to talk in many different ways, not unlike the numerous human languages. The language of the day was I2C or Inter-Integrated Circuit. This one was invented by some guys over at Philips a few years ago. It's a language specifically suited for a certain kind of scenario. If you recollect the movie "The Mummy Returns" (By the way today is mother's day, happy mother's day to my mummy - Indu Aunty :), just before the final fight scene, Oded Fehr's character utters some words in Hebrew which is immediately recognized as "The language of the Slaves" by Dywane Johnson's character. I2C is somewhat like that. It's used for communication between microcontrollers (the smart ones) and the dumb slave ICs which have each been bred to do one and only one task. The microcontroller is the master in that sense that it controls the tempo (The clock signal) during the whole transaction. All the slaves are lined up one after the other as the master microcontroller speaks its will. The master first yells out the slave number and makes it heard to all of them. Only that IC whose slave number matches the one uttered would bow down and acknowledge, making its presence known to that master. The master would then proceed with delivering its instruction to this one particular selected slave one by one. The slave is obligated to acknowledge every piece (byte) of command sent its way. When the master is done with one slave, it will address the next one and so on and repeat the cycle. This seemingly simple round robin process made our system go. But today, one of the slave was being insubordinate. We wanted to teach it a lesson.


Over the course of the saturday, we found three problems with our system. First we found that we were using the wrong wires to communicate with the slave. This was like climbing out on top of the effiel tower and shouting out instructions, when all your slaves were kneeling down in front of the taj mahal. Of course they couldn't hear zilch. That problem was easily solved by modifying a few lines of code and diverting all the data traffic to the proper wires. Made a note to self - RTFM. 
The second problem was related to hardware. The clock and data signal were short circuited. The clock signal sets the pace or the tempo of the communication and the data signal, well carried the actual words. Damn, our king was bloody tounge tied. We applied a little solder flux on the copper tracks (the mouth of the master) and blew hot air (at 200 degrees centigrade) over it. The solder melted and the surface tension caused them to fuse to their bonding pads and become isolated from one another. With the tongue untied, we proceeded on to the next step.
The third problem was to do with the reset signal. The Master Micro wasn't letting go of the reset signal going to the FM/AM Radio Tuner IC. Remove the tape from the slave's mouth when you want him to respond goddammit!!. Easily fixed.... backspace backspace backspace... type type type.. recompile, re program and we are in business. 
OK so now the slave is responding. It can hear the master and we can see it saying "yes sirji" after every byte. We eavesdropped on the master microcontroller and the slave IC's convo using a device called an "Oscilloscope". We can see them talking. We can see the master issuing instructions and the slave acknowledging each one, but we don't see the slave doing what its told - we can't hear any "big, Red, AIR, mirchi, City". Lagta hai apna Master sathiya gaya hai. Bakwas kar raha hai. Slave bechara sun ke le raha hai lekin use samajh nahin aa raha ki woh kya kare. 


We came home, leaving the problem unsolved. Tomorrow, we will teach our master a lesson it will never forget - how an Audio Head must talk to a Radio Slave. 

3 comments:

Dhananjay said...

Wonderful read. I hope you are able to teach the audio head what it must give properly: a good head.

Suvij Sudershan said...

Really interesting stuff, the way you related The Mummy with a computer language. Nice :)

The Lithiumhead (Anurag Chugh) said...

Thank you Suvij. But guess what, 1 month on and I still can't get the slaves to behave. And now the master's acting up too.