Other Parts Discussed in Thread: CC2650
Tool/software: TI-RTOS
uploaded the empty example with blink program(heart beat func task) via IAR. The leds blinks after program upload but when i press the reset button, it doesn't blink.
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
uploaded the empty example with blink program(heart beat func task) via IAR. The leds blinks after program upload but when i press the reset button, it doesn't blink.
Hi,
yes I disconnected the debugger before restarting. Here is the exact problem:
In main function i am turning on red led.
i have another task which blinks green and red led.
in my main() function, i start the task and turn on red led.
in IAR when i do download and debug, after i click on run button program runs as expected. both leds blink.
But when i disconnect debugger and restart the cc2650 launchpad, only the RED LED turns on (as per the code in main() ) but LEDS do not blink( the task which does blinking operation is not running).
now when i just download the application again from IAR without Debugging mode, i still face the same issue.
#include <xdc/std.h> #include <xdc/runtime/System.h> #include <ti/sysbios/BIOS.h> #include <ti/sysbios/knl/Clock.h> #include <ti/sysbios/knl/Task.h> #include <ti/drivers/PIN.h> #include "Board.h" #define TASKSTACKSIZE 512 Task_Struct task0Struct; Char task0Stack[TASKSTACKSIZE]; static PIN_Handle ledPinHandle; static PIN_State ledPinState; PIN_Config ledPinTable[] = { Board_LED0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, Board_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, PIN_TERMINATE }; Void heartBeatFxn(UArg arg0, UArg arg1) { while (1) { Task_sleep((UInt)arg0); PIN_setOutputValue(ledPinHandle, Board_LED0, !PIN_getOutputValue(Board_LED0)); PIN_setOutputValue(ledPinHandle, Board_LED1, !PIN_getOutputValue(Board_LED1)); } } int main(void) { Task_Params taskParams; Board_initGeneral(); /* Construct heartBeat Task thread */ Task_Params_init(&taskParams); taskParams.arg0 = 500000 / Clock_tickPeriod; taskParams.stackSize = TASKSTACKSIZE; taskParams.stack = &task0Stack; Task_construct(&task0Struct, (Task_FuncPtr)heartBeatFxn, &taskParams, NULL); /* Open LED pins */ ledPinHandle = PIN_open(&ledPinState, ledPinTable); if(!ledPinHandle) { System_abort("Error initializing board LED pins\n"); } PIN_setOutputValue(ledPinHandle, Board_LED1, 1); PIN_setOutputValue(ledPinHandle, Board_LED0, 0); System_printf("Starting the example\nSystem provider is set to SysMin. " "Halt the target to view any SysMin contents in ROV.\n"); System_flush(); BIOS_start(); return (0); }
Quick overview:
in main function, i switch on green led, and switch off red led.
in the task there is a loop which toggles the led states.
after board, i only see green led on and red led off. toggling doesn't happen.
if I swap the initial states of led in main function, that is green led off and red led on; after board reset the same is reflected but again led blink/toggling as per the loop doesn't happen.
UPDATE:
when i repeat the same steps in code composer studio with the same code, it is working correctly. Both leds blink after board reset.
I am seeing this issue in IAR only. so i think the problem is in IAR, but i cant find out the cause of the issue, i am just trying to run the sample code provided with no change in any settings to the project.
Hi M-W,
i checked the output using flash programmer 2. The output is same on both the cases:
Case 1 : program working as expected when loaded via ccs.
Case 2 : program not working as expected when loaded via IAR.
i even exported the output to .hex files and used a comparator to compare them, they are exactly the same.
Hi Mohammed,
I do not see the issue on my side, could you perform these actions and report the result:
If the behavior is not the expected, could you share the output files from both IAR and CCS in your case?
Update :--> In IAR empty example with minimal footprint works correctly. i see this issue only in normal empty example.
Hi Mohammed,
Could you also share your complete IAR project with me (including workspace files etc) so that I can check your settings out locally?
Hi Mohammed,
I'm working on re-creating this locally bit I do not have any results as of now. As for settings, could you share your view of which target you have selected etc?
Please tell what all settings you require?
i will send screenshots of settings page.
Hi MW,
I FOUND THE PROBLEM CAUSING CODE.
when i comment out the following lines in main(),
System_printf("Starting the example\nSystem provider is set to SysMin Halt the target to view any SysMin contents in ROV.\n");
System_flush();
The program runs fine after reset. But i cant remove all the printf statements from the code as i require them for debugging. how do i prevent this issue ?
Hi Mohammed,
System_printf() is a TI-RTOS kernel feature which do not provide output over serial as per default (assuming this is what you need). There is ways to make sure these calls go out over the UART port instead:
http://processors.wiki.ti.com/index.php/CC26xx_Adding_basic_printf_over_uart_with_TI-RTOS
By initial recommendation would be to use the "Display" driver in UART mode to provide printout in your application.