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.

F280025 CAN DMA 存取問題

我是用範例程式,CAN_EX3_loopback_DMA。

我發現為什麼RAM存取位址會有重複兩次的data??

沒辦法設定成如果傳 4個byte就只存 4個byte嗎?

  • 请您看一下例程中下面的代码

        //
        // Check for data integrity
        //
        for(i = 0; i < 2; i++)
        {
            //
            // Combine two bytes of CAN TX data into a single word for error
            // checking since the DMA transfers data as words into the RX buffer.
            //
            txWordData = txMsgData[txIndex] + (txMsgData[txIndex + 1] << 8U);
            
            if(rxMsgData[i] != txWordData)
            {
                // Something went wrong. rxMsgData doesn't contain expected data.
                ESTOP0;
            }
    
            txIndex+=2;
        }

    而 

    // Place buffers in GSRAM
    #pragma DATA_SECTION(txMsgData, "ramgs0");
    #pragma DATA_SECTION(rxMsgData, "ramgs0");