Tool/software: TI-RTOS
Hai,
I am here for help of blinking of led using task. Can any body tell me how to create a task and how do i need to blink led.can i get any document to create a task using ti RTOS.
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.
Tool/software: TI-RTOS
Hai,
I am here for help of blinking of led using task. Can any body tell me how to create a task and how do i need to blink led.can i get any document to create a task using ti RTOS.
The Empty example in TI-RTOS for CC3X has a heartbeat task that blinks an LED.
You can get it by first installing TI-RTOS for CC3200 via the Resource Explorer,
Then, in the tree-view of the explorer, navigate to:
TI-RTOS for CC3200 -> Dev Tools -> CC3200-LaunchPad -> Driver Examples -> Empty Examples -> Empty Project.
On the right side, press the CCS icon to import the project in your worksapce.
You get a new project called empty_CC3200_LAUNCHXL_TI
There are 3 things that make the led blink, all in empty.c
Board_initGPIO();
/* Construct heartBeat Task thread */ Task_Params_init(&taskParams); taskParams.arg0 = 1000; taskParams.stackSize = TASKSTACKSIZE; taskParams.stack = &task0Stack; Task_construct(&task0Struct, (Task_FuncPtr)heartBeatFxn, &taskParams, NULL); /* Turn on user LED */ GPIO_write(Board_LED0, Board_LED_ON);
#define TASKSTACKSIZE 512
Task_Struct task0Struct;
Char task0Stack[TASKSTACKSIZE];
/*
* ======== heartBeatFxn ========
* Toggle the Board_LED0. The Task_sleep is determined by arg0 which
* is configured for the heartBeat Task instance.
*/
Void heartBeatFxn(UArg arg0, UArg arg1)
{
while (1) {
Task_sleep((UInt)arg0);
GPIO_toggle(Board_LED0);
}
}
Hai Jan,
Thanks for your reply, actually i have refered osi.h & c but i couldn't find any API with name Task_construct.I found API task create. I tried to create a task, i have check the return status of API it says task succesfull but when i put a break point in my task. Its not hitting the breakpoint and dose not come into task which I have created . Before creating a task do i need to do anything. Actually i took an example from cc3200 sdk {(1.2.0) example of ideal profile . By reference of that example i tried to blink a led. I have a small doubt can i create a task whick can call a function in time interval using timer. Please suggest me how to do it. Would be great help for me.
I have just retested this example on a CC3200 LP and the red led (third one next to button SW3) blinks once per second.
If I put a breakpoint on line 68 of empty.c, the code nicely stops in the blink task.
Line 68: Task_sleep((UInt)arg0);
Configuring that task is done in the main() function of that file (I posted the relevant code in my first reply).
Hai Jan,
Thanks for your reply, Yes it works fine now i have tested. Thank for that. I tried to change LED to orange but Board_LED0, Board_LED1, Board_LED2 are configured to D7 only, How can i change it. I have a requirement, i need to import provisioning_smartconfig, UART , HTTP_client_demo examples to the TI-RTOS project and need to create task for UART and HTTP post method and read response method. how to do it and I need to enable UART interrupt to read the packet. Please suggest me to port from NON OS to OS. Please refer any document if any thing can help me. Once thank for your Support.
> Board_LED0, Board_LED1, Board_LED2 are configured to D7 only
(edit, I accidently posted the process for an MSP432)
You have to edit Board.h , CC3200LAUNCHXL.c and .h.
There is a comment in each of these files that tells what needs to be uncommented.
Board.h:
/* * CC3200_LAUNCHXL_LED_D5 and CC3200_LAUNCHXL_LED_D6 are shared with the I2C * and PWM peripherals. In order for those examples to work, these LEDs are * taken out of gpioPinCOnfig[] */ #define Board_LED1 CC3200_LAUNCHXL_LED_D6 #define Board_LED2 CC3200_LAUNCHXL_LED_D5
CC3200_LAUNCHXL.h:
/*
* CC3200_LAUNCHXL_LED_D5 and CC3200_LAUNCHXL_LED_D6 are shared with the
* I2C and PWM peripherals. In order for those examples to work, these
* LEDs are taken out of gpioPinCOnfig[]
*/
CC3200_LAUNCHXL_LED_D6,
CC3200_LAUNCHXL_LED_D5,
CC3200_LAUNCHXL.c:
/*
* CC3200_LAUNCHXL_LED_D5 and CC3200_LAUNCHXL_LED_D6 are shared with the
* I2C and PWM peripherals. In order for those examples to work, these
* LEDs are taken out of gpioPinCOnfig[]
*/
/* CC3200_LAUNCHXL_LED_D6 */
GPIOCC3200_GPIO_10 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,
/* CC3200_LAUNCHXL_LED_D5 */
GPIOCC3200_GPIO_11 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,
empty.c:
replace
GPIO_toggle(Board_LED0);
with
GPIO_toggle(Board_LED0);
GPIO_toggle(Board_LED1);
GPIO_toggle(Board_LED2);
and
GPIO_write(Board_LED0, Board_LED_ON);
with
GPIO_write(Board_LED0, Board_LED_ON);
GPIO_write(Board_LED1, Board_LED_ON);
GPIO_write(Board_LED2, Board_LED_ON);
> I have a requirement, i need to import provisioning_smartconfig, UART , HTTP_client_demo examples to the TI-RTOS project
> and need to create task for UART and HTTP post method and read response method.
> how to do it and I need to enable UART interrupt to read the packet.
I'm just made an example that does UART with trigger for TI-RTOS. It's for the MSP432 but may be ok right away. You can start the task in the same way as the HeartBeat task is started in the empty project. Stack size needs to be 768 or more for this task.
Also check out the UART Echo example in TI-RTOS for CC3200 and compare it with my code, to understand what's different between interrupt and non-interrupt UART.
For the other part of the question, I don't have straight-away answer for you, because I haven't done such an exercise.
The TCP Echo for CC3X00 example in TI-RTOS has a part of what you need. It implements and lets you test TCP/IP. And it uses smartconfig (provisioning via an app, check the example's readme).
Hai Jan,
Thanks for your Reply, I tried above example to create a task its fine. i am here with a doubt, How to generate a event for a particular task. after creating task, does BIOS_START (); API does look after the tasks. i have doubt @
1) For TASK 1 i have enabled UART interrupt , In the interrupt routine , i would go and collect the data then i need to pass the collected data to other task.
2) How would i collect the data in task2.
3) How to generate an event for a particular task.
Is there any reference document which can tell about all the API's. Please suggest me.
1) For TASK 1 i have enabled UART interrupt , In the interrupt routine , i would go and collect the data then i need to pass the collected data to other task.
You can check my code on GITHUB:
In the UART RTOS task, I let the RTOS put the task inactive until the UART receives an interrupt
Semaphore_pend(SEM_uart_rx, BIOS_WAIT_FOREVER); // when a character is received via UART, the interrupt handler will release the binary semaphore
The only thing the interrup does, is tell rtos to release the lock:
Semaphore_post(SEM_uart_rx);
2) How would i collect the data in task2.
The UART driver does that for you. It's available in the input buffer you give during the following call
UART_read(uart, &input, 1); // prime the uart bus to read the first character, non blocking
3) How to generate an event for a particular task.
TI-RTOS has several mechanisms. When using the UART driver, everything is done for us. It will call the callback (interrupt handler) that you define.
uartParams.readMode = UART_MODE_CALLBACK; // the uart uses a read interrupt
uartParams.readCallback = &UART00_IRQHandler; // function called when the uart interrupt fires
The GITHUB example that I link to doesn't have a lot of code.
The order of execution:
There's an excellent training online for the way TI-RTOS works and how you configure and program:harry_ti said:Hai Jan,
Thanks for your Reply, I tried above example to create a task its fine. i am here with a doubt, How to generate a event for a particular task. after creating task, does BIOS_START (); API does look after the tasks. i have doubt @
1) For TASK 1 i have enabled UART interrupt , In the interrupt routine , i would go and collect the data then i need to pass the collected data to other task.
2) How would i collect the data in task2.3) How to generate an event for a particular task.
Is there any reference document which can tell about all the API's. Please suggest me.

For the drivers, I check the documentation that's installed when you install TI-RTOS and all the example applications that are available in the Resource Explorer once you complete that installation and restart CCS.
If you have ever used a different rtos (maybe freertos), you'll find it easy to get ti-rtos. If not, then the best way is to follow the training and learn all the examples.