2016-09-22 07:02 AM
This HAL code seems to run 12x slower then expected.
/** * @brief Delay micro seconds * @param microSecond : delay * @retval None */static void ADC_DelayMicroSecond(uint32_t microSecond){ /* Compute number of CPU cycles to wait for */ __IO uint32_t waitLoopIndex = (microSecond * (SystemCoreClock / 1000000U)); while(waitLoopIndex != 0U) { waitLoopIndex--; } }Peter2016-09-22 07:28 AM
You mean its not a unit cycle machine?? Someone tell the Java coders...
There are better ways to do this, but how is it being used? If it is just being used to sequence the initialization of the ADC, and to insert at least enough dwell time to meet it's goals anything >=1X should suffice. One could use DWT_CYCCNT to get to sub-microsecond granularity.2016-09-22 09:32 AM