Threading in Teensy3

Status
Not open for further replies.

Pedro

New member
Hi all,

have anyone tried to use threading in Teensy3? Specifically a library called protothreads?

I am trying to make a program that integrates IMU and GPS data. The GPS has an update rate of 5Hz and the IMU 200Hz, so for me threading seems to be a great solution, although I am opened to other suggestions. The sensors data is then used by a control algorithm.

Thanks,
Pedro
 
This is something like what I've been working on.
You could do an interrupt at 200Hz for the IMU, and within the interrupt every 40 counts, you would capture the GPS data.
You'd have your control algorithm in the main loop.
 
In the microcontroller world this is usually done with interrupts, but its not a 1:1 translation from multithreading. I'm looking at rewriting my arduino app to be driven off the IntervalTimer library, something like: 10ms timer for things that fade between values, 100ms for scanning inputs looking for fault conditions, and 1s for logging to serial. Since you currently only get 3 timers, things that happen more frequently than the next bigger timer just count.

This way, stuff that happens on the highest resolution timer is dirt simple stuff. I think in my app these would all be simple linear interpolations. Thinking in terms without synchronization primitives is frustrating if you're used to just throwing a scoped boost::shared_lock in there.
 
Multiple RTOS' have been ported by Bill Greiman, the author of the SDFat library. ChibiOS and FreeRTOS, among others. I'd Google his work and go from there.
 
Status
Not open for further replies.
Back
Top