SCS程序在1310上是否正常运行
SCS 中LED Blinker工程在Task Testing下测试代码能正常运行,LED3和LED4正常闪烁。但将工程通过CCS下载到板子中,复位后LED无闪烁,如何确定SCS端程序时候正常执行,另外,在CCS debug后程序直接全速运行,无法单步执行!求解答!谢谢大家了!
SCS生成的代码添加大CCS工程中之后,还需要在CCS原工程中触发SCS代码进行迭代。
如
SCIF_RESULT_T scifExecuteTasksOnceNbl(uint16_t bvTaskIds);
SCIF_RESULT_T scifStartTasksNbl(uint16_t bvTaskIds);
在SCS生成的目标文件中已经包括了CCS的工程,直接导入CCS中编译无错误后下载到DEMO板,可以吗?
CCS原工程中触发SCS代码进行迭代?你明白是什么意思?
SCIF_RESULT_T scifExecuteTasksOnceNbl(uint16_t bvTaskIds);如何添加到工程中?
你可以参考SCS生成的main_tirtos.c文件。
void taskFxn(UArg a0, UArg a1) {
// Initialize UART parameters
UART_Params_init(&uParams);
uParams.baudRate = 115200;
uParams.writeDataMode = UART_DATA_TEXT;
uParams.dataLength = UART_LEN_8;
uParams.stopBits = UART_STOP_ONE;
// Initialize the Sensor Controller
scifOsalInit();
scifOsalRegisterCtrlReadyCallback(scCtrlReadyCallback);
scifOsalRegisterTaskAlertCallback(scTaskAlertCallback);
scifInit(&scifDriverSetup);
// Configure and run the ADC Data Streamer task. The task generates ALERT interrupt when the sample
// buffer is half full.
scifExecuteTasksOnceNbl(BV(SCIF_ADC_DATA_STREAMER_TASK_ID));
// Main loop
while (1) {
// Wait for an ALERT callback
Semaphore_pend(Semaphore_handle(&semScTaskAlert), BIOS_WAIT_FOREVER);
// Clear the ALERT interrupt source
scifClearAlertIntSource();
// Open UART
uHandle = UART_open(Board_UART, &uParams);
// Fetch the current head index
int head = scifTaskData.adcDataStreamer.state.head;
int tail = scifTaskData.adcDataStreamer.state.tail;
// Calculate the number of 64 sample chunks to process
int sampleCount = head - tail;
if (sampleCount < 0) {
sampleCount += SCIF_ADC_DATA_STREAMER_BUFFER_SIZE;
}
int chunksLeft = sampleCount / 64;
// For each chunk ...
while (chunksLeft--) {
// For each sample in the chunk ...
int sum = 0;
for (int n = 0; n < 64; n++) {
// Add to the sum
sum += scifTaskData.adcDataStreamer.output.pSamples[tail];
// Increment the tail index
if (++tail >= SCIF_ADC_DATA_STREAMER_BUFFER_SIZE) {
tail = 0;
}
}
// Send the sum of all samples in the chunk over UART
sprintf(pLine, "%d\r\n", sum);
UART_write(uHandle, pLine, strlen(pLine));
}
// Acknowledge the ALERT event. Note that there are no event flags for this task since the Sensor
// Controller uses fwGenQuickAlertInterrupt(), but this function must be called nonetheless.
scifAckAlertEvents();
// Write back the tail index so the Sensor Controller can calculate the number of samples in the
// buffer, and re-enable ALERT generation (on buffer half full)
scifTaskData.adcDataStreamer.state.tail = tail;
scifTaskData.adcDataStreamer.state.alertEnabled = 1;
// Close UART
UART_close(uHandle);
}
} // taskFxn
问题已经解决,谢谢你了!生成代码是2650平台上,需要移植到CC1310上才能正常工作!