請問SDK mmwave_sdk_03_01_00_02 driver spi code issue

Other Parts Discussed in Thread: AWR1843BOOST
Hi ,
請教一下 我使用SDK mmwave_sdk_03_01_00_02 driver spi code
去跑CCS 搭EVM 板子測試
會發生以下結果:
[Cortex_R4_0] Error: Unable to open the SPI Instance
Feature: SPI_open API test (instance=0): Failed
Error: MCPI_logMessage buffer overflow logMessageLen = 55
Debug: Finished API Test for SPIA!
Error: Unable to open the SPI Instance
Feature: SPI_open API test (instance=1): Failed
Error: MCPI_logMessage buffer overflow logMessageLen = 110
Debug: Finished API Test for SPIB!
Error: Unable to open the SPI Instance
Debug: Finished API Test for SPIA + SPIB!
Debug: SPI loopback Test for SPIA!
Error: Unable to open the SPI Instance
Feature: SPI loopback test - instance(0), 16bits DMA mode: Failed
Error: MCPI_logMessage buffer overflow logMessageLen = 183
Debug: SPI loopback Test for SPIB on Slave 0!
Error: Unable to open the SPI Instance
Feature: SPI loopback test - instance(1), 16bits DMA mode: Failed
Error: MCPI_logMessage buffer overflow logMessageLen = 256
Debug: SPI loopback Test for SPIB on Slave 1!
Error: Unable to open the SPI Instance
Feature: SPI loopback test - instance(1), 16bits DMA mode: Failed
Error: MCPI_logMessage buffer overflow logMessageLen = 329
Debug: SPI loopback Test for SPIB on Slave 2!
Error: Unable to open the SPI Instance
Feature: SPI loopback test - instance(1), 16bits DMA mode: Failed
Error: MCPI_logMessage buffer overflow logMessageLen = 402
Debug: Loopback test finished!
Error: Unable to open the SPI Instance
Feature: SPI Slave with PC : Failed
Error: MCPI_logMessage buffer overflow logMessageLen = 445
Debug: SPI Test is done!
看起來SDK 的driver code 開啟SPI都會發生問題
請問是否有人遇過類似的問題嗎? 可能是哪邊設定錯誤嗎?
非常感謝
  • 你好,

    请问你使用的板子是?为什么不使用目前最新的mmwave sdk3.4?
  • Dear Expert,

    以下是我使用的spi driver code部分:

    static void Test_initTask(UArg arg0, UArg arg1)
    {
    bool masterMode = true;
    DMA_Params dmaParams;
    int32_t retVal = 0;
    SOC_Handle socHandle;
    int32_t errCode;

    /* Get SOC driver Handle */
    socHandle = (SOC_Handle) arg0;

    /**************************************************************************
    * Test: MCPI_Initialize
    **************************************************************************/
    /* Initialize MCPI logger framework */
    MCPI_Initialize ();

    /* Init SYSDMA params */
    DMA_Params_init(&dmaParams);

    /* 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();

    /**************************************************************************
    * 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");

    /**************************************************************************
    * Test: LoopBack Test
    **************************************************************************/
    if(gXWR1xxxLoopbackTest)
    {
    System_printf("Debug: SPI loopback Test for SPIA!\n");

    /* MibSPIA loopback test , MibSPIA only supports one slave */
    Test_loopback_oneInstance(0U, 0U);

    System_printf("Debug: SPI loopback Test for SPIB on Slave 0!\n");

    /* MibSPIB loopback test, slave -0 */
    Test_loopback_oneInstance(1U, 0U);

    System_printf("Debug: SPI loopback Test for SPIB on Slave 1!\n");

    /* MibSPIB loopback test, slave -1 */
    Test_loopback_oneInstance(1U, 1U);

    System_printf("Debug: SPI loopback Test for SPIB on Slave 2!\n");

    /* MibSPIB loopback test, slave -2 */
    Test_loopback_oneInstance(1U, 2U);
    System_printf("Debug: Loopback test finished!\n");
    }

    if (gXWR1xxxMasterWithMSPTest)
    {
    /* Enable output control for SPIA 3-pin Mode */
    if(SOC_SPIOutputCtrl(socHandle, 0U, 1U, &errCode) < 0)
    {
    /* Debug Message: */
    System_printf ("Debug: SOC_SPIOutputCtrl failed with Error [%d]\n", errCode);
    return;
    }

    masterMode = true;

    /**************************************************************************
    * Test: XWR16 Master mode test with MSP43x
    **************************************************************************/
    Test_spiWithMSP43x(masterMode, 1000000U);

    /**************************************************************************
    * Test: XWR16 Master mode for throughput test with MSP43x
    **************************************************************************/
    Task_sleep(10);
    Test_spiMSP432xThroughput(masterMode, 1000000U);

    Task_sleep(10);
    Test_spiMSP432xThroughput(masterMode, 2000000U);

    Task_sleep(10);
    Test_spiMSP432xThroughput(masterMode, 6000000U);

    Task_sleep(10);
    Test_spiMSP432xThroughput(masterMode, 8000000U);

    Task_sleep(10);
    Test_spiMSP432xThroughput(masterMode, 10000000U);
    }
    else if (gXWR1xxxSlaveWithMSPTest)
    {
    /* Enable output control for SPIA 3-pin Mode */
    if(SOC_SPIOutputCtrl(socHandle, 0U, 1U, &errCode) < 0)
    {
    /* Debug Message: */
    System_printf ("Debug: SOC_SPIOutputCtrl failed with Error [%d]\n", errCode);
    return;
    }

    masterMode = false;
    /**************************************************************************
    * Test: XWR16 Slave mode test with MSP43x
    **************************************************************************/
    Test_spiWithMSP43x(masterMode, 0);

    /**************************************************************************
    * Test: XWR16 Master mode for throughput test with MSP43x
    **************************************************************************/
    Task_sleep(10);
    Test_spiMSP432xThroughput(masterMode, 1000000U);

    Task_sleep(10);
    Test_spiMSP432xThroughput(masterMode, 2000000U);

    Task_sleep(10);
    Test_spiMSP432xThroughput(masterMode, 6000000U);

    Task_sleep(10);
    Test_spiMSP432xThroughput(masterMode, 8000000U);

    Task_sleep(10);
    Test_spiMSP432xThroughput(masterMode, 10000000U);
    }

    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();
    }

    /* AR back to back test */
    if(gXWR1xxxMasterWithXWR1xxx || gXWR1xxxSlaveWithXWR1xxx)
    {
    Test_XWR1xxxWithXWR1xxx(socHandle);
    }

    System_printf("Debug: SPI Test is done!\n");

    MCPI_setTestResult ();

    /* After test all done, terminate DSP by calling BIOS_exit().
    This is required by MCPI test framework script.
    MCPI test framework script waits for DSP halt,
    if DSP doesn't halt, script will wait until timeout then claim test fail.
    */
    BIOS_exit(0);

    return;
    }

    會發生以下結果:

    [Cortex_R4_0] Error: Unable to open the SPI Instance
    Feature: SPI_open API test (instance=0): Failed
    Error: MCPI_logMessage buffer overflow logMessageLen = 55
    Debug: Finished API Test for SPIA!
    Error: Unable to open the SPI Instance
    Feature: SPI_open API test (instance=1): Failed
    Error: MCPI_logMessage buffer overflow logMessageLen = 110
    Debug: Finished API Test for SPIB!
    Error: Unable to open the SPI Instance
    Debug: Finished API Test for SPIA + SPIB!
    Debug: SPI loopback Test for SPIA!
    Error: Unable to open the SPI Instance
    Feature: SPI loopback test - instance(0), 16bits DMA mode: Failed
    Error: MCPI_logMessage buffer overflow logMessageLen = 183
    Debug: SPI loopback Test for SPIB on Slave 0!
    Error: Unable to open the SPI Instance
    Feature: SPI loopback test - instance(1), 16bits DMA mode: Failed
    Error: MCPI_logMessage buffer overflow logMessageLen = 256
    Debug: SPI loopback Test for SPIB on Slave 1!
    Error: Unable to open the SPI Instance
    Feature: SPI loopback test - instance(1), 16bits DMA mode: Failed
    Error: MCPI_logMessage buffer overflow logMessageLen = 329
    Debug: SPI loopback Test for SPIB on Slave 2!
    Error: Unable to open the SPI Instance
    Feature: SPI loopback test - instance(1), 16bits DMA mode: Failed
    Error: MCPI_logMessage buffer overflow logMessageLen = 402
    Debug: Loopback test finished!
    Error: Unable to open the SPI Instance
    Feature: SPI Slave with PC : Failed
    Error: MCPI_logMessage buffer overflow logMessageLen = 445
    Debug: SPI Test is done!

  • 你好,

    请问你使用的是TI那款mmwave EVM?是xwr1642BOOST?
    TI的代码都提供了源码,请跟踪一下,看为何SPI open失败。
  • HI,
    我使用的是AWR1843BOOST,
    我自己trace 看起來像是SPI_init()的問題:
    void SPI_init(void)
    {
    if (SPI_count == MINUS_ONE) {
    /* Call each driver's init function */
    for (SPI_count = 0; SPI_config[SPI_count].fxnTablePtr != NULL; SPI_count++) {
    SPI_config[SPI_count].fxnTablePtr->initFxn((SPI_Handle)&(SPI_config[SPI_count]));
    }
    }
    }

    猜想是SPI_config[SPI_count].fxnTablePtr != NULL這個判斷式造成都沒進入for loop的內容
    想請教這樣子的問題會關聯到哪部分呢?
    謝謝
  • 你好,

    1. 请使用最新版本的mmwave sdk3.4
    2. 确认板上S2开关指向SPI
    3. 请确认你板上烧写的ccs debug bin文件和运行的测试例程都是从一个sdk里面来的。