Part Number: PROCESSOR-SDK-DRA8X-TDA4X
Tool/software: TI C/C++ Compiler
hi,
I want to create task to perform monitoring the other task, so I wrote the following.
(*I reuse the code 'Can response and bootloader demo' in mcusw)
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
#define TEST_TASK_PRIORITY (3) static Void MasterApp_TaskFxn(UArg a0, UArg a1)
{
Task_Handle testSlaveTask[4];
Task_Params testSlaveTaskParams[4];
Error_Block eb;
Task_Stat stat;
int i = 0;
int task_num = 0;
Error_init(&eb);
# if defined(UART_ENABLED)
AppUtils_Printf(MSG_NORMAL, "\n Master start try 5\r\n");
# endif
for ( i = 0 ; i < 4 ; ++i )
{
Task_Params_init(&testSlaveTaskParams[i]);
testSlaveTaskParams[i].instance->name = SLAVE_TASK_NAME[i];
testSlaveTaskParams[i].priority = SLAVE_TASK_PRIORITY;
testSlaveTaskParams[i].stack = testSlaveApp_TaskStack[i];
testSlaveTaskParams[i].stackSize = sizeof (testSlaveApp_TaskStack[i]);
testSlaveTask[i] = Task_create(TestApp_TaskFxn, &testSlaveTaskParams[i], &eb);
if (NULL == testSlaveTask[i])
{
# if defined(UART_ENABLED)
AppUtils_Printf(MSG_NORMAL, "\nSlave Task creation failed\r\n");
# endif
BIOS_exit(0);
}
}
while (1)
{
Task_stat(testSlaveTask[task_num], &stat);
# if defined(UART_ENABLED)
AppUtils_Printf(MSG_NORMAL, "[Check:%s] Priority : %d, Task Mode : %s \r\n", Task_Handle_name(testSlaveTask[task_num]), stat.priority, TASK_MODE_STRING[stat.mode]);
//AppUtils_Printf(MSG_NORMAL, "\nMaster Task\r\n");
# endif
task_num++;
Task_sleep(100);
}
}
static Void TestApp_TaskFxn(UArg a0, UArg a1)
{
int i = 0;
Task_Handle myHandle = Task_self();
for ( i = 0 ; i < 100 ; ++i )
{
AppUtils_Printf(MSG_NORMAL, "\n[TestApp:%s] MCU Task Test %d\r\n", Task_Handle_name(myHandle), i);
TaskP_yield();
//Task_sleep(10);
}
return;
}
|
cs |
But, I run this code, slave threads are executed only a few times and stopped.
If delete Task_stat() code, That code is running successfully.
When I read this page(https://e2e.ti.com/support/legacy_forums/embedded/tirtos/f/355/t/572860), I think, Task_stat() function doesn't seemed to be the cause.
(Thread perform so small task, so STACK_SIZE is not the cause, too)
Thanks to regard.