mini2440 Counter with GPIOs (1-250Hz!?

Berthold
Hello,

I am sorry if this topic was already cleared, but i couldnīt find anything
similar in the search. 

is it possible to use one of the GPIOs or another Port of the Mini2440 to
count signals from an Hallsensor? 
It would be about 1-250 Hz. I kow its not alot, but i would like to run two
counters and some 1-wire temperature sensors with a smal gui (refresh every
0,5-1s would be enaught) 

Is this with the mini2440 possible or do i need another solution, like an
external counter or something ?

Kind Regards and many Thanks in Advance

Berthold

davef
Berthold,

I suggest looking in the datasheet for the S3C2240 in the timer section
section and see what is says about "input capture".  As you mention the
word GUI I assume you want Qt and Linux running on the target.

250Hz sounds OK, but be aware of the timing constraints of having an OS
running on the target.

http://www.sereno-labs.com/ might have something useful.

Berthold
Hello davef,

Thanks for your fast reply. 

Yes You are right I want to use QT and linux to display the values from the
temperature sensors (oil,water,air) and from the counters (RPM and Speed)

I have ordered an USB 1-Wire Bridge(DS9490R) which will do all the timing
regarding the 1-wire communication which should give me ,without having to
take the timing of the 1-wire communication into account, the values from
the sensors. 

I will have a look at the "input caputre". 
Maybe someone already implemeted something similare and could give me an
more specific answer.

Kindest Regards 

Berthold

davef
Berthod,

This might be a bit "over the top" for you, but did you see this recently
... http://www.friendlyarm.net/forum/topic/5101

I have had a good look and thought it could make a very nice frond-end for
a home automation system.

I'll have a look at your DS9404R as I might need to upgrade my analogue
temp sensors (LM35s) to something a bit more accurate.

Berthold
Hi davef,

Yes it looks very interesting but realy some kind over the top right now ;)


I want to use the DS18B20 as a temp sensors, good accuracy and a useful
temperature span (right word?) from -55 - 125°C. 

davef, where are you from, because in England i found a cheap shop for the
DS9404R, of cause right after i ordered mine from an other more expensive
shop in Germany ;). 

I am a little under time pressure (first phase ends in ~4 weeks), so at
first a simple GUI which shows the Temperatures and the values for speed
and rpm in plain text would be enough. In the second phase i could make it
look fancy ;)

To realize the temperatures seems to be "easy" via 1-wire.
But the problem to realize the counting to get the information of engine
RPM (up to 13000 RPM so at max about 220 Hz) and Speed (Up to 250 km/h so
max about 70 Hz) does not let me sleep at night.

Everything after that is just interpretation of the values. 
Simple example 

Like km/h-> [rotations per s (or 1/2 s if possible)] * [diameter of wheel
*3600 (or when 1/2 s * 7200 ) to get hours] / [ 1000 to get km] 
And so we could get:
-arvarage speed
-max speed 
- ...

we also get distances for: 
- Total km
- Trip km
- ....

Or in which gear we are by comparing speed and rpm. 

Also with temperatures: 
- min/max
- a trigger for a warning when reaching temperature X 

And so on ... 

But at first i need to readout these values temperature is quite possible
but for the hall sensors i have no clue :( 

I am not totally new to embedded systems and electronic signaling etc. and
have a quite good understanding of how it should work in theory but how to
let the mini 2440 do what i want is sometimes something like witchcraft to
me ;) It should be able to count the rising flanks of the rect(ish) signal
from the hall sensor (250Hz should not be the problem for the hall sensor),
but i am afraid that what ever routine i let run to catch these flanks may
be to slow so that i miss some and this would make it inaccurate. 
 
There is also a 1-wire solution possible with a dual counter module.
But they are not reset-able (although 32 Bit will take quite long to get
full; some years of nonstop driving ;) ), quite hard to find and not very
cheap. 

So I am open to suggestions ;) 

KR

Berthold

davef
Berthold,

Unless you want to run Python and do your GUI in TCL I think Qt is probably
the next "easiest" methond.

Another fairly easy way would be to run a small webserver on the mini2440
(thpptd enabled for PHP) and write some PHP code for web pages that would
drag in the data and automagically refresh the page every 0.5 second.  

Yet another option is using the BSP from Pengutronix.  You'll get GPIO and
Qt running on it in short order.  Then learn to use Qt Creator to write
your application.  The datalogger project on sereno-on-line should help
with the basic Qt stuff.  Paolo is a Qt expert.

I am sure Paolo must show some code for sampling input data. Did you look
at his project?

Dave
Christchurch, NZ

Berthold
Dave, 

I am bound to the mini2440 with its 7" Touchscreen.
I have it already and in phase 2 it will be installed on an Motorcycle to
monitor the temperatures, speed, rpm etc. . 

So I will have to use the mini2440 to get to my goal.
It still has the Linux OS it was shipped with some years ago.
I am trying right now to update to QT 4.6 on the mini2440 to use the newer
QT creator to create an gui for the mini2440. Would you recommend that?

I also order some 1-wire switches( DS2413P+ 1-Wire Dual Channel Addressable
Switch and DS2408S+ 1-Wire 8-Channel Addressable Switch ), A/D converter
(DS2450S+ 1-wire quad A/D converter) and an Battery Sensor(DS2438Z)which
should be able to monitor the bikes battery with a little bit of
modification (itīs set for 10V Max out of the box but there is already a
guide to change that). 

The problem still is the Pulse recognition/counting for the rpm and speed.

I have checked the processors datasheet and didn't get an direct hit with
"input capture". I read a bit in Clock&Powermanagement, PWM Timer, Real
Time clock and Watchdog timer to check everything timer related in the
sheet, but didn't find anything like "input counting" or similar. 

I searched for "count" (256 hits) ,"counter" (119 hits) and "Counting" (5
hits) but either i did not look well or there isn't anything like a real
pulse counter on this chip.

Maybe I am missing something ?

Please Help!

P.S. Aaaah You are from New Zealand, so I guess you don't really need the
address from the british shop ;)

KR

Berthold

Ratingen, Germany

davef
Updating to 4.8.2 is easy with the Pengutronix BSP.  I have not used QT
creator yet, so can't make a recommendation.  You can throw your source
code into the above BSP and it will make a Qt project for you.

Timers.  Well, I am surprised I can't find anything about input capture in
the timer section either.  Sorry, for the bad advice.

If you look at just about every ATMEL AVR 8bit uP ... they have input
capture.

Another good reason for using one of these:
http://www.adafruit.com/products/296
and talking to it via USB!

There must be a low-level of doing this.  A GPIO is toggling away on your
input signal and on a timer interrupt just start counting the transitions
next timer interrupt stop counting and there is your value. 

Does that sound like a plan?

Dave

Berthold
Dave,

Maybe I have found another solution for frequency recognition.
1-wire Sensors/devices available are:
-Tempsensors
-Switches
-Battery sensors
-A/D Convertors

So what if i use an Hall sensor/Reed sensor/the RPM signal from the CDI and
connect it to an frequency/voltage converter and connect this with the
1-Wire A/D converter. 

Like This: 

[Signal/Frequency]->[F/V Converter]->[1-Wire A/D Converter]<---->[1Wire
Host]<->[Mini2440] 

So I would get an voltage value which would describe the frequency and it
would be available via 1-Wire. 

Any hesitations ? 

KR

Berthold

Berthold
Hi Dave,

The DS9490R is and USB to 1-Wire Bridge/Host
(http://www.maximintegrated.com/datasheet/index.mvp/id/3834)which will be
connected to the USB Port.
There are also bridges to different "Protocols":
DS2482 (I2C)
DS2480 (RS232)
DS2490 (USB)

The DS9490R is a USB Thumb device which contains the DS2490.
It will do all the BUS related communication handling and so on.
You can communicate direct via the Linux kernel with the device or via OWFS
(http://owfs.org/). So you will only have to send an command to read the
desired sensor/address and the rest will be done by the bridge/host.  

But i havenīt tried it on my own yet, but you can find this information on
the net.

So in theory it should work fine and quite comfortable.
But I know my luck, so I am expecting unforeseen difficulties ;)   

KR

Berthold