5 Replies Latest reply on May 12, 2016 10:49 AM by JacobT_81

    bt_set_static_random_bd_addr not random enough

    qrthur

      Hello,

       

      The random addresses generated by bt_set_static_random_bd_addr are not random enough. When doing my production tests (7boards at a time), I always have duplicates (within just 7 boards).

       

      Any suggestion?

       

      If not, is it legit to *distribute* devices programmed with the address generated by the SDK : "20736A1****"? Or in this case do I need to register a Comapny ID to the BT council? (I want to avoid this)

       

      Kind regards,

      Arthur

        • 1. Re: bt_set_static_random_bd_addr not random enough
          JacobT_81

          In your firmware did you set the initial device address to 0xffffffffffff?

           

          Does your function call return with success?

           

          Jacob

          • 2. Re: bt_set_static_random_bd_addr not random enough
            qrthur

            Yes.

             

            The issue is, within 7 boards, I will have 6 different addresses (so 2 boards actually end up having the same "random" address)

             

            I assume there is little to no entropy on these system, so that would be why it's hard to generate many random addresses?

            • 3. Re: bt_set_static_random_bd_addr not random enough
              JacobT_81

              The function call should create pseudo-random addresses. The same address should certainly not appear within 6 iterations. 

               

              Is your NVRAM EEPROM or SFLASH?

               

              When these duplicate addresses appear, are they the same addresses each time? Or is it always different duplicate addresses each time?

               

              Are the two boards that produce duplicate addresses always the same two boards or do different boards produce duplicates each time?

               

              Jacob

              • 4. Re: bt_set_static_random_bd_addr not random enough
                qrthur

                Hey,

                 

                Using EEPROM.

                 

                I couldn't replicate the bug lately. Was I severely unlucky? Or maybe had an issue with my code. I don't really have time to try and replicate the issue. On the next batch on chips we program I will keep an eye open and report here if I see anything wrong.

                 

                Out of curiosity, how is it possible for the function to generate pseudo-random id? Each cpu we program has the exact same firmware image, where can entropy come from?

                 

                Cheers,

                • 5. Re: bt_set_static_random_bd_addr not random enough
                  JacobT_81

                  I dug into this one a little bit and I found that our random number generator is a HW block introducing actual entropy into the API. Not pseudo-random as I had said before.

                   

                  Additionally, I found that you may prevent possible duplicate numbers by postponing your call to the random generator (set random addr) to as late a time as possible in your firmware. Issues could present if the HW RNG doesn't have enough time to warm up.

                   

                  Jacob

                  2 of 2 people found this helpful