3 ms·
But the example here is to simply delay, not to sleep for power consumption.
by kbumsik 6y ago
But the example here is to simply delay, not to sleep for power consumption.
- Someone 6y agoBut a delay that uses less power still is preferred. Busy-looping should be avoided whenever possible (I wouldn’t know whether that’s the case here)
- kbumsik 6y agoThe delay is just 10ms and this is a bootloader code that runs only once at bootup. As a bootloader for an MCU, a less error-prone way with less code size is more preferrable.
- friendzis 6y agoI can agree that justification to use nop loops somewhere along the lines of "core starts executing code when, judging by real-world testing, hardware peripherals do not guarantee stable state. Thorough testing suggests that 8ms+safety margin delay mitigates issues related to hardware readiness. 2500 cycle nop-loop guarantees required 10ms delay on fastest clock speeds and 50ms delay on slowest core speeds without causing observable issues. 50ms is hereby deemed acceptable." would acceptable in most commercial design documents.
- yitchelle 6y agoIt might be fine if it is just for delay, then you run into problem of portability to the system with different instruction cycle times. Not saying it is bad, but technical debt is high from several angles.