Tuesday, November 26, 2013

Soft error

So you're in your Lab integrating your Software Module on a brand new System.

In Embedded Engineering sometimes SW can be useful to debug/validate new
hardware components and people from the hardware division knows it
very well :-)

Using your 'old and validated' protocol on a simple RS-232 it seems that
data coming from sensors are 'slow'.

Hardware division says... 'It's a Software Problem' :-) 

Ok, let's see it.

You connect the JTAG on the Micro, launch your debugger, put a break point
in your 'old and validated' protocol.. dump the buffer coming from
the RX channel and... hey wait...

Data coming from sensors should be 0xAFCED0... but periodically I see....
0xAECED0.... it seems there is a bit-flip and the CheckSum routine is 
throwing away data...  

I simply move the cable connector and... now data arriving at the right frequency..

'Software problem'... uh? :-)

Perhaps you mean 'Soft', not 'Software'...  http://en.wikipedia.org/wiki/Soft_error

Don't Trust Hardware :-)

Monday, November 25, 2013

Are you John Carmack? :-)

... if not (He is a genius) please use #define in your code. (*) :-)

Look at this:

AbsAcc = fabs(sqrt(AXB*AXB + AYB*AYB + AZB*AZB) - 0.04903325

What is '0.04903325'.... ? Perhaps some months ago you knew it but now.... its LOST... so something like:

#define DV_FOR_GRAVITY (0.04903325)

Could be a good choice... :-)

Please: 'for each unusual constant in your code, use define' (!).

(*)
http://stackoverflow.com/questions/1349542/john-carmacks-unusual-fast-inverse-square-root-quake-iii