TI中文支持网
TI专业的中文技术问题搜集分享网站

CC1310的硬件随机数的callback模式怎么用

源码如下,初始化后,callback没有响应,是不是我的用法不对
void trng_callback( TRNG_Handle handle,
                    int_fast16_t returnValue,
                    CryptoKey *entropy)
{
    keyLocationBuffer[0] = returnValue>>8;
    keyLocationBuffer[1] = returnValue;
}
void init_generateRandom(uint8_t size)
{
    TRNG_Params paramTrng;
    TRNG_init();
    // CryptoKeyPlaintext_initBlankKey(&entropyKey, keyLocationBuffer, size);

    TRNG_Params_init(&paramTrng);
    paramTrng.returnBehavior = TRNG_RETURN_BEHAVIOR_CALLBACK;
    paramTrng.callbackFxn = trng_callback;
    paramTrng.timeout = 1*1;
    /* Open a TRNG_Handle with default parameters */
    handleTrng = TRNG_open(Board_TRNG0, &paramTrng);
    if (!handleTrng) {
        while (1)
            ;
    }
    // COM_generateRandomBytes();
}
Susan Yang:

请您参考一下

contiki-ng.readthedocs.io/…/group__cc26xx-trng.html

This function is asynchronous, it will start generation of a random number and will return. The caller must provide a callback that will be called when the generation is complete. This callback must either use the random number immediately or store it, since it will not be possible to retrieve it again later form the soc-trng module.

Viki Shi:

请参考一下这边的类似问题,里面有提供例程:e2e.ti.com/…/1808675

FreePom:

回复 Viki Shi:

参考的这种方式耗时太长了,我的应用需要低功耗,这个耗不起。现在callback模式下,还会死机

FreePom:

回复 Susan Yang:

参考的这种方式耗时太长了,我的应用需要低功耗,这个耗不起。现在callback模式下,还会死机

赞(0)
未经允许不得转载:TI中文支持网 » CC1310的硬件随机数的callback模式怎么用
分享到: 更多 (0)