Why not using the rand() library function? You can initialize it via srand(), using the current value of the SysTick timer (see http://www.cypress.com/knowledge-base-article/using-systick-timer-psoc-4-kba91374 ). Call srand when your BLE pairing happens since this is a random point in time.
I cannot wait until BLE pairing because I need the random value immediately on first boot which happens at our manufacturing facility on a test stand. In this environment, I am not sure how good the SysTick method would work since the timing would be very much the same from unit to unit. I have also investigated using die temperature, ADC counts of battery, etc. but again during test all of these are likely to be the same. Essentially on boot I will check a SFLASH location for this ID value and if it has not been set then I will generate the random number and write it to SFLASH. I was hoping someone from Cypress would chime in with some information about how that function works.
1 of 1 people found this helpful
I was hoping someone from Cypress would chime in
At top of this page select "Design Support -> Create a Support Case" and describe your problem.
Alternate solution: There is an API to get the unique chip ID. Use that directly or use it to seed the randomizer.
See "System Reference Guide" (from Creator Help)
void CyGetUniqueID(uint32* uniqueId)
Returns the 64-bit unique id of the device
uniqueId: Pointer to a two element 32-bit unsigned integer array.
Returns the 64-bit unique id of the device by loading them into the integer array pointed to by uniqueId