best way to learn rtos

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

I want to make a simple project on rtos I'm in the starting stages So I'm a little scared and I'm finding it hard to learn. I have spent my time trying to gather information about it. I have seen many links, have read the many PDF but I am still struggling

 

My first question is related to hardware  If I have a Atmega microcontroller , what interface do I need to have  so that later I can write the code for  rtos 

 

I always use led to test anything.  If I connect 3 LEDs with a microcontroller, can I write a rtos program for them ?

 

If the led is not suitable for rtos then I would like to connect the 3 -4 sensor to microcontroler that will read real time data 

I want to make clear I am not asking for any code  Overall you must have noticed that I do not have simple requirements to develop simple rots system 

 
Once I fixed my interface  then I can move forward to free rtos program 

 

 

Last Edited: Sat. Jan 18, 2020 - 06:45 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Which RTOS ? a specific one, or any ? FreeRTOS ?

 

Your application seems a little trivial for learning about multiple tasks and inter-task communication and synchronisation. 

 

Read through the tutorials on freertos.org to understand the fundamentals.

The easiest way to get started with FreeRTOS is Arduino on ESP32. No configuration required; it just works. Start with a standard Arduino program and then add to that.

 

Also, this is the first Google hit: https://www.avrfreaks.net/forum/... :)

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, before you jump into the complexities of RTOS, have you done any much controller programming at all?  Do some of that first (blink leds, make some pwm dimming, read some switches, set up & use some timers and interrupts).  Basic debugging should be part of your skills too! Once, you feel comfortable with all of that, then try your hand at RTOS.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

obdevel wrote:

Which RTOS ?

More fundamentally...what sort of RTOS?

 

Pre-emptive? Cooperative? RTC? Time sliced? Task Scheduler?

 

It is very very rare to actually NEED the more complex of those on a microcontroller like the AVR. Or do you really mean that you want to learn about multitasking?

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ansh11 wrote:
If I connect 3 LEDs with a microcontroller, can I write a rtos program for them ?
Yes

Implementation | Getting Started with FreeRTOS on megaAVR® 0-series

Implementation

"Dare to be naïve." - Buckminster Fuller

Last Edited: Sat. Jan 18, 2020 - 10:58 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ansh11 wrote:
Once I fixed my interface  then I can move forward to free rtos program

Do you mean an RTOS that is free or specifically FreeRTOS.

 

I had a problem with a long running task which I hoped to solve with an RTOS and started to learn FreeRTOS. It soon became clear that integrating FreeRTOS into a completed project was too big a job, so ditched that idea.

 

I recommend that you use your crystal ball to determine whether you really need an RTOS in your project and start from the ground up with/without. If you need to switch track half way through, then it's not unlike starting over again.

 

I started my learning with the Windows Port https://www.freertos.org/FreeRTOS-Windows-Simulator-Emulator-for-Visual-Studio-and-Eclipse-MingW.html because the debugging experience is infinitely better on Windows than on Atmel/Microchip.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ansh11 wrote:
I'm in the starting stages

The "starting stages" of what, exactly ?

 

As the others have said, you really need to have a solid grasp of microcontroller systems & programming before you start trying to move on to advanced stuff like RTOS.

 

Do you have that?

 

So I'm a little scared and I'm finding it hard to learn.

As with learning any new skill, it is essential to start with the basics, lay solid foundations, and build step-by-step.

If you just try to leap straight in over your head, you are bound to struggle!

 

I have spent my time trying to gather information about it. I have seen many links, have read the many PDF but I am still struggling

Again, it is important to start with basics and build up - not try picking random stuff from all over the place.

 

So look for a book or tutorial - or even a proper taught course - that will lead you from the basics through a properly structured learning journey.

 

 

My first question is related to hardware  If I have a Atmega microcontroller , what interface do I need to have  so that later I can write the code for  rtos 

I would say that an AVR is really not a great target to learn about RTOS - (almost) anything that is suitable for running on an AVR is unlikely to need an RTOS !

 

You want a platform with far better debug & diagnostic access.

 

As N.Winterbottom wrote:
the debugging experience is infinitely better on Windows than on Atmel/Microchip.

And that's not just the debugging experience - it's the whole process of building & running code.

 

Also not just Atmel/Microchip.

 

EDIT

 

typos

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Sat. Jan 18, 2020 - 11:30 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ansh11 wrote:
I want to make a simple project on rtos I'm in the starting stages So I'm a little scared and I'm finding it hard to learn

Assuming you have some experience with an AVR, ie you know how to use timers and ADC and SPI / TWI / serial comms, if not master that first, then read and learn about state machines, see tutorials on AVR freaks.

 

Then read and understand the tutorial on multitasking.  Once you have a grip on MT, and can think how to solve problems using tasks, then you can adventure into rtos with the basic skills needed to be successful.

good luck and return here if you have more questions.

jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

Last Edited: Sat. Jan 18, 2020 - 05:10 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Is this about learning RTOS principles (Qs, SEM4s, Mutex, etc) or about developing a system to run a real AVR application? If the latter then you may want to spend a little more time in the upfront analysis because there's very few things you can do in AVR8 sized micros that justify the complexity of an (preemptive) RTOS. CPUs only  have so many resources to go around and you eat RAM and CPU cycles in an RTOS implementation. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

To ansh11 -

 

As you might gather from the posts, above, very few AVR applications really call for any RTOS, free or not free. An RTOS makes things quite complex, before you even start the application, so it takes a very complex application to justify all that effort.

 

I would argue that a simple (very simple) finite state machine (FSM) is probably more than enough. FSM is much  simpler than RTOS. FSM simply brings a degree of organization to application where several simple things are happening. Often, you will find that even an FSM is more than you need, BUT, when you look at the code after it is done, it will probably have some, maybe many, of the elements of a state machine. I can provide a simple example if you would like.

 

So, even with LEDs, please do not get so attached to RTOS. Flashing LEDs is really pretty simple unless you want complex patterns (chasing lights, or such). Try it without RTOS. Its not that big a deal.

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

Last Edited: Sat. Jan 18, 2020 - 10:11 PM