A heartbreaking bug

Last night I decided to try to find a nagging bug in my lightning detector software. The code is supposed to not output a strike severity number unless it is different than the previous value. I was seeing several cases of multiple zeros in a row. How hard can that be to fix? Must have screwed up the place I check for duplicity.

Well after an hour of shaving a yak due to a failed USB hub and a fried cordless mouse, I finally got a chance to look at the problem. I could reproduce the fault when the data went to my Linux box, but not to my PC. But neither the PC nor the Linux data looked right. The values only were discreet values (0, 7, 12, …) and did not cover a wide spread (0-255).

Out came my scope to capture the RS-232 data. Hand decoding showed the data to be different than what was being received. A further check showed that the supposed baud rate of 9600 was more like 5200.

ARGHHHH! How did that happen? I could have sworn I checked the baud rate. The MSP430 I am using does not have a UART so I had to bit bang the serial data. So I know I at some point I must have fine tuned the timer rate to get the right baud.

So with that discovery, I quietly powered down my lab, went upstairs, and cried softly knowing that all the data I have collected this summer is junk. But it was just a soft cry as I know the system does detect lightning. Tomorrow I will attack the problem with a clear head.

This entry was posted in Lightning detector, Projects. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

Blue Captcha Image
Refresh

*