FreeRTOS Tutorial 5 || Simple QUEUE || STM32 || NO CMSIS || CubeIDE

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 มิ.ย. 2024
  • Purchase the Products shown in this video from :: controllerstech.store
    ________________________________________________________________________________________
    How to use Queue to communicate between the tasks in FreeRTOS.
    To download the code, goto controllerstech.com/freertos-...
    FREERTOS Playlist • FreeRTOS TUTORIALS
    ________________________________________________________________________________________
    ****** SUPPORT US BY DONATING*****
    paypal.me/controllertech
    ******Join the Membership******
    / @controllerstech
    Join the Discord Server / discord
    Join the Telegram Group t.me/controllerstechdiscuss
    Follow me on Instagram / controllerstech
    For more info, visit www.controllerstech.com
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 32

  • @vadimfilatov8649
    @vadimfilatov8649 3 ปีที่แล้ว

    Thanx a lot for your videos! Especialy for beginners frendly English :)

  • @MrHause13
    @MrHause13 4 ปีที่แล้ว

    Awesome, Thank you !

  • @ElettronicaRiparo
    @ElettronicaRiparo 4 ปีที่แล้ว

    Bravissimo 👍

  • @ucontrolchannel5967
    @ucontrolchannel5967 4 ปีที่แล้ว

    great job!!!, Could you also show an example about USB Mass Storage Class
    Thank you

  • @canerboyraz9480
    @canerboyraz9480 ปีที่แล้ว

    another great tutorial... may I ask what is the difference between pdPASS and pdTRUE? in which cases do we get them?

    • @ControllersTech
      @ControllersTech  ปีที่แล้ว +1

      pdPASS is return message, equivalent to success.
      pdTRUE is when you set some parameter as true (enabling something)

  • @lukasvozenilek3508
    @lukasvozenilek3508 4 ปีที่แล้ว

    Great video, clear and informative. Why not use CMSIS though?

    • @ControllersTech
      @ControllersTech  4 ปีที่แล้ว +1

      Because freeRTOS can be used in other devices too.

    • @fandusmercius723
      @fandusmercius723 2 ปีที่แล้ว +2

      cmsis is using freertos functions inside. So why bother using it? Once you eliminated cmsis your code will be more portable

  • @brilianto98
    @brilianto98 3 ปีที่แล้ว

    How to do it without CubeMX? Can you please explain it?
    Thank you

  • @gman6637
    @gman6637 3 ปีที่แล้ว +1

    It is not clear why you initially read the interrupt using HAL_UART_Receive_IT(&huart2, &Rx_data, 1); but then inside the HAL_UART_RxCpltCallback you clear the interrupt with HAL_UART_Receive_IT(huart, &Rx_data, 1); huart in stead of &huart2
    But it works??
    Also, inside the ISR, you write tohuart, and not &huart2
    But either works.
    Then, it seems that no matter how big the queue is, at some point it will be full, and xQueueSendToFrontFromISR will return 0.
    Is this correct?
    Any help appreciated

    • @ControllersTech
      @ControllersTech  3 ปีที่แล้ว +2

      1. Inside the callback, the interrupt is not cleared, it's being called again. HAL library clears the interrupt before callback, so we need to call it again.
      2. The callback is being called by the 2nd instance &huart2, so using huart or &huart2 inside the callback is the same thing.
      3. Yes, if the queue is full, it will immediately skip the sending. That's the purpose of this function. We can't have any wait states in the ISR.

  • @musaogural
    @musaogural 2 ปีที่แล้ว

    i can not send data with uart interrupt i just download your project and run but it does not work !

  • @powerstar817
    @powerstar817 2 ปีที่แล้ว

    7:47 did you send some data "111" in xTaskcreate. I mean it is expecting address to variable right?

    • @ControllersTech
      @ControllersTech  2 ปีที่แล้ว

      You can pass value or address. Both are fine

  • @jen-meg
    @jen-meg 3 ปีที่แล้ว +1

    Thank you for the informative video!
    However, I do notice something that troubles me with the code after enabling the RX ISR.
    Why is it that the interrupt works only at the very beginning (before the queue fills up) and then, it never works again? I found out that for me the function 'xQueueSendToFrontFromISR' returns 0 (ie. pdFAIL) and then, the ISR never sends out the data "123456789" again.
    Therefore, the ISR can only do its job one time and only right after program execution starts. How can this be fixed if I would like the ISR to always do its job even if the buffer is full?

    • @ControllersTech
      @ControllersTech  3 ปีที่แล้ว +3

      The queue might be full.
      It cannot send data if there is no apace in the queue. Try creating a bigger queue and then see

  • @asifganbayev544
    @asifganbayev544 2 ปีที่แล้ว

    hello. I have a little problem with xQueueCreate function. in my project this function is not determine. i tried to download freertos from site, but this not helped me. if i create queue in cube, so need to work with message queue functions , but i cant (

    • @ControllersTech
      @ControllersTech  2 ปีที่แล้ว +1

      If you are setting it from cubemx like i did, make sure enable queue is selected in freertos configuration.
      Or try creating a queue in the cubemx itself. You can delete it later in the main file

    • @asifganbayev544
      @asifganbayev544 2 ปีที่แล้ว

      @@ControllersTech i tried to generate keil code from your cube project , but xQueueCreate function i cant find. I checked config file and cube file settings , but nothing about it. I downloaded original code from freertos site? also could not fing this function declarations. (

  • @phlosen7854
    @phlosen7854 3 ปีที่แล้ว +1

    so you use CubeMX to generate the default Code. Than you delete half of it. What is the point?
    If you would later use the CubeMX again to initialize a CAN Interface or Timer or whatever, to default code would regenerate and you will have to start deleting again.
    Why cant you just use the Standard Code and the already included Libraries?!

    • @ControllersTech
      @ControllersTech  3 ปีที่แล้ว +1

      Because the cube mx generates the cmsis rtos functions. In the video, i have used the pure FreeRTOS functions, without any cmsis layer. Also cubemx always generates the default task, and i only deleted the initialisation, and working of default task.

    • @phlosen7854
      @phlosen7854 3 ปีที่แล้ว +1

      @@ControllersTech Yes, but you would have to do this all over again each time you change something frome the Cube, right?
      And why didn't you use the cmsis layer?

    • @ControllersTech
      @ControllersTech  3 ปีที่แล้ว +7

      Yeah you would need to do that again..
      CMSIS is easier to use but it's better to understand how the actual rtos functions work. Cmsis uses the same rtos functions inside their own functions. It's easier to use it, but it's not learning exactly. For example in cmsis, you can use the same function to release semaphore whether you are in a task,or in an ISR. But that's not how the freertos actually works. You have to consider different things when you release the semaphore from the ISR. CMSIS do all those considerations inside their function by including a "if in ISR" kind of condition. This is something like you used it but you don't know how it is working.
      Also The idea is to generalise the free rtos tutorials, which are not specifically for arm controllers, but can be used in arduino, or any other mcu that supports freertos.
      Also i did a poll on TH-cam and majority voted for non CMSIS

    • @phlosen7854
      @phlosen7854 3 ปีที่แล้ว +1

      @@ControllersTech That makes a lot of sense, thank you. In the meantime i was playing around with the cmsis wrapper for queues. It caused a crash after a while, so maybe there is a bug in the wrapper...
      I tryied to increase the Priority-number (lowering the Priority) of the queue msg, but it still failed...
      I will try to use the xqueue macros now :)

    • @phlosen7854
      @phlosen7854 3 ปีที่แล้ว +2

      @@ControllersTech Just a follow-up: I use CubeMX with TouchGFX, which uses FreeRTOS Tasks to run. My work around is:
      Include all the .h files in the user Code section like you did.
      Declare the Tasks and ques etc in User-Code Section for RTOS QUEUES.
      Create the TouchGFX Task with:
      xTaskCreate(TouchGFX_Task, TouchGFXTask_attributes.name, TouchGFXTask_attributes.stack_size, NULL, TouchGFXTask_attributes.priority, TouchGFXTaskHandle);
      this uses the Parameters from CubeMX (so you one could make Changes in HeapSize in CubeMX and it will be regarded)
      and start the vTaskStartScheduler befor the generated Code creates the "actual" TouchGFX Task. This way (doing all this in the user code section for the Queues) the Wrapper Code will not be executed and everything still updates from CubeMX without the need to clean up the Code after changes in the Cube...
      Works perfectly. No Crashes from Queues etc

  • @musaogural
    @musaogural 2 ปีที่แล้ว

    It only enters the cut once. When I press 'r' again, it does not interrupt.

    • @ControllersTech
      @ControllersTech  2 ปีที่แล้ว

      Debug the code. Maybe it went into hardfault due to some errors

    • @Khatereh-a
      @Khatereh-a 3 หลายเดือนก่อน

      For me either. I think because when queue is full, ISR can't send data to the queue. Speeding reciever_task to empty queue faster. any idea?

  • @musaogural
    @musaogural 2 ปีที่แล้ว

    it does not work on me

  • @szalonykierowca5870
    @szalonykierowca5870 ปีที่แล้ว

    why do you use the reddit TTS, what is this clownage