motorcycle traction control project on mini2440

dragilla
Hi there,

I'm working on a motorcycle traction control project. The basic concept is
simple: read data from sensors (wheel speed sensors, rpm, lean) and decide
whether to kill or not to kill a spark.
But I want to ask you about the implementation.
My idea is that I have 5 processes running: 1 main process reading input
data and 4 processes responsible for passing or blocking the ecu spark
signals.
The 4 processes would be driven by interrupts - 4 gpio's - inputs.
Then each process would check for a flag and decide whether to pass the
signal or to block it.
The main process would basically set those flags depending on the readings.
The main process would run in a loop, with frequency say 50hz?

My calculations tell me that I may get as much as 150 signals (interrupts)
per seconds per each one of the 4 spark processes (at max rpm).

The question is: will the hardware handle such a solution and what latency
of the 4 spark processes I may expect (from interrupt till gpio out).

I plan to use xenomai user-space process for the task. Maybe kernel process
if user space is too slow.

Maybe you a better idea how to implement this - this is basically my first
project so please feel free to suggest a better solution :)

regards,
-- 
LS

davef
Do you need the OS for display and control purposes?

dragilla
Nope. Just calculations and output control.
Additionally I want to save the read data to an sd card perodically - sort
of data logger.

davef
Not that I would try to divert things from FriendlyArm development
(xenomai), but would a ATmega88 running at 16-20MHz clock and Tiny FS be
appropriate?

What sort of calculations?  Floating point?

dragilla
Well, yeah, but not really much. Just one square root to calculate speed of
 acceleration - that's it. The rest is readings and if->then decitions.

dragilla
of course speed off (from) acceleration, not speed of acceleration

dragilla
About atmega, I have no idea. Why do you think it would be better?
Also any suggestions about what dev board I could use?

davef
How often do you want to capture data?

Seriously, as you are not needing keyboard or keypad input or any display I
would suggest seeing if you can use something as above.

Based on the speed you got on top of xeonami and the FA platform I think
the learning curve for the small bare-metal 8 bitter would be pretty darn
short!

Using the ISR to just set flags and a round-robin scheduler you response to
interrupts is pretty fast.  How fast you want your square root result to
appear on an output and saving data to SD card will be a limitations.

If you can defer saving data that might give you breathing space.  How time
critical is the data logging?

dragilla
Datalogging is not critical. I have 20hz gps, so I hoped I could log data
with this frequency. Maybe I can log them once every 20 cycles, so once per
second, assuming I buffer data.
As for the square root then well as I said I would like the main process to
run at about 50hz.
I don't know what ISR is :)
So, do I stick to mini, or should I investigate atmega? What's atmega88 and
how it is to atmega128 for example?

davef
Maybe, you could save the data with a timestamp and then save it to the
SDcard when you are doing nothing in the while(1) loop.

dragilla
Sure. I could do that.

dragilla
Davef, would you dare to try to help me a bit with my project?
If you say it's not suited for mini2440 then maybe it isn't. But discussing
atmega here is probably a bad idea.
I would really appreciate some help, at the beginning at least.

davef
ISR = interrupt service routine.

I think you should investigate it.  I have been working with that series
for about 10 years with the Linux stuff over the last 2 years.  I would go
the ATmega way, but maybe I am biased.

ATmeag88 is just a smaller ATmega128.  I run TinyFS and a bunch of
calculations in less than 20K of flash.  Another unit runs a web server,
using UIP in about the same amount.  

There have been many similar automotive threads on www.avrfreak.net


Seeing as this is quite off topic for this forum we can discuss this
offline at:

dave underscore festing at hotmail dot com

if you want to.

dragilla
Sure I do - thank you!
To others - if you think mini2440 would do just fine for this project
please write here :) Also write if you think it's better to use AVR.

serg_io
I agree with davef, for that task you don't need mini2440 and Linux,
because you don't need nor GUI, neither Network. Atmega128 it's just kind
of MCU, you can use some more powerful ones ,like Cortex-M3 from ST, to be
sure in the final performance.