Tuesday, September 18, 2012

Interview with an Embedded Engineer?


1) What is the question that confused you the most?

When I was asked what is "Endian"? I was confused the most. I know Indian, but what is endian? Does it have printed with misspelled?

2) What do you think your great achievment with your more than 8 years experience in the embedded field?

Often, I used to be proud of myself that I have not burnt even one board withgiving wrong power supply connection, though I have handled many boards and different power adapters at the same time.

3) What was the happiest moment in your embedded carrier?

Yeah. For the first time, I went abroad for a 1 and half month on-site assignment. Finishing the project and finally escaping to the airport from the customer was the most happiest moment in my life.

4) What was the most depressing moment in your embedded carrier?

When the above said abroad customer called me back to on-site, when they found that I had returned back to my home country without implementing a functionality in that project.

5) Which one you most like in embedded development?

When I find a controller is exctly same with another one which had driver already developed. Really I like and enjoy that moment.

6) Which one you most hate?

When I heard that your code works fine. But, it throws exception when operating at very high speed.

7) Most dislike words in embedded?

PLL setting, SDRAM clock configuration, Exception

8) Forgotten keywords after getting into embedded?

scanf()

9) The word you like the most?

porting

10) What is your future goal?

I used to think why so many different platforms like ARM, PowerPC, SuperH? Let them merge all and make a single platform with single program for everything. Let the embedded engineers enjoy their life by doing simple porting. And, very intelligent run-time Exception Handling CPU and OS platforms. They should clearly say what was the problem.

Embedded Jokes

① Engineer's logic

An Engineer was asked to design a device. What the device should do is, if you give a book name and book store name, it should call the book store and inquire about availability of the book. He finished the assignment and kept the device for demo.
One guy came and input a book name and a store name. The device called the store, asked for the book and gave him the result. He went happily. Another guy came. He too input a book name and a store name. Immediately, a message was showed by the device as "Could not get contact number of the store!". He thought of trying another store. So, he input an another store name. This time, the device called the store and asked for the contact number of the previous store.

② Why is it very difficult to meet deadlines in embedded?

In embedded, the "target" itself is not fixed one and that can be easily reset.

③ Why did they keep name "Daughter" card, you know?

Though they are cute, it is very difficult to understand the connection. They will bring tears in your eyes one day, when you fully understand the relationship.

Monday, September 17, 2012

i.MX51/i.MX53: Interrupt occurs with no bit set in HIPND


Problem:

In my program, whenever interrupt occurs, I read HIPND0, HIPND1, HIPND2, HIPND3, registers to decide the interrupt number of the interrupt source.

But, when there are frequent interrupts, sometimes all of HIPND0, HIPND1, HIPND2, HIPND3 registers read zero(0). Because of this, I could not decide the interrupt number/source. Are they spurious interrupts? There is nothing specified about the spurious interrupts in i.MX51 Reference Manual.

In other words, none of interrupt bits are set in HIPNDx registers, inside my interrupt service routine. Or, interrupt occurs without any bit set in HIPNDx registers. Thus, reading of HIPND results in interrupt number of 0.

Solution:

What happens?

They are not spurious interrupts. There are no spurious interrupts in i.MX51. Problem is in your program. If your program reads HIPNDx registers in series as follows, there is chance that the contents of HIPND registers changed whenever a higher priority interrupt occurs.

For example, assume that interrupt occurs and HIPND2 register is set 0x80000000 and all other registers are set to zero. When you are reading HIPND1, there is chance that a higher priority interrupt occurs and HIPND0 register will become set to 0x40000000 and HIPND2 register will become set to 0. So, your reading will result that all are HIPND registers are zero.

    int intr_number;

    if (register_read(HIPND0) != 0)
        intr_number = 0;
    else  if (register_read(HIPND1) != 0)
        intr_number = 32;
    else  if (register_read(HIPND2) != 0)
        intr_number = 64;
    else  if (register_read(HIPND3) != 0)
        intr_number = 96;
//    else
//        printf("Error: All are set to zero\n");

Howto correct it?

1) Reread the HIPND registers as follows:

    int retry = 0;

    for (;;) {
        if (register_read(HIPND0) != 0)
            intr_number = 0;
        else  if (register_read(HIPND1) != 0)
            intr_number = 32;
        else  if (register_read(HIPND2) != 0)
            intr_number = 64;
        else  if (register_read(HIPND3) != 0)
            intr_number = 96;
        else if (retry++ < NUMBER_OF_PRIORITY_LEVELS)
            continue;
    }

2) Use PND registers to read the pending interrupts, if your program do not worry about interrupt priority.

3) Set all interrupts same priority.

It applies to iMX series processors i.MX515, i.MX535, etc,. Give your comments to improve this post. Have a nice day!