This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS/AWR1443BOOST: Not being able to use Task_sleep() function in the mmw demo code

Part Number: AWR1443BOOST

Tool/software: TI-RTOS

Hi,

I've been modifying the mmw demo code recently so that when an object is withing 0.5m to the radar, an external LED turns on. I was hoping to implement some kind of delay function to keep the LED on for 2 seconds. Unfortunately i can't use Task_sleep() as it keeps giving me an error. I think this is due to it interfering with the radars ability to collect information while the delay is active. Are there alternative ways to delay a function without interfering with the CPU. Any help would be appreciated.

Thanks

  • Is your Task_sleep(2) inside one of the current tasks of the demo? You may need to create a separate task. If you try to sleep either the existing Ctrl or Data tasks, I believe it will throw the linkage between MSS and BSS off.
  • Yes my task_sleep() was in my mmWave_initTask which wouldn't work for the reasons you mentioned above. Is there another was to delay the LED from turning off as I'm going to put the GPIO functionality in a seperate function in a different c file than the main.c.

    Thanks
  • Once radar processing begins, the init task is no longer called, so I don't think that would work.  To avoid timing issues, I would suggest to create two global variables - a) an LED state variable (On/Off), and b) a frame counter.  You know the frame rate (per second).  When you turn the LED On, count 2 seconds worth of frames and turn it Off.

     -dave

  • Hi,

    Thanks for your reply. I was wondering if i could use the Clock API like Clock_start() or maybe the Timer API? This is because im a bit confused about the frame method. If my fps value is 30 then im going to be counting 60 frames. But surely using a for loop to count 60 frames isnt the same thing as counting 2 seconds worth of frames since the code will count the 60 much quicker.

    Thanks

  • The goal of this is not to block chirp processing by doing a loop.  There already exists chirp and frame events that you can take advantage of - you simply need to add your code to it.  For example, in the mmw demo, look for function MmwDemo_frameStartIntHandler().  There already is a debug frame counter there.

    Also, the frame rate passed by CLI is a number of milliseconds.  So fps = 1000 / frame_rate.  You are probably already aware of this.

      -dave

  • Hi Dave,

    I've tried the frame counting method and it does delay the LED but the LED flashes on and off while its being delayed. I was wondering if you could give me a quick insight as to why. The function frame counter is called straight after the debug frame counter you mentioned so it can count frames at the appropriate pace. I feel this may be the issue as im calling FrameCounter in the MmwDemo_frameStartIntHandler(). However, this is the only way that allows me to reset the frameCnt variable.

    void FrameCounter(void){
    
        if(High == 1){
            led_on;
            frameCnt++;
            if(frameCnt == 20){
                High = 0;
            }
    
        }
        else{
            frameCnt = 0;
            led_off;
        }
    }
    
    void GPIO_Fxn(){
    
       ....
            if(Range==0.5){ //If object too close then turn framecounter high and start counting.
    
                High = 1;
            }
        
    }

    Thanks for all your help

  • This code appears to turn the led On or Off every single frame. An alternative that only changes it when High equals 1:

    if (High == 1)
    {
    if (frameCnt == 20)
    {
    led_off();
    High = 0;
    frameCnt = 0;
    }
    else
    {
    if (frameCnt == 0)
    led_on();

    frameCnt ++;
    }
    }