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.

[参考译文] IWR6843AOPEVM:用于闪存/SPI 数据的 UART — 无法运行 SPI

Guru**** 2693225 points

Other Parts Discussed in Thread: IWR6843AOP, MMWAVEICBOOST, IWR6843

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/sensors-group/sensors/f/sensors-forum/1590990/iwr6843aopevm-uart-for-flash-spi-for-data---can-t-run-spi

器件型号: IWR6843AOPEVM
主题中讨论的其他器件: MMWAVEICBOOST、IWR6843AOP、 IWR6843

器件:  

iWR6843AoP + mmWaveICboost  

已取得的成就:

我在 MCU 上成功运行开销演示、可以使用 921600 波特率从 IWR6843AOP 读取所有数据。

此外、还可以通过我的 MCU 刷写 IWR6843AOP — 通过自定义脚本,该脚本允许我通过 TCP 进行刷写。  

我的最后一个挑战是让 SPI 接口运行以在高速接口上读取数据、而不是限制为接近 1Mbit。  

因此、到目前为止、我所做的是将 iwr6843 SDK 上的 SPI 驱动程序修改为开销演示源代码、并且到目前为止我所面临的操作非常奇怪。

启用 UART 和 SPI 行为:

CCS 组成的 bin 文件在我的 IWR6843AOP 上运行、但第一次通过 CLI 发送 cfg 后、CLI 会冻结、我无法执行任何操作(SPI 显然也无法正常工作)

但是、如果我暂时禁用 SPI 组件、之后发送 cfg 的 CLI 可以正常工作、但我无法测试 SPI、因为它不起作用。

我到底在做什么呢?  

(PS 主/从配置完全不会更改任何内容)

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    你好。

    启用 SPI 组件时、您是否能够跟踪代码失败的位置?  可能是您为 CLI 和 SPI 任务授予了相同级别的优先级、如果某项任务的设置顺序不正确、则可能会导致代码崩溃。  您是否能够在 CCS 调试中运行自定义演示来确定发生崩溃的位置?

    此致、

    Santosh

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Santosh、

    对不起,正忙两天来解决它 — 也与 Opus 4.5 的帮助下,但没有成功.

    我还检查了所有导线并进行了 GPIO Bang 测试、看看是否相应地发送了传输的数据。  
    我将很快更新我的代码、以便您可以查看它。 不用说、我不确定我的代码是错误的还是在 IWR6843AOP 或 MCU 上正确的。 我们先从 IWR6843 开始  

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    ============================================================================
    TI mmWave Forum Post - Summary
    ============================================================================
    
    SUBJECT: IWR6843AOP SPI Slave Mode - SPI_transfer() Blocks Indefinitely
    
    DEVICE: IWR6843AOP (not standard ISK)
    SDK: mmWave SDK 03.06.02.00-LTS
    APPLICATION: Overhead 3D People Tracking Demo
    
    ============================================================================
    PROBLEM DESCRIPTION
    ============================================================================
    
    We are trying to use IWR6843AOP as an SPI slave to stream radar data to an 
    ESP32 master. The SPI_transfer() call in slave mode BLOCKS indefinitely, 
    causing the CLI to freeze after sensorStart.
    
    SYMPTOMS:
    - SPI_open() succeeds
    - All SOC configuration calls succeed
    - GPIO12 (data-ready) toggles correctly
    - SPI_transfer() is called with valid parameters
    - SPI_transfer() NEVER returns (no timeout, no error)
    - CLI becomes unresponsive
    - Master (ESP32) is ready and clocking, but slave doesn't respond
    
    HARDWARE SETUP:
    - IWR6843AOP (slave) <-> ESP32P4 (master)
    - 4-wire SPI: MOSI, MISO, CLK, CS
    - GPIO12 (INT) for data-ready signal
    - All wires verified with oscilloscope
    
    ============================================================================
    CONFIGURATION ATTEMPTS
    ============================================================================
    
    We have tried ALL of the following combinations (all result in blocking):
    
    1. SPI_PINMODE_4PIN_CS vs SPI_PINMODE_3PIN
    2. chipSelect = 0 vs 1
    3. csHold = 0 vs 1
    4. dataSize = 8 vs 16
    5. frameFormat = SPI_POL0_PHA0 vs SPI_POL0_PHA1
    6. DMA mode vs polling mode
    7. Different timeout values (10, 100, 1000 ticks)
    
    All configurations result in the same behavior: SPI_transfer() blocks forever.
    
    ============================================================================
    CODE REFERENCE
    ============================================================================
    
    See attached code file (TI_FORUM_POST_CODE.txt) for:
    1. Pinmux configuration (AOP variant)
    2. SPI initialization code
    3. SPI_transfer() call that blocks
    4. All SOC setup calls we're using
    
    The code follows the TI test example (xwr68xx/main.c) structure:
    - SOC_selectDMARequestMapping()
    - SOC_selectInterruptRequestMapping()
    - SOC_SPIOutputCtrl() with 4-pin mode (param=0)
    
    ============================================================================
    WORKAROUND
    ============================================================================
    
    We are currently using GPIO bit-bang mode to work around this issue, which
    works but is slow. We would prefer to use the hardware SPI driver.
    
    ============================================================================
    QUESTIONS
    ============================================================================
    
    1. Is there a known issue with SPI_transfer() blocking in slave mode on 
       IWR6843AOP?
    
    2. Are there any additional SOC calls or configuration steps required for 
       AOP variant that differ from standard ISK?
    
    3. Should we be using a different SPI instance (SPI-B instead of SPI-A)?
    
    4. Is there a way to make SPI_transfer() non-blocking or check its status?
    
    5. Are there any hardware requirements we might be missing (pull-up 
       resistors, clock speed limits, etc.)?
    
    6. Is there a specific order of operations required before calling 
       SPI_transfer() in slave mode?
    
    ============================================================================
    ADDITIONAL INFORMATION
    ============================================================================
    
    - We verified the MISO wire works using GPIO bit-bang test
    - The master (ESP32) is correctly configured and ready
    - We can see CLK toggling on oscilloscope
    - CS is asserted correctly
    - The issue is specifically with SPI_transfer() blocking
    
    We would appreciate any guidance on how to properly use SPI slave mode
    on IWR6843AOP, or confirmation if this is a known limitation.
    
    ============================================================================
    
    

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    // ============================================================================
    // TI mmWave Forum Post - SPI Slave Mode Issue on IWR6843AOP
    // ============================================================================
    // 
    // ISSUE: SPI_transfer() in slave mode BLOCKS indefinitely, causing CLI to freeze
    // after sensorStart. The master (ESP32) is ready and clocking, but SPI_transfer
    // never returns.
    //
    // DEVICE: IWR6843AOP (not standard ISK)
    // SDK: mmWave SDK 03.06.02.00-LTS
    // MODE: SPI Slave, 4-pin with CS
    // ============================================================================
    
    // ----------------------------------------------------------------------------
    // 1. PINMUX CONFIGURATION (IWR6843AOP - different from standard ISK!)
    // ----------------------------------------------------------------------------
    // Reference: pinmux_xwr68xx.h
    // AOP variant uses different pad indices than standard ISK
    
    static void SPI_DataInterface_configureSpiPinmux(void)
    {
        /* SPIA_MOSI - PIN F2 / PADAD (AOP variant) */
        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 - PIN D1 / PADAE (AOP variant) */
        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 - PIN D2 / PADAF (AOP variant) */
        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_CSN - PIN C2 / PADAG (AOP variant) */
        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);
    }
    
    // ----------------------------------------------------------------------------
    // 2. SPI INITIALIZATION (SLAVE MODE)
    // ----------------------------------------------------------------------------
    
    int32_t SPI_DataInterface_init(SOC_Handle socHandle)
    {
        SPI_Params      spiParams;
        int32_t         errCode = 0;
        
        /* Step 1: Configure pinmux */
        SPI_DataInterface_configureSpiPinmux();
        
        /* Step 2: Initialize SPI driver */
        SPI_init();
        
        /* Step 3: CRITICAL - Map DMA and interrupt requests (per TI test code) */
        if (SOC_selectDMARequestMapping(socHandle, SOC_MODULE_SPIA, &errCode) < 0)
        {
            System_printf("SPI: ERROR - SOC_selectDMARequestMapping failed\n");
            return -3;
        }
        
        if (SOC_selectInterruptRequestMapping(socHandle, SOC_MODULE_SPIA, &errCode) < 0)
        {
            System_printf("SPI: ERROR - SOC_selectInterruptRequestMapping failed\n");
            return -4;
        }
        
        /* Step 4: Enable SPI output control - 4-pin mode (per TI test code line 243) */
        if (SOC_SPIOutputCtrl(socHandle, 0U, 0U, &errCode) < 0)
        {
            System_printf("SPI: ERROR - SOC_SPIOutputCtrl failed\n");
            return -5;
        }
        
        /* Step 5: Configure SPI parameters for SLAVE mode */
        SPI_Params_init(&spiParams);
        spiParams.mode              = SPI_SLAVE;
        spiParams.dataSize          = 16U;              /* 16-bit data */
        spiParams.frameFormat       = SPI_POL0_PHA1;    /* Mode 1: CPOL=0, CPHA=1 */
        spiParams.pinMode           = SPI_PINMODE_4PIN_CS;
        spiParams.shiftFormat       = SPI_MSB_FIRST;
        spiParams.transferMode      = SPI_MODE_BLOCKING;
        spiParams.transferTimeout   = 100;              /* 100 ticks timeout */
        spiParams.eccEnable         = 0;
        spiParams.csHold            = 1;                /* Per TI test for external devices */
        
        /* Polling mode (no DMA) */
        spiParams.dmaEnable         = 0;
        spiParams.dmaHandle         = NULL;
        
        /* Slave mode chip select */
        spiParams.u.slaveParams.chipSelect = 0;
        
        /* Step 6: Open SPI */
        gSpiHandle = SPI_open(0, &spiParams);  /* SPI instance 0 = SPI-A */
        if (gSpiHandle == NULL)
        {
            System_printf("SPI: ERROR - SPI_open failed!\n");
            return -2;
        }
        
        System_printf("SPI: SPI-A opened in SLAVE mode (4-PIN, polling, 16-bit, Mode1)\n");
        return 0;
    }
    
    // ----------------------------------------------------------------------------
    // 3. SPI TRANSFER (THIS IS WHERE IT BLOCKS!)
    // ----------------------------------------------------------------------------
    
    int32_t SPI_DataInterface_sendData(uint8_t* data, uint32_t length, uint32_t frameNumber)
    {
        SPI_Transaction spiTransaction;
        SPI_DataHeader  spiHeader;
        bool            transferOk;
        
        /* Prepare SPI header with sync word */
        spiHeader.syncWord = 0xAA55AA55;
        spiHeader.dataLength = length;
        spiHeader.frameNumber = frameNumber;
        spiHeader.reserved = 0;
        
        /* Copy header to TX buffer */
        memcpy(gSpiTxBuffer, &spiHeader, sizeof(SPI_DataHeader));
        
        /* Setup SPI transaction */
        memset(&spiTransaction, 0, sizeof(SPI_Transaction));
        spiTransaction.count = sizeof(SPI_DataHeader);  /* 16 bytes */
        spiTransaction.txBuf = gSpiTxBuffer;
        spiTransaction.rxBuf = gSpiRxBuffer;
        spiTransaction.slaveIndex = 0;
        
        /* Assert GPIO HIGH to signal master that data is ready */
        GPIO_write(DATA_READY_GPIO_PIN, 1);
        
        System_printf("SPI: Starting transfer (GPIO=HIGH)...\n");
        System_flush();  /* This prints successfully */
        
        /* PROBLEM: This call BLOCKS indefinitely, even though:
         *   - Master (ESP32) is ready and clocking
         *   - CS is asserted
         *   - CLK is toggling
         *   - Timeout is set to 100 ticks
         * 
         * The CLI freezes here - no further prints, no timeout, nothing.
         */
        transferOk = SPI_transfer(gSpiHandle, &spiTransaction);
        
        /* This line is NEVER reached! */
        System_printf("SPI: Transfer completed (result=%d)\n", transferOk);
        
        GPIO_write(DATA_READY_GPIO_PIN, 0);
        
        return transferOk ? 0 : -4;
    }
    
    // ----------------------------------------------------------------------------
    // 4. WHAT WE'VE TRIED (all failed):
    // ----------------------------------------------------------------------------
    // ✓ SOC_SPIOutputCtrl() - called correctly (4-pin mode, param=0)
    // ✓ SOC_selectDMARequestMapping() - called correctly
    // ✓ SOC_selectInterruptRequestMapping() - called correctly
    // ✓ Pinmux configuration - verified for AOP variant
    // ✓ chipSelect = 0 vs 1 - tried both, same result
    // ✓ SPI_PINMODE_3PIN vs 4PIN - tried both, same result
    // ✓ csHold = 0 vs 1 - tried both, same result
    // ✓ dataSize = 8 vs 16 - tried both, same result
    // ✓ frameFormat = SPI_POL0_PHA0 vs SPI_POL0_PHA1 - tried both
    // ✓ DMA vs polling mode - tried both, same result
    //
    // WORKAROUND: Using GPIO bit-bang instead (works, but slow)
    // ----------------------------------------------------------------------------
    
    // ----------------------------------------------------------------------------
    // 5. QUESTIONS FOR TI:
    // ----------------------------------------------------------------------------
    // 1. Is there a known issue with SPI_transfer() blocking in slave mode?
    // 2. Are there any additional SOC calls required for IWR6843AOP?
    // 3. Should we use a different SPI instance or configuration?
    // 4. Is there a way to make SPI_transfer() non-blocking or check status?
    // 5. Are there any hardware requirements (pull-ups, clock speed, etc.)?
    // ----------------------------------------------------------------------------
    
    

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    你好、Eren。

    我们无法在论坛上查看自定义代码。  您是否尝试过使用 CCS debug 来识别代码中的哪个位置出现故障或代码崩溃?  这将帮助我更好地了解导致此问题的潜在原因。  您可能还必须更改为任务分配的栈大小和内存 (UART 和 SPI)、以确保那里的内存不会耗尽。

    此致、

    Santosh