Random generator
Hi I am using STM32G030K8.
as there is no TRNG options I am doing the ADC noise values to generate a 8 bit number.The MCU is supplied with 2.2V supply .I am using both mains and battery for my operation.However if battery is removed Im not getting the ramndom number with mains supply .Can you please help this out
void ADC_seed()
{
HAL_ADC_Start(&hadc1);
HAL_ADC_PollForConversion(&hadc1, HAL_MAX_DELAY);
seed = HAL_ADC_GetValue(&hadc1);
srand(seed);
}
uint32_t generate8DigitRandomNumber(void)
{
ADC_seed();
}
serialNumber = (rand() % 90000000) + 10000000;
}