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.

Need help in task creation

Hello,

I am using TI RTOS, i need suggestion on tasks planning.

I have external ADC, internal ADC and DAC and external 3 DACs. whether i can create a separate tasks for ADC and DAC. or i can make in 1 task.

All ADC/DAC configurations are set by user . so i will be having 1 tasks for these settings and for ADC and DAC i need some help in planning.

Nitesh

  • Hi Nitesh,

    Sorry for the delayed response.

    You mention you are using ADCs & DACs so I am going to assume you are running some sort of control loop.  Control programs I have seen typically use an ADC conversion completion interrupt to run the control loop & update the PWM or DAC outputs all in an interrupt or Hwi context.  However, these cases only use internal peripherals.  Getting ADC samples from an external ADC introduces additional delays which might make your Hwi very long (assuming a serial interface is used to recover samples).  Also, if you are using TI-RTOS drivers, some transfer/read/write APIs cannot be used in a Hwi (particularly if used in blocking mode).

    In this case I it might be better to write a task that periodically recovers ADC samples and stores them in a buffer/structure.  Then an interrupt (from a timer or something) will recalculate the control loop values.  Finally, there could be another task to update the DAC.  In this case you would need to use task priorities & OS objects to block/unblock tasks accordingly.

    Nitesh Padiyar52 said:

    All ADC/DAC configurations are set by user . so i will be having 1 tasks for these settings and for ADC and DAC i need some help in planning.

    If the user can dynamically change the configuration, I agree there should be a separate task to recover/parse that input.

    Hope this helps,

    -- Emmanuel

  • Hi Emmanuel,

    thanks for the input, just for your understanding, we are using ADC and DAC for sensor simulation and read the sensor data. Both are separately handled. ADC is selected for sensor data measurement i.e. current/voltage.

    What i am doing is configure the ADC and switch for ADC channel selection and start the ADC and wait for the event by ADC interrupt routine in TASK1, in interrupt i am collecting the sample as per sample count configured. Now on sample count reaches count  i will raise the event  for the my TASK1. Similarly TASK1 set the DAC count for specific value and wait until the time.

    Please let me know is it worth doing blocking call for TASK1? or else what i can do to make it better usage of CPU time?

    Please guide.

    Nitesh