NANO_SLEEP
The NANO_SLEEP function is used to insert delays between JTAG accesses.
NANO_SLEEP was added in XJTAG v3.1 and is not recognised in versions prior to that.
The time specified is in nanoseconds, but is treated as a minimum. The actual delay may be longer depending on overheads in the PC and in the USB stack. Also, the resolution of the delay is dependent on the current TCK frequency of the chain - for example if your TCK frequency is 10 MHz, the minimum delay is 100 ns.
The standard SLEEP function is processed on the PC, so it cannot be used to insert precise short delays between JTAG accesses. The NANO_SLEEP function is processed by the XJLink, which means the pauses are accurate and are synchronised with the JTAG accesses. However, its effect cannot be observed from XJEase until any subsequent write has actually completed, since the pause may not have been processed by the XJLink until either a read is done using SET or FLUSH is called. Generally, use NANO_SLEEP when short delays are needed between hardware accesses and use SLEEP when longer pauses, e.g. greater than 100 ms, are needed for other purposes.
NANO_SLEEP may be used within a HOLDOFF block; the delay is performed by the XJLink as part of the stream of hardware accesses and so allows precise control of the delay between those accesses.
Syntax
NANO_SLEEP( INT nanoseconds )
Parameters
- nanoseconds
- The minimum number of nanoseconds to pause for between JTAG accesses.
Example
// Toggle pin X 10 times with a 10 us delay between each transition LOCAL TogglePin()() INT i; FOR i := 1 TO 10 SET X := 0; NANO_SLEEP(10 * 1000); SET X := 1; NANO_SLEEP(10 * 1000); END; END;
XJTAG v4.1.100