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.

Starterware/CC3220SF-LAUNCHXL: CC32220 Random Number Generator?

Part Number: CC3220SF-LAUNCHXL

Tool/software: Starterware

Dear Support:

Is there any API support for generating a random number with the CC3220?  Please advise.

Thanks,
Tim

  • Hi Tim,

    Please look on sl_NetUtilGet() and SL_NETUTIL_TRUE_RANDOM.

    From swru455b:
    16.1.1.6 True Random Number
    Retrieve a buffer of true random numbers from the networking subsystem. Maximum buffer length is 172 bytes for each retrieval. if the requested length exceeds 172 bytes, it is trimmed to 172 bytes.

    Status = sl_NetUtilGet(SL_NETUTIL_TRUE_RANDOM,0,buffer,&len);

    Jan
  • Hey Jan:

    Thanks for the reference. However I tried this per the example in the doc and it never returned from the call. I did the following:

    uint32_t Address;
    int32_t RandomLength;

    RandomLength = sizeof( uint32_t );
    Return = sl_NetUtilGet( SL_NETUTIL_TRUE_RANDOM, 0, ( uint8_t * )&Address, ( uint16_t * )&RandomLength );

    and it never returns from the sl_NetUtilGet call. Do you see anything that I did wrong and why this call never returns? Please advise.

    Thanks,
    Tim
  • Hi Tim,

    Do you have enabled SimpleLink before you use this API?

    Jan
  • Hey Jan:

    Whoops, it was getting late and I obviously wasn't thinking - thanks for stating the obvious.  I put this in a place in the code where I thought Simplelink was enabled, but I was testing in the wrong place.  Yes, it works when Simplelink is enabled - thanks for helping me find this routine - I had spent some time trying to find this functionality in the API docs and couldn't find it - from the name of this routine, that was not intuitively obvious!  Would help if we had the Simplelink API document in a form that I could do a search on vs trying to search through the document via Doxygen by clicking on links.

    Thanks,
    Tim