Go Down

Topic: program locks up (rpm counter w/ LCD) (Read 2298 times) previous topic - next topic


Feb 02, 2009, 07:38 am Last Edit: Feb 02, 2009, 07:39 am by jehiah Reason: 1
I have a program I've written to measure RPM via a hall effect sensor, and display that data on a HD44780 compatible LCD. I have can read the hall effect sensor via interrupt, and i can display stuff on the LCD just fine, but there must be some weird interactions that I'm not understanding because my program (or more specifically the arduino board) hangs randomly.

hopefully someone on this forum can point out to me either what I'm doing wrong, or some tips to help narrow down what is causing the problem.

I have a delay in my loop() function, but from reading the documentation the interrupt will still get called fine during that, and it appears too.

If I start triggering the hall effect sensor, eventually it will lock up and the 'alive' count will stop updating. It only locks up during (or more specifically in relation to) an interrupt firing, but I don't know how to be any more specific.

A copy of my program is here http://jehiah.cz/download/arduino_rpm_counter.txt and an image of my device is here http://www.flickr.com/photos/jehiah/3246906338/


If all works well and then it hangs 9 time out of 10 it is decoupling (or lack of) see:-

P.S. The tenth time it's decoupling.


interesting thoughts about decoupling.

If it was a power problem, I'm surprised that I would see the same effects when running via USB power and via an external power supply. Is there something inherently wrong with how I have the hall effect sensor wired, and am using the built in 20k pull up resistor?


Well I don't know but if you are measuring RPM then you have something generating the R that you are measuring. It is my guess that this is generating interference that is causing your system to crash. Remember it is not only conducted interference that can be a problem but also radiated. Extra decoupling helps.
If it were just interference to the sensor then you would get spurious input signals, probably too many, that wouldn't (shouldn't) cause a crash of working code. So it has to be the general environment.


Are you using the OSX version of the IDE?

If so, then there's a "known" bug with the OSX version of the avr-gcc (4.3) compiler included in Arduino 0012 and 0013.  Basically it generates bad interrupt handling code which causes crashes and lockups.

You could prove this by building your sketch on Windows to see if the lockups go away.


i am using OSX; i'll try building it on a windows machine

Go Up