Skip to main content

Posts

Showing posts from October, 2013

Music and girls cause boy engineers to kill people unknowingly

There was an engineer. He had been partying all weekend with his peeps at NH7 weekender 2013, Pune. He loved every moment of it. Specially when on the last day the performers urged the crowd to shout "Fuck that shit" in unison. It was thrilling. He shook his neck with the crowd with every chant, the last of which caused his head to come real close to the mouth of a girl making her way to the front. "Excuse me" she said. Her words missed in the loudness, but a few fragments of virii from her breathe made way into his mouth as he breathed in for the next chant.

Its Monday, he is at his office in Pune and suffering from viral infection. The agony induced by illness decreased his attention level at work. He was working on the layout of an ASIC for a baseband processor. A sneeze and an involuntary contraction later, a channel was offset by 5 nm from its intended location. The chip turned out OK. All tests were passed. Except that a series of cascade events (80.67 deg c…

Using the EEPROM on LM4F232H5QD using StellarisWare driverlib

NOTE: TI renamed Stellaris LM4F232H5QD to Tiva C Series TM4C123GH6PGE - Both these part numbers refer to the same chip. StellarisWare is now superseded by/renamed to TivaWare 2.0. The LM4F232 USB+CAN Evaluation Kit is now rebranded as Tiva™ C Series TM4C123G USB+CAN Development Kit. This blog post refers to the old StellarisWare (SW-LM3S-9107(Stellarisware).exe) and old CodeComposer Studio (CCS5.2.1.00018_win32) and the old part numbers for the microcontroller chip and the evaluation kit.

If you have an LM4F232H5QD Evaluation Board, here is how to use LM4F232H5QD's on chip EEPROM:
Install the development tools - to know how refer steps 1 to 5 of my previous post. Make sure to use the latest version of StellarisWare - the one for LM3S as well as LM4F. On the date of this post, the latest version was SW-LM3S-9453.exeMake sure that the file "driverlib-cm4f.lib" exists at "C:\StellarisWare\driverlib\ccs-cm4f\Debug". If it doesn't, here is how to build it:Start C…

Kent Mini water softner installation notes

I recently bought a Kent Mini Water Softener for my home in Wakad, Pune, India.
I ordered it online for INR 6000/- and it was promptly delivered within the week.
Due to perennial shortage of fresh water, the limited amount of water that Pimpri Chinchwad Municipal Corporation supplies to our homes is only routed to our kitchen.
For bathrooms, we are supplied with groundwater fetched from wells and delivered to out homes by water tanker trucks. This water leaves white stains on the tiles and fittings, interferes with proper washing on clothes, and causes hairfall. The last factor being the most agonizing one that prompted me to get atleast one of my bathrooms fitted with a water softener. Taking bath with hard water left my scalp itchy and hair sticky and rough.
For the various problems caused by hard water and how this device from Kent is supposed to solve them, have a look at the two videos below:

Hard water while cooking Hard water for washing clothes
Like most water softener, Kent&…

__attribute__((packed)) with Code Composer (Texas instruments TI ARM GCC)

NOTE: TI renamed Stellaris LM4F232H5QD to Tiva C Series TM4C123GH6PGE - Both these part numbers refer to the same chip. StellarisWare is now superseded by/renamed to TivaWare 2.0. The LM4F232 USB+CAN Evaluation Kit is now rebranded as Tiva™ C Series TM4C123G USB+CAN Development Kit. This blog post refers to the old StellarisWare (SW-LM3S-9107(Stellarisware).exe) and old CodeComposer Studio (CCS5.2.1.00018_win32) and the old part numbers for the microcontroller chip and the evaluation kit.

So if you are writing code for some kinds of networking protocol for TI Stellaris Cortex M4 processors like LM4F232H5QD, you might end up using __attribute__((packed)) for various structures. (Details here)

If you haven't enabled the correct options for your arm-gcc supplied as part of Code Composer, you might get the following error for struct defined with :

"..\prot.h", line 23: error #80: expected a type specifier

To fix that you need to enable support for GCC extensions for your CCS…

Reading and Writing to serial port in Linux (Ubuntu)

Here is a small program to write a string to the serial port and read a string from it.
I used it to test the UART echo program for LM4F232H5QD.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52#include <stdio.h>#include <termios.h> //header contains the definitions used by the terminal I/O interfaces #include <unistd.h> //read() write() close()#include <fcntl.h>#include <string.h>//Serial port defines and variables:#define BAUDRATE B115200#define SERIAL_PATH "/dev/ttyUSB0"intserial_fd;intserial_read_ret,serial_write_ret;structtermiosserial_settings;charserial_buffer_send[1024]="Test";charserial_buffer_recv[1024]={0};intmain(){printf("Program to write a string to the serial port and read a string from it.\n");printf("Make sure to run this program with elevated privileges.\n\n");printf("Opening %s in Read/Wr…