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.

[参考译文] CC1311R3:低于1GHz 论坛

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

https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/1517473/cc1311r3-sub-1-ghz-forum

部件号:CC1311R3

工具/软件:

您好、

我们在使用 AEScmac_oneStepSign 函数时看到了一些奇怪的行为。

每当   调用 AESCMACCC26XX.h 中的 AEScmac_oneStepSign 或 AEScmac_oneStepVerify 函数时、 UART2.h 的 UART2_readTimeout  就会始终返回 UART2_STATUS_ETIMEOUT (-13)、即使数据通过 UART 接口不间断传输也是如此、这意味着 UART 外设基本上已"耳聋"、我们无法处理它、因为它不会返回描述性错误。

这仅在调用 AESCMAC 签名和/或验证函数后发生、无论何时进行测试、它都是完全确定性的。 AESCMAC 函数按预期工作、我们仍然能够使用 UART2_WRITE 函数写入数据。 此外、我们一直在使用 AESCBC 和 AESCCM、而没有出现任何类似的问题。

仅 在调用 AESCMAC 的"OneStep"签名/验证函数后、该问题才会影响 UART2_readTimeout 功能。

设置

 AEScmac_Params 使用 AEScmac_Params_init 中的所有默认值进行初始化。

 UART2_Params 使用从 UART2_Params_init 的默认值进行初始化、唯一的区别是 writeMode 设置为 UART2_Mode_callback。

Simplelink 版本 :8.30.01.01.

驱动程序 : tirtos7.


这可能是 simplelink 中的问题、还是我们做错了?

此致
无需更多线路

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

    Hei nomorewire、

    我可以在以下代码中看到类似的问题:

    /*
     * Copyright (c) 2020, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    /*
     *  ======== uart2callback.c ========
     */
    #include <stdint.h>
    #include <stddef.h>
    
    /* Driver Header files */
    #include <ti/drivers/GPIO.h>
    #include <ti/drivers/UART2.h>
    #include <ti/drivers/dpl/ClockP.h>
    #include <ti/drivers/dpl/SemaphoreP.h>
    #include <ti/drivers/AESCMAC.h>
    #include <ti/drivers/cryptoutils/cryptokey/CryptoKeyPlaintext.h>
    
    /* Driver configuration */
    #include "ti_drivers_config.h"
    
    static SemaphoreP_Handle sem;
    static AESCMAC_Handle aesHandle;
    size_t numBytesRead;
    size_t numBytesWritten;
    
    uint8_t message[16]         = {0x6B, 0xC1, 0xBE, 0xE2, 0x2E, 0x40, 0x9F, 0x96,
                                   0xE9, 0x3D, 0x7E, 0x11, 0x73, 0x93, 0x17, 0x2A};
    uint8_t keyingMaterial[16]  = {0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6,
                                   0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C};
    uint8_t mac[16];
    
    /*
     *  ======== callbackFxn ========
     */
    void callbackFxn(UART2_Handle handle, void *buffer, size_t count, void *userArg, int_fast16_t status)
    {
        if (status != UART2_STATUS_SUCCESS)
        {
            /* TX error occured in UART2_read() */
            while (1) {};
        }
    
        SemaphoreP_post(sem);
    }
    
    /*
     *  ======== mainThread ========
     */
    void *mainThread(void *arg0)
    {
        uint8_t input[16];
        const char echoPrompt[] = "UART and CRYPTO test:\r\n";
        const char successPrompt[] = "Received successfully\r\n";
        const char timeoutPrompt[] = "Timeout\r\n";
    
        AESCMAC_Params aesParams;
        AESCMAC_Operation operation;
        CryptoKey cryptoKey;
    
        UART2_Handle uart;
        UART2_Params uartParams;
        int32_t semStatus;
        uint32_t status = UART2_STATUS_SUCCESS;
    
        /* Call driver init functions */
        GPIO_init();
    
        /* Configure the LED pin */
        GPIO_setConfig(CONFIG_GPIO_LED_0, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
    
        AESCMAC_init();
        AESCMAC_Params_init(&aesParams);
        aesHandle = AESCMAC_open(CONFIG_AESCMAC_0, &aesParams);
    
        if (aesHandle == NULL)
        {
            while (1);
        }
    
        CryptoKeyPlaintext_initKey(&cryptoKey, keyingMaterial, sizeof(keyingMaterial));
        AESCMAC_Operation_init(&operation);
        operation.input        = input;
        operation.inputLength  = sizeof(input);
        operation.mac          = mac;
        operation.macLength    = sizeof(mac);
    
        /* Create semaphore */
        sem = SemaphoreP_createBinary(0);
    
        /* Create a UART in CALLBACK read mode */
        UART2_Params_init(&uartParams);
        uartParams.readMode     = UART2_Mode_BLOCKING;
        uartParams.writeMode = UART2_Mode_CALLBACK;
        uartParams.writeCallback = callbackFxn;
        uartParams.baudRate     = 115200; 
    
        uart = UART2_open(CONFIG_UART2_0, &uartParams);
    
        if (uart == NULL)
        {
            /* UART2_open() failed */
            while (1) {}
        }
    
        /* Turn on user LED to indicate successful initialization */
        GPIO_write(CONFIG_GPIO_LED_0, CONFIG_GPIO_LED_ON);
    
        /* Pass NULL for bytesWritten since it's not used in this example */
        UART2_write(uart, echoPrompt, sizeof(echoPrompt), NULL);
    
        /* Loop forever echoing */
        while (1)
        {
            numBytesRead = 0;
    
            /* Pass NULL for bytesRead since it's not used in this example */
            status = UART2_readTimeout(uart, &input, 16, &numBytesRead, 10000 * ClockP_getSystemTickPeriod());
    
            switch (status)
            {
                case UART2_STATUS_SUCCESS:
                    UART2_write(uart, &successPrompt, sizeof(successPrompt), &numBytesWritten);
                    break;
                case UART2_STATUS_ETIMEOUT:
                    UART2_write(uart, &timeoutPrompt, sizeof(timeoutPrompt), &numBytesWritten);
                    break;
            }
    
            int_fast16_t result = AESCMAC_oneStepSign(aesHandle, &operation, &cryptoKey);
            if (result != AESCMAC_STATUS_SUCCESS) {
                // handle error
            }
    
            SemaphoreP_pend(sem, SemaphoreP_WAIT_FOREVER);
        }
    }
    

    我将进行调查、但我认为 DMA 通道存在问题。  

    此致、

    Arthur

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

    Arthur、

    是否有任何更新?

    无需更多导线

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

    高线缆、

    我提请 R&DS 注意该案。 我将在今天晚上或明天获得更新。 在这段时间里,我还在寻找。

    此致、

    Arthur

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

    高线缆、

    我发现、一旦 运行 AEScmac_oneStepSign、UART 驱动程序中寄存的 RX 状态与实际 UART 外设之间存在差异。 我还没有发现为什么会发生...

    此致、

    Arthur

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

    您可以通过附加以下命令来恢复 RX:

    UART2_rxDisable(uart);
    UART2_rxEnable(uart);

    在 UART2_readTimeout 之前、我不认为这是一个解决方案。

    此致、

    Arthur

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

    感谢您的努力。 我希望您或研发团队能够做到这一点。

    -无需更多线缆

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

    您好、  

    我相信我即将结束本次会议。 将电源驱动程序策略切换到 doWFI:

    使测试程序按预期运行。 然而,还没有对行为的解释。

    此致、

    Arthur

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

    ...实际上、这是 AESCMAC 驱动程序的电源驱动程序问题、导致 UART 电源域关闭。

    此问题将在下一个 SDK 版本中得到修复、但与此同时、您可以执行以下操作:

    • 在轮询模式下使用 AESCMAC 驱动程序(此处无需修改):
      AESCMAC_Params_init(&aesParams);
      aesParams.returnBehavior = AESCMAC_RETURN_BEHAVIOR_POLLING;


    • 将以下检查添加到 AESCMACCC26XX.c:557 (正确设置电源约束):
      if (transactionLength == 0U)
      {
          /* If transaction length is zero, only the last locally buffered block
           * of data remains to be processed for CMAC. Call AESCMAC_getResult()
           * to process the last block, obtain the result, and store status of
           * the operation in object->returnStatus.
           */
      
          if (object->returnBehavior != AESCMAC_RETURN_BEHAVIOR_POLLING)
          {
              Power_setConstraint(PowerCC26XX_DISALLOW_STANDBY);
          }
          
          AESCMAC_getResult(object, false);
      } 


    两种修复方法之间的功耗都没有差异。

    此致、

    Arthur