hellandsen90
New member
Hi to all the forumers!
I'm currently in the process of planning my bachelors thesis, and therefore I'm seeking advice on how to utilize this little microcontroller in the best way possible.
I've done some reasearch and concluded that this badass of a microcontroller probably is performant enough for our needs.
We're planning on making an engine management system, with spark and injection control.
That being said, I need some guidance from the more experienced out there, so let's get down to business:
C or C++? Will there be a big performance penalty using C++? We're used to object oriented programming, and would prefer to use C++ if that's possible.
Interrupts... I've sorta figured out how to use interrupts on the digital pins, so that'll be okay. However, we need to process 8000 of those a second for getting RPM and crank position.
Will this be an issue? As far as I can tell the microcontroller will be able to handle this with ease, but I just wanted to confirm that.
When it comes to writing the pins for the injectors and ignition, we will need a precision of 20 microseconds (1 degree at 8000 RPM). A total of four writes per revolution.
I don't think this will be an issue either, but I just want to be sure we're not getting into trouble here.
We will also need serial communication and reading of analog ports, but this can be low performant (5 updates a second is enough).
My biggest concern as of now is: How does one go about synchronising all this? One obviously would not want the serial reading to interfere with the timing of the ignition, etc.
My understanding, as of now, is that utilizing the built in timer with interrupts will be a viable option for setting the output pins, and also using interrupts on the input pins for reading RPM.
These have priority settings as far as i've understood, and utilizing this we could prioritize the parts that are crucial to correct engine operation.
Does anyone have any experiences with making timing-critical applications on the teensy 3?
What are good approaches for doing time-critical operations? Is it possible to use some kind of interrupt along with the timer to trigger our outputs?
For the injectors we will have an output quite like a PWM signal, with "cycle time = 2 * RPM" and duty cycle according to our calculated fuel requirement.
The sparks will just be a brief on and off signal on a digital pin.
For sensing the RPM there will be a hall effect sensor with a 64 teeth wheel with two missing teeth, to allow us to know both RPM and current angle.
Could we utilize most of the arduino-compatible libraries without losing to much performance? Or should we implement everything to make it very project specific and performant?
I'm thinking things like serial, ADC read, digitalWrite(), etc. Are these things we should hardcode in our code, instead of using the libraries?
Any insights would be greatly appreciated!
Thanks in advance
I'm currently in the process of planning my bachelors thesis, and therefore I'm seeking advice on how to utilize this little microcontroller in the best way possible.
I've done some reasearch and concluded that this badass of a microcontroller probably is performant enough for our needs.
We're planning on making an engine management system, with spark and injection control.
That being said, I need some guidance from the more experienced out there, so let's get down to business:
C or C++? Will there be a big performance penalty using C++? We're used to object oriented programming, and would prefer to use C++ if that's possible.
Interrupts... I've sorta figured out how to use interrupts on the digital pins, so that'll be okay. However, we need to process 8000 of those a second for getting RPM and crank position.
Will this be an issue? As far as I can tell the microcontroller will be able to handle this with ease, but I just wanted to confirm that.
When it comes to writing the pins for the injectors and ignition, we will need a precision of 20 microseconds (1 degree at 8000 RPM). A total of four writes per revolution.
I don't think this will be an issue either, but I just want to be sure we're not getting into trouble here.
We will also need serial communication and reading of analog ports, but this can be low performant (5 updates a second is enough).
My biggest concern as of now is: How does one go about synchronising all this? One obviously would not want the serial reading to interfere with the timing of the ignition, etc.
My understanding, as of now, is that utilizing the built in timer with interrupts will be a viable option for setting the output pins, and also using interrupts on the input pins for reading RPM.
These have priority settings as far as i've understood, and utilizing this we could prioritize the parts that are crucial to correct engine operation.
Does anyone have any experiences with making timing-critical applications on the teensy 3?
What are good approaches for doing time-critical operations? Is it possible to use some kind of interrupt along with the timer to trigger our outputs?
For the injectors we will have an output quite like a PWM signal, with "cycle time = 2 * RPM" and duty cycle according to our calculated fuel requirement.
The sparks will just be a brief on and off signal on a digital pin.
For sensing the RPM there will be a hall effect sensor with a 64 teeth wheel with two missing teeth, to allow us to know both RPM and current angle.
Could we utilize most of the arduino-compatible libraries without losing to much performance? Or should we implement everything to make it very project specific and performant?
I'm thinking things like serial, ADC read, digitalWrite(), etc. Are these things we should hardcode in our code, instead of using the libraries?
Any insights would be greatly appreciated!
Thanks in advance
Last edited: