XJTAG

Apply for your FREE Trial of JTAG Boundary 
		Scan Development and Test Tools
Search

What is the FLUSH command used for?

The XJTAG system optimises writes to the hardware by queuing a series of writes. These will only be transmitted when a read from the hardware is requested. If you need to write to a device and then wait for a specific period before reading back a value (e.g. writing to Flash then waiting for a period before reading back the status), the FLUSH command is used to force the write to be performed before the delay.

For example, the following code fragment will not produce the expected result, because the SET WR := 1 write operation will not be performed until the SET status := DATA[6] read statement is encountered after the delay.

// Write the data.
SET DATA := write_data, WR := 1;
// Wait 100 ms.
timeout := NOW + 100;
DO WHILE NOW < timeout END;
// Get the status.
SET status := DATA[6];

A FLUSH command should be inserted before the delay to ensure that the sequence is performed as expected:

// Write the data.
SET DATA := write_data, WR := 1;
// Ensure data is written.
FLUSH;
// Wait 100 ms.
timeout := NOW + 100;
DO WHILE NOW < timeout END;
// Get the status.
SET status := DATA[6];

Similarly, a FLUSH should be inserted if user input is required after a write (e.g. before using the GETKEY statement), as shown in the following fragment:

// Turn on LED.
SET LED := 1;
// Ensure data is written.
FLUSH;
// Wait for user input.
DO UNTIL GETKEY() END;
// Turn off LED.
SET LED := 0;

Knowledge Base Index |