Pages: [1]   Go Down
Author Topic: program locks up (rpm counter w/ LCD)  (Read 1300 times)
0 Members and 1 Guest are viewing this topic.
New York, NY
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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/
« Last Edit: February 02, 2009, 01:39:06 am by jehiah » Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 627
Posts: 34217
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If all works well and then it hangs 9 time out of 10 it is decoupling (or lack of) see:-
http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html

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

New York, NY
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 627
Posts: 34217
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Indiana
Offline Offline
Full Member
***
Karma: 1
Posts: 234
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

New York, NY
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: