Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 17 of 17

Thread: Teensy 4 RTOS

  1. #1
    Senior Member brtaylor's Avatar
    Join Date
    Mar 2016
    Location
    Portland, OR
    Posts
    536

    Teensy 4 RTOS

    Paul, in this Teensy 4 post you suggested that, while not necessary, Teensy API's would move towards working with an RTOS. Any thoughts on which RTOS you're considering for Teensy 4? I understand that the selection of an RTOS would ultimately be up to the user, but my take on Teensy 4 is that many of its use cases could benefit from one and I'm making the assumption that there will be a preferred RTOS to use.

    I'm asking because I'm currently writing some software for the Teensy 3.6, which could likely benefit from either: 1) TeensyThreads and EventResponder or 2) a full blown RTOS. My plan is to move much of this functionality to Teensy 4 when it becomes available and would like to make that transition as painless as possible.

  2. #2
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,101
    Hi Brian.
    You might find this thread interesting. https://forum.pjrc.com/threads/46733...highlight=RTOS for your work. Bill G. has a ported copy - looked it up once but forgot the details. Think that was about when I discovered TeensyThreads.

  3. #3
    Senior Member brtaylor's Avatar
    Join Date
    Mar 2016
    Location
    Portland, OR
    Posts
    536
    Quote Originally Posted by mjs513 View Post
    Hi Brian.
    You might find this thread interesting. https://forum.pjrc.com/threads/46733...highlight=RTOS for your work. Bill G. has a ported copy - looked it up once but forgot the details. Think that was about when I discovered TeensyThreads.
    Thanks! It looks interesting, I would just hate to go that route and end up having to port everything to a different RTOS or TeensyThreads / EventResponder. Especially since it seems like the port to v9 hasn't been completed yet.

    After fixing some issues with my build environment, I've been playing a little today with the TeensyThreads / EventResponder framework to try learning it better.

  4. #4
    Member
    Join Date
    Aug 2018
    Location
    Fort Worth, TX
    Posts
    38
    I'm also interested in this, as I was just about to start shopping RTOS options myself. Long-term support is what brought me to the Teensy platform.

  5. #5
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,101
    I know this thread is about ROS on the Teensy 4. But I thought that I would go ahead and document a few things that I found associated with the T3.6:


  6. #6
    Senior Member
    Join Date
    Jan 2014
    Posts
    148
    YASQ (yet another stupid question)

    What are you good people doing that would require more than a scheduler/state machine?

  7. #7
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,330
    Quote Originally Posted by BJB View Post
    YASQ (yet another stupid question)

    What are you good people doing that would require more than a scheduler/state machine?
    YASA (.answer)
    T3.x is such a small processor that I only need a well understood interrupt sequence, maybe a cooperative scheduler, with/without timed execution

  8. #8
    Senior Member brtaylor's Avatar
    Join Date
    Mar 2016
    Location
    Portland, OR
    Posts
    536
    Quote Originally Posted by WMXZ View Post
    YASA (….answer)
    T3.x is such a small processor that I only need a well understood interrupt sequence, maybe a cooperative scheduler, with/without timed execution
    Likewise...my use case is a research quality flight control system for fixed wing and multi-rotor drones. I have some tasks that need to be executed regularly on an interrupt (data acquisition synced to an MPU-9250 data ready signal and control laws), some that need to be run at a fixed interval of time (actuator commands sent a fixed time after data acquisition), some that are lower priority (polling for new GNSS data, data buffering and logging), and some that are lower rate (telemetry and path planning). I may be able to meet these requirements with EventResponder and TeensyThreads; although, I'm not sure I'll get the same guarantees with the scheduler with that approach that I would in FreeRTOS or another RTOS (I don't think I want to write my own scheduler).

    With Teensy 4, I'll likely be moving more of the processes on my BeagleBone Black co-processor to the Teensy. Which simply means more threads running at different rates and different priorities sharing data. So the scheduling may become more important with respect to guarantees on running the high priority tasks on time.

    I'm most concerned about using the solution / approach that will let me continue expanding the utility of my flight control software without needing to do a major refactor in the future; either because I've added more items for the software to do or because I'm upgrading from Teensy 3.6 to Teensy 4.x.

    Brian

  9. #9
    Member dauntless89's Avatar
    Join Date
    Jun 2017
    Location
    Cedar City, UT
    Posts
    52
    Custom full-authority ECU for use in the motorsport sector. Modular avionics-level sensor package, datalogging, engine protection, etc.

  10. #10
    Senior Member brtaylor's Avatar
    Join Date
    Mar 2016
    Location
    Portland, OR
    Posts
    536
    Quick update: I tried Bill Greiman's port of FreeRTOS and, without support or an update, it's basically unusable for Teensy 3.5 / 3.6:
    https://github.com/greiman/FreeRTOS-Arduino

    Setting ticks faster than 1ms seems to not work, even following the FreeRTOS advice on which macros to use. I think this may be because of limitations in the underlying timer being used. A bigger issue is that floating point math is not supported and produces a hard fault, I suspect having to do with issues in working with the FPU state between threads.

  11. #11
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,101
    Hi Brian.

    Did you check out the other links I posted on RTOS's.

    Bill G. Also a port for ChibiOS which he thinks works better: https://github.com/greiman/ChibiOS-Arduino. Even though it Arduino he has a directory for ARM. Also in this post he talks about upgrading his FreeRTOS port: https://forum.pjrc.com/threads/46733...light=freeRTOS.

    You could check this out as well: https://github.com/vanbergeijk/teens...eRTOS-template

    Mike

  12. #12
    Senior Member brtaylor's Avatar
    Join Date
    Mar 2016
    Location
    Portland, OR
    Posts
    536
    Hi Mike,

    I saw Bill discussing an update to FreeRTOS v9, but it hasn't happened yet on his GitHub and the version posted (FreeRTOS v8) doesn't work. I haven't tried this yet, but that might be next up for me:
    https://github.com/vanbergeijk/teens...eRTOS-template

    Seems like still a limitation for > 1kHz tick frequency.

    I'm still trying to figure out whether TeensyThreads and EventResponder might fit my needs. Additionally, I've been looking at some potential in house type solutions based on articles like:
    https://www.embedded.com/design/prot...-Simple-Tasker

  13. #13
    Senior Member brtaylor's Avatar
    Join Date
    Mar 2016
    Location
    Portland, OR
    Posts
    536
    I'm a little wary of ChibiOS because of its licensing structure. I develop open source, but would like my work to be able to be used in closed source projects.

  14. #14
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,101
    You could always check out the FreeRTOS site it self to see if there are any questions on 1khz. Also, you could post a issue on Bill's GitHub page. He's usually pretty could at responding. I had to do that with another library of his.

  15. #15
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,101
    You might find this interesting - https://mcuoneclipse.com/2016/08/14/...eertos-part-1/

  16. #16
    Senior Member brtaylor's Avatar
    Join Date
    Mar 2016
    Location
    Portland, OR
    Posts
    536
    This does seem fine with the FPU: https://github.com/vanbergeijk/teens...eRTOS-template

  17. #17
    Junior Member
    Join Date
    Dec 2018
    Posts
    5
    FreeRTOS running on Teensy 4.0 would be really nice! Teensy is so fast now, that it needs RTOS.

    -albertr

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •