Spaces:
Runtime error
Runtime error
File size: 28,386 Bytes
b24351f |
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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 |
CCS/IWR6843: SPI test compile error
Part Number: IWR6843 Tool/software: Code Composer Studio I'm trying to test SPI function on IWR6843. After finished pinmux settings, I modified the mss_main.c code of 3D people counting and added the SPI test code based on sample code in the path: C:\ti\mmwave_sdk_03_03_00_03\packages\ti\drivers\spi\test\xwr68xx I already done SPI_init(), SPI_Params_init(¶ms); But there were many errors occurred. Please explain (something like 3D_people_count_68xx_mss.xe4f not built, other errors and help me solve it. Here's the code I used void Test_spiSlaveWithPC(void)
{
SPI_Params params;
SPI_Handle handle;
spiTestMsg* pTestMsg;
uint16_t retry=0;
uint16_t msgSeqNo = 0;
uint32_t loop;
volatile uint32_t cycles;
float throughput;
uint32_t totalLoop;
/* Setup the default SPI Parameters */
SPI_Params_init(¶ms);
params.mode = SPI_SLAVE;
params.frameFormat = SPI_POL0_PHA1;
params.pinMode = SPI_PINMODE_4PIN_CS;
params.shiftFormat = SPI_MSB_FIRST;
/* When communicating with PC through FTDI, it is difficult to toggle CS for every two bytes, hence set csHold to 1.
In this mode, the highest working SPI clock is 2MHz */
params.csHold = 1;
/* Enable DMA and set DMA channels */
params.dmaEnable = 1;
params.dmaHandle = gDmaHandle;
params.u.slaveParams.dmaCfg.txDmaChanNum =1U;
params.u.slaveParams.dmaCfg.rxDmaChanNum =0U;
handle = SPI_open(0, ¶ms);
if (handle == NULL)
{
System_printf("Error: Unable to open the SPI Instance\n");
MCPI_setFeatureTestResult ("SPI Slave with PC ", MCPI_TestResult_FAIL);
return;
}
memset((void *)txBuf, 0x55, SPI_TEST_MSGLEN);
System_printf("Debug: SPI Instance %p has been reopened in SLAVE mode successfully for 4pin FTDI testing\n", handle);
gXWR1xxxSlaveReady = true;
while(1)
{
Test_spiRead(handle, SPI_TEST_MSGLEN, (void *)rxBuf, 0U);
pTestMsg = (spiTestMsg*)&rxBuf[0];
if(pTestMsg->magicNumber != SWAP_BYTES(MAGIC_NUMBER))
{
System_printf("incorrect magic Number: 0x%x 0x%x\n", pTestMsg->magicNumber, SWAP_BYTES(MAGIC_NUMBER));
continue;
}
if((pTestMsg->dataLen != SWAP_BYTES(SPI_TEST_SYNC_MSGLEN)) || (pTestMsg->seqNo != 0))
{
System_printf("incorrect datalen(%d), seqNo= %d\n", pTestMsg->dataLen, pTestMsg->seqNo);
continue;
}
/* Got the correct sync message, send back the message */
msgSeqNo = SWAP_BYTES(pTestMsg->seqNo);
pTestMsg->seqNo = SWAP_BYTES(msgSeqNo+1);
/* Read two byte , send it back */
Test_spiWrite(handle, SPI_TEST_MSGLEN, (void *)pTestMsg, 0U);
break;
}
/* Save the Sync message for re-sent */
memcpy((void *)txBuf, (void *)pTestMsg, SPI_TEST_MSGLEN);
/* Got the Sync message, waiting for next test message */
msgSeqNo += 2;
/* Test loop count from first 16 bits of Sync message */
loop = pTestMsg->data[0] * 256 + pTestMsg->data[1] ;
System_printf("Test loop=%d, bufferLen=%d\n", loop, SPI_TEST_MSGLEN);
totalLoop = loop;
while(loop)
{
/* Read two byte , send it back */
Test_spiRead(handle, SPI_TEST_MSGLEN, (void *)rxBuf, 0U);
if(pTestMsg->magicNumber != SWAP_BYTES(MAGIC_NUMBER))
{
continue;
}
if((pTestMsg->seqNo == 0) && (pTestMsg->dataLen == SWAP_BYTES(SPI_TEST_SYNC_MSGLEN)))
{
/* Re-sent the Sync message */
Test_spiWrite(handle, SPI_TEST_MSGLEN, (void *)txBuf, 0U);
continue;
}
/* Receive Last message */
if(pTestMsg->seqNo == SWAP_BYTES(msgSeqNo - 2))
{
Test_spiWrite(handle, SPI_TEST_MSGLEN, (void *)txBuf, 0U);
retry++;
continue;
}
/* Incorrect seqNo, drop the message */
if(pTestMsg->seqNo != SWAP_BYTES(msgSeqNo))
{
retry++;
continue;
}
if(loop == totalLoop)
{
// Start the counter after receive the first message
Test_benchmarkStart(0);
}
retry = 0;
loop--;
/* Receive the message with correct header, increment the seq Number */
pTestMsg->seqNo = SWAP_BYTES(SWAP_BYTES(pTestMsg->seqNo) + 1);
Test_spiWrite(handle, SPI_TEST_MSGLEN, (void *)pTestMsg, 0U);
msgSeqNo += 2;
}
// Stop the counter
cycles = Test_benchmarkStop(0);
// Calculate and print the count
throughput = 8.0 * SPI_TEST_MSGLEN * totalLoop * VBUSP_FREQ / cycles;
System_printf("Debug: throughput overall = %.2f Mbps\n", throughput);
MCPI_setFeatureTestResult ("SPI Slave with PC ", MCPI_TestResult_PASS);
}
/**
* @b Description
* @n
* System Initialization Task which initializes the various
* components in the system.
*
* @retval
* Not Applicable.
*/
static void Pcount3DDemo_initTask(UArg arg0, UArg arg1)
{
int32_t errCode;
MMWave_InitCfg initCfg;
UART_Params uartParams;
Task_Params taskParams;
Semaphore_Params semParams;
DPM_InitCfg dpmInitCfg;
DMA_Params dmaParams;
DMA_Handle dmaHandle;
SPI_Params params;
SPI_Handle handle;
SOC_Handle socHandle;
spiTestMsg* pTestMsg;
int32_t retVal = 0;
/* Get SOC driver Handle */
socHandle = (SOC_Handle) arg0;
DPC_ObjectDetectionRangeHWA_InitParams objDetInitParams;
// int32_t i;
/* Debug Message: */
System_printf("Debug: Launched the Initialization Task\n");
/* Initialize MCPI logger framework */
MCPI_Initialize ();
/*****************************************************************************
* Initialize the mmWave SDK components:
*****************************************************************************/
/* Initialize the UART */
UART_init();
/* Initialize the DMA for UART */
DMA_init ();
/* Open DMA driver instance 0 for SPI test */
gDmaHandle = DMA_open(0, &dmaParams, &retVal);
if(gDmaHandle == NULL)
{
printf("Open DMA driver failed with error=%d\n", retVal);
return;
}
/* Initialize the SPI */
SPI_init();
/* Setup the default SPI Parameters */
SPI_Params_init(¶ms);
/**************************************************************************
* Test: One instace API test - SPIA
**************************************************************************/
Test_spiAPI_oneInstance(0);
System_printf("Debug: Finished API Test for SPIA!\n");
/**************************************************************************
* Test: One instace API test - SPIB
**************************************************************************/
Test_spiAPI_oneInstance(1);
System_printf("Debug: Finished API Test for SPIB!\n");
/**************************************************************************
* Test: two instaces API test - SPIA & SPIB
**************************************************************************/
Test_spiAPI_twoInstance();
System_printf("Debug: Finished API Test for SPIA + SPIB!\n");
if(gXWR1xxxSlaveWithFTDITest)
{
/* Enable output control for SPIA in 4Pin mode */
if(SOC_SPIOutputCtrl(socHandle, 0U, 0U, &errCode) < 0)
{
/* Debug Message: */
System_printf ("Debug: SOC_SPIOutputCtrl failed with Error [%d]\n", errCode);
return;
}
Test_spiSlaveWithPC();
}
/* Open the DMA Instance */
DMA_Params_init(&dmaParams);
dmaHandle = DMA_open(0, &dmaParams, &errCode);
if (dmaHandle == NULL)
{
printf ("Error: Unable to open the DMA Instance [Error code %d]\n", errCode);
return;
}
/* Initialize the GPIO */
GPIO_init();
/* Initialize the Mailbox */
Mailbox_init(MAILBOX_TYPE_MSS);
/* Platform specific configuration */
Pcount3DDemo_platformInit(&gMmwMssMCB.cfg.platformCfg);
/*****************************************************************************
* Open the mmWave SDK components:
*****************************************************************************/
/* Setup the default UART Parameters */
UART_Params_init(&uartParams);
uartParams.clockFrequency = gMmwMssMCB.cfg.platformCfg.sysClockFrequency;
uartParams.baudRate = gMmwMssMCB.cfg.platformCfg.commandBaudRate;
uartParams.isPinMuxDone = 1;
/* Open the UART Instance */
gMmwMssMCB.commandUartHandle = UART_open(0, &uartParams);
if (gMmwMssMCB.commandUartHandle == NULL)
{
Pcount3DDemo_debugAssert (0);
return;
}
/* Setup the default UART Parameters */
UART_Params_init(&uartParams);
uartParams.writeDataMode = UART_DATA_BINARY;
uartParams.readDataMode = UART_DATA_BINARY;
uartParams.clockFrequency = gMmwMssMCB.cfg.platformCfg.sysClockFrequency;
uartParams.baudRate = gMmwMssMCB.cfg.platformCfg.loggingBaudRate;
uartParams.isPinMuxDone = 1U;
uartParams.dmaHandle = dmaHandle;
uartParams.txDMAChannel = UART_DMA_TX_CHANNEL;
uartParams.rxDMAChannel = UART_DMA_RX_CHANNEL;
/* Open the Logging UART Instance: */
gMmwMssMCB.loggingUartHandle = UART_open(1, &uartParams);
if (gMmwMssMCB.loggingUartHandle == NULL)
{
System_printf("Error: Unable to open the Logging UART Instance\n");
Pcount3DDemo_debugAssert (0);
return;
}
/* Create binary semaphores which is used to signal DPM_start/DPM_stop/DPM_ioctl is done
* to the sensor management task. The signalling (Semaphore_post) will be done
* from DPM registered report function (which will execute in the DPM execute task context). */
Semaphore_Params_init(&semParams);
semParams.mode = Semaphore_Mode_BINARY;
gMmwMssMCB.DPMstartSemHandle = Semaphore_create(0, &semParams, NULL);
gMmwMssMCB.DPMstopSemHandle = Semaphore_create(0, &semParams, NULL);
gMmwMssMCB.DPMioctlSemHandle = Semaphore_create(0, &semParams, NULL);
/* Open EDMA driver */
Pcount3DDemo_edmaInit(&gMmwMssMCB.dataPathObj, DPC_OBJDET_R4F_EDMA_INSTANCE);
/* Use EDMA instance 0 on MSS */
Pcount3DDemo_edmaOpen(&gMmwMssMCB.dataPathObj, DPC_OBJDET_R4F_EDMA_INSTANCE);
Pcount3DDemo_hwaInit(&gMmwMssMCB.dataPathObj);
Pcount3DDemo_hwaOpen(&gMmwMssMCB.dataPathObj, gMmwMssMCB.socHandle);
/*****************************************************************************
* mmWave: Initialization of the high level module
*****************************************************************************/
/* Initialize the mmWave control init configuration */
memset ((void*)&initCfg, 0 , sizeof(MMWave_InitCfg));
/* Populate the init configuration: */
initCfg.domain = MMWave_Domain_MSS;
initCfg.socHandle = gMmwMssMCB.socHandle;
initCfg.eventFxn = Pcount3DDemo_eventCallbackFxn;
initCfg.linkCRCCfg.useCRCDriver = 1U;
initCfg.linkCRCCfg.crcChannel = CRC_Channel_CH1;
initCfg.cfgMode = MMWave_ConfigurationMode_FULL;
initCfg.executionMode = MMWave_ExecutionMode_ISOLATION;
/* Initialize and setup the mmWave Control module */
gMmwMssMCB.ctrlHandle = MMWave_init (&initCfg, &errCode);
if (gMmwMssMCB.ctrlHandle == NULL)
{
/* Error: Unable to initialize the mmWave control module */
System_printf ("Error: mmWave Control Initialization failed [Error code %d]\n", errCode);
Pcount3DDemo_debugAssert (0);
return;
}
System_printf ("Debug: mmWave Control Initialization was successful\n");
/* Synchronization: This will synchronize the execution of the control module
* between the domains. This is a prerequiste and always needs to be invoked. */
if (MMWave_sync (gMmwMssMCB.ctrlHandle, &errCode) < 0)
{
/* Error: Unable to synchronize the mmWave control module */
System_printf ("Error: mmWave Control Synchronization failed [Error code %d]\n", errCode);
Pcount3DDemo_debugAssert (0);
return;
}
System_printf ("Debug: mmWave Control Synchronization was successful\n");
// Create a task to do SPI
/* Task_Params_init(&taskParams);
taskParams.stackSize = 6*1024;
taskParams.arg0 = (UArg)socHandle;
Task_create(Test_initTask, &taskParams, NULL);*/
/*****************************************************************************
* Launch the mmWave control execution task
* - This should have a higher priroity than any other task which uses the
* mmWave control API
*****************************************************************************/
Task_Params_init(&taskParams);
taskParams.priority = MMWDEMO_MMWAVE_CTRL_TASK_PRIORITY;
taskParams.stackSize = 2800;
gMmwMssMCB.taskHandles.mmwaveCtrl = Task_create(Pcount3DDemo_mmWaveCtrlTask, &taskParams, NULL);
/*****************************************************************************
* Create a task to do DMA based UART data transfer
*****************************************************************************/
/* Create a binary semaphore for application task to pend */
Semaphore_Params_init(&semParams);
semParams.mode = Semaphore_Mode_BINARY;
gMmwMssMCB.uartTxSemHandle = Semaphore_create(0, &semParams, NULL);
Task_Params_init(&taskParams);
taskParams.priority = MMWDEMO_UARTTX_TASK_PRIORITY;
taskParams.stackSize = 800;
Task_create(MmwDemo_uartTxTask, &taskParams, NULL);
/*****************************************************************************
* Initialization of the DPM Module:
*****************************************************************************/
memset ((void *)&objDetInitParams, 0, sizeof(DPC_ObjectDetectionRangeHWA_InitParams));
/* Note this must be after Pcount3DDemo_dataPathOpen() above which opens the hwa */
objDetInitParams.L3ramCfg.addr = (void *)&gMmwL3[0];
objDetInitParams.L3ramCfg.size = sizeof(gMmwL3);
objDetInitParams.CoreLocalRamCfg.addr = &gDPCTCM[0];
objDetInitParams.CoreLocalRamCfg.size = sizeof(gDPCTCM);
objDetInitParams.edmaHandle = gMmwMssMCB.dataPathObj.edmaHandle;
objDetInitParams.hwaHandle = gMmwMssMCB.dataPathObj.hwaHandle;
/* DPC Call-back config */
objDetInitParams.processCallBackFxn.processInterFrameBeginCallBackFxn =
Pcount3DDemo_DPC_ObjectDetection_processInterFrameCallBackFxn;
objDetInitParams.processCallBackFxn.processFrameBeginCallBackFxn =
Pcount3DDemo_DPC_ObjectDetection_processFrameBeginCallBackFxn;
/* Setup the configuration: */
memset ((void *)&dpmInitCfg, 0, sizeof(DPM_InitCfg));
dpmInitCfg.socHandle = gMmwMssMCB.socHandle;
dpmInitCfg.ptrProcChainCfg = &gDPC_ObjDetRangeHWACfg;;
dpmInitCfg.instanceId = DPC_OBJDET_R4F_INSTANCEID;
dpmInitCfg.domain = DPM_Domain_DISTRIBUTED;
dpmInitCfg.reportFxn = Pcount3DDemo_DPC_ObjectDetection_reportFxn;
dpmInitCfg.arg = &objDetInitParams;
dpmInitCfg.argSize = sizeof(DPC_ObjectDetectionRangeHWA_InitParams);
/* Initialize the DPM Module: */
gMmwMssMCB.objDetDpmHandle = DPM_init (&dpmInitCfg, &errCode);
if (gMmwMssMCB.objDetDpmHandle == NULL)
{
System_printf ("Error: Unable to initialize the DPM Module [Error: %d]\n", errCode);
Pcount3DDemo_debugAssert (0);
return;
}
/* Synchronization: This will synchronize the execution of the datapath module
* between the domains. This is a prerequiste and always needs to be invoked. */
while (1)
{
int32_t syncStatus;
/* Get the synchronization status: */
syncStatus = DPM_synch (gMmwMssMCB.objDetDpmHandle, &errCode);
if (syncStatus < 0)
{
/* Error: Unable to synchronize the framework */
System_printf ("Error: DPM Synchronization failed [Error code %d]\n", errCode);
Pcount3DDemo_debugAssert (0);
return;
}
if (syncStatus == 1)
{
/* Synchronization acheived: */
break;
}
/* Sleep and poll again: */
Task_sleep(1);
}
#ifdef TRACKERPROC_EN
/*****************************************************************************
* Create a task to run tracker DPU at lower priority than HWA DPC
*****************************************************************************/
/* Create a binary semaphore for application task to pend */
Semaphore_Params_init(&semParams);
semParams.mode = Semaphore_Mode_BINARY;
gMmwMssMCB.trackerDPUSemHandle = Semaphore_create(0, &semParams, NULL);
Task_Params_init(&taskParams);
taskParams.priority = MMWDEMO_TRACKERDPU_TASK_PRIORITY;
taskParams.stackSize = 7*1024;
Task_create(MmwDemo_trackerDPUTask, &taskParams, NULL);
#endif
/* Launch the DPM Task */
Task_Params_init(&taskParams);
taskParams.priority = MMWDEMO_DPC_OBJDET_DPM_TASK_PRIORITY;
taskParams.stackSize = 7*1024;
gMmwMssMCB.taskHandles.objDetDpmTask = Task_create(mmwDemo_mssDPMTask, &taskParams, NULL);
/*****************************************************************************
* Initialize the Profiler
*****************************************************************************/
Cycleprofiler_init();
/*****************************************************************************
* Initialize the CLI Module:
*****************************************************************************/
Pcount3DDemo_CLIInit(MMWDEMO_CLI_TASK_PRIORITY);
return;
}
int main(void)
{
/*=======================================
* Setup the PINMUX to bring out the MibSpiA
*=======================================*/
/* NOTE: Please change the following pin configuration according
to EVM used for the test */
/* SPIA_MOSI */
Pinmux_Set_OverrideCtrl(SOC_XWR68XX_PIND13_PADAD, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
Pinmux_Set_FuncSel(SOC_XWR68XX_PIND13_PADAD, SOC_XWR68XX_PIND13_PADAD_SPIA_MOSI);
/* SPIA_MISO */
Pinmux_Set_OverrideCtrl(SOC_XWR68XX_PINE14_PADAE, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
Pinmux_Set_FuncSel(SOC_XWR68XX_PINE14_PADAE, SOC_XWR68XX_PINE14_PADAE_SPIA_MISO);
/* SPIA_CLK */
Pinmux_Set_OverrideCtrl(SOC_XWR68XX_PINE13_PADAF, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
Pinmux_Set_FuncSel(SOC_XWR68XX_PINE13_PADAF, SOC_XWR68XX_PINE13_PADAF_SPIA_CLK);
/* SPIA_CS */
Pinmux_Set_OverrideCtrl(SOC_XWR68XX_PINE15_PADAG, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
Pinmux_Set_FuncSel(SOC_XWR68XX_PINE15_PADAG, SOC_XWR68XX_PINE15_PADAG_SPIA_CSN);
/* SPI_HOST_INTR - not used, reference code */
Pinmux_Set_OverrideCtrl(SOC_XWR68XX_PINP13_PADAA, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
Pinmux_Set_FuncSel(SOC_XWR68XX_PINP13_PADAA, SOC_XWR68XX_PINP13_PADAA_SPI_HOST_INTR);
/*=======================================
* Setup the PINMUX to bring out the MibSpiB
*=======================================*/
/* NOTE: Please change the following pin configuration according
to EVM used for the test */
/* Setup the PINMUX to bring out the MibSpiB */
Pinmux_Set_OverrideCtrl(SOC_XWR68XX_PINF13_PADAH, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
Pinmux_Set_FuncSel(SOC_XWR68XX_PINF13_PADAH, SOC_XWR68XX_PINF13_PADAH_SPIB_MOSI);
Pinmux_Set_OverrideCtrl(SOC_XWR68XX_PING14_PADAI, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
Pinmux_Set_FuncSel(SOC_XWR68XX_PING14_PADAI, SOC_XWR68XX_PING14_PADAI_SPIB_MISO);
Pinmux_Set_OverrideCtrl(SOC_XWR68XX_PINF14_PADAJ, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
Pinmux_Set_FuncSel(SOC_XWR68XX_PINF14_PADAJ, SOC_XWR68XX_PINF14_PADAJ_SPIB_CLK);
Pinmux_Set_OverrideCtrl(SOC_XWR68XX_PINH14_PADAK, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
Pinmux_Set_FuncSel(SOC_XWR68XX_PINH14_PADAK, SOC_XWR68XX_PINH14_PADAK_SPIB_CSN);
/* SPIB signals are connected to PMIC and XDS110 , unless the connection is removed on XWR16
EVM, SPI signals can not be enabled as output. */
#if 0
/* Enable output control for SPIB */
if(SOC_SPIOutputCtrl(socHandle, 1U, 1U, &errCode) < 0)
{
/* Debug Message: */
System_printf ("Debug: SOC_SPIOutputCtrl failed with Error [%d]\n", errCode);
goto Exit;
}
#endif
/* SPIA DMA and interrupt signals are muxed with other IPs in the SOC.
* Map them to SPIA.
*/
if (SOC_selectDMARequestMapping(socHandle, SOC_MODULE_SPIA, &errCode) < 0)
{
/* Debug Message: */
System_printf ("Debug: SOC_selectDMARequestMapping (SPIA) failed with Error [%d]\n", errCode);
goto Exit;
}
if (SOC_selectInterruptRequestMapping(socHandle, SOC_MODULE_SPIA, &errCode) < 0)
{
/* Debug Message: */
System_printf ("Debug: SOC_selectInterruptRequestMapping (SPIA) failed with Error [%d]\n", errCode);
goto Exit;
}
/* Debug Message: */
System_printf ("**********************************************\n");
System_printf ("Debug: Launching the MMW Demo on MSS\n");
System_printf ("**********************************************\n");
/* Initialize the Task Parameters. */
Task_Params_init(&taskParams);
gMmwMssMCB.taskHandles.initTask = Task_create(Pcount3DDemo_initTask, &taskParams, NULL);
/* Start BIOS */
BIOS_start();
Exit:
return 0;
}
Hi Hector, Your errors are all unresolved symbols. This means the linker cannot find a compiled version of the functions you are trying to use. For example, one of your errors is "Unresolved Symbol: SPI_init()" - this means that the SPI library isn't properly included or linked. Please check the following: SPI and other new libraries are included in the relevant files SPI and other new libraries have a path in linker properties. Right click on the CCS project Select Properties at the bottom Select linker on the left Ensure there is a path in the linker setting to spi lib Regards, Justin
Hi Justin, I added spi lib path to the project but compile still got the same error. Please show me how to solve it with illustration photo.
Hi Justin, I also tried another method to add library by clicking to mss project ->Properties->Add files. Then I chose libspi_xwr68xx.aer4f in the path C:\ti\mmwave_sdk_03_03_00_03\packages\ti\drivers\spi\lib. But it still showed #10010 null: errors encountered during linking; "3D_people_count_68xx_mss.xer4f" not built 3D_people_count_68xx_mss C/C++ Problem null: unresolved symbols remain 3D_people_count_68xx_mss C/C++ Problem Import a library should be easy. I don't know why it failed. Here's the message when I tried to add lib file to project
Hi Justin, I got less compiling error by adding xwr68xx_spi_mss.xer4f in the path C:\ti\mmwave_sdk_03_03_00_03\packages\ti\drivers\spi\test\xwr68xx to the project. Previously, I got 13 compile errors. After added xwr68xx_spi_mss.xer4f, now I only see 4 errors. Not sure whether this is better or not. But even if I don't use SPI function and remove all SPI commands, I still have these 4 errors after adding xwr68xx_spi_mss.xer4f to my project. If I don't add it, I only got compile error when I use SPI commands. How to solve it? I expect I can use SPI/I2C within this week, but I got stuck at library linking even though it seems to be easy. 1. Here's the error after I added xwr68xx_spi_mss.xer4f error: "could not be statically or dynamically linked null: file "C:/ti/mmwave_sdk_03_03_00_03/packages/ti/drivers/spi/test/xwr68xx/xwr68xx_spi_mss.xer4f" could not be statically or dynamically linked 3D_people_count_68xx_mss C/C++ Problem 2. Here's the error without xwr68xx_spi_mss.xer4f, I only added libspi_xwr68xx.aer4f in the path C:\ti\mmwave_sdk_03_03_00_03\packages\ti\drivers\spi\lib
Hi Hector, You are linking the test library, instead you need to link the functional library. It is at: C:\ti\mmwave_sdk_03_03_00_03\packages\ti\drivers\spi\lib You can read mmWave SDK module documentation here: C:\ti\mmwave_sdk_03_03_00_03\docs\mmwave_sdk_module_documentation.html - if you go through the SPI documentation, you can see all external functions, which are the ones you should be using. Do not use the "Test" functions unless you are specifically trying to test the functionality of the module. Regards, Justin
Hi Justin, 1. I modified my code, there's no compile error now. But I'm not sure how to test SPI function with UART GUI. As my understanding, we must connect PC to FTDI port on MMWAVEICBOOST in order to use SPI, right? If it's right, do I need to change S1 switch as below to use FTDI? The problem is: after I switched as above and connect PC to FTDI port, I don't see any port number on PC Device Manager to connect device to GUI even though I installed FTDI driver on Windows. How to connect? 2. I see in test_common.c in the path C:\ti\mmwave_sdk_03_03_00_03\packages\ti\drivers\spi\test\common has a function MCPI_setFeatureTestResult ((const char *)&testCase[0], MCPI_TestResult_PASS); I think it's to test whether SPI pass or not. But I can't find where its declaration located. Please tell me more about MCPI_setFeatureTestResult if it's really used to test SPI. 3. How can we send data from IWR6843 to MMWAVEICBOOST via SPI, then send to PC via UART and display on GUI? Below is some basic SPI function in my code, but I don't know how to combine it with UART data transfer to check whether SPI works well and display tracking on GUI correctly. static int32_t Test_spiReadWrite(const SPI_Handle handle, uint32_t dataLen, void* inBuffer, void* outBuffer, uint8_t slaveIndex)
{
SPI_Transaction transaction;
/* Configure Data Transfer */
transaction.count = dataLen;
transaction.txBuf = outBuffer;
transaction.rxBuf = inBuffer;
transaction.slaveIndex = slaveIndex;
/* Start Data Transfer */
if (SPI_transfer(handle, &transaction) != true)
{
return -1;
}
return 0;
}
void MmwDemo_mssInitTask(UArg arg0, UArg arg1)
{
// UART function
UART_init();
}
int main(void)
{
//handle = SPI_open(someSPI_configIndexValue, ¶ms);
handle = SPI_open(0, ¶ms);
if (!handle) {
System_printf("SPI did not open");
}
/* Initialize the Task Parameters. */
Task_Params_init(&taskParams);
taskParams.priority = 3;
taskParams.stackSize = 4*1024;
Task_create(MmwDemo_mssInitTask, &taskParams, NULL);
}
Hi Hector, The FTDI port on the ICBOOST is only for mmWave studio direct control. We don't provide a driver for SPI to windows PC interface. To use the SPI connection, you will need to set the device in 40 Pin BP/LP mode, then connect some other device (like a beagle bone raspberry pi) to SPI pins. Regarding test code - these are unit tests that can be used to ensure the SPI driver is functioning correctly. Unit test documentation is here: <mmwave_sdk_03_03_00_03>/docs/mmwave_sdk_unit_test_procedure.pdf You should not be using any of the test functions in your application. Regards, Justin
Hi Justin, I checked mmwave_sdk_unit_test_procedure.pdf as you said. It mentions we can test SPI on PC via FTDI port by setting gXWR1xxxSlaveWithFTDITest = 1. But I'm still unclear how to check whether SPI function works well in this case. If I write SPI transfer function correctly, and connect IWR6843 EVM from FTDI port to PC USB port. Thencompany GUI can still display tracking ? Orcompany GUI for IWR6843 3D people counting is only to demo via UART on XDS110 port and can't read SPI data from FTDI port?
Hi Hector, I believe Charles answered your questions here: <secret URL>/support/sensors/f/1023/t/897434 - SPI will come out, but we don't have applications that support it, so you will have to find a python library that parses SPI. Regards, Justin
|