How to generate nanosecond delay in TM4C1294ncpdt controller


Joined Sep 14, 2020
Hmmm. Your clock is about 8ns assuming the MCU runs at 120MHz. Any code where you can waste 6 clock cycles will give you a 48ns delay. Just make sure youre compiler doesn't optimize away the code you write. One idea is to write NOPs in assembly, check the timing, and string along more if you need more delay. If the code has been pre-fetched this kind of thing may work. If there is no prefetching (not familiar with the TM4C beastie) then the instruction fetch itself could consume cycles that you need to count. Some trial and error is sure to be involved.