Assembly instructions for delay (In terms of Clock pulses)


I am implementing one wire protocol for controller. The controller has Single wire (BKGD pin) and is connected to the Tx1 processor.

To send bit 0 to the controller, need to follow the scheme below.
BDM = 0;
asm LDD #TC13; asm DBNE D,*+0; // 3.25us @ 50 MHz (13 TC @ 4MHz BDM clk)

BDM = 1;
asm LDD #TC4; asm DBNE D,*+0;// 1.00us @ 50 MHz ( 4 TC @ 4MHz BDM clk)

BDM is nothing but the Single wire connected to the processor Tx1. And TC13 represents 13 Target clocks. The controller has their own proprietary instruction set and core. While porting code to Tx1 processor unable to identify the asm statements (compilation errors).

The asm statement in the above snippet shows, it is loading TC13(macro value 36) into the accumulator and waiting for accumulator to become 0 by decrementing it. So that it can execution of that statement takes 13 Clock pulses.

I want to generate some delay in terms of target clocks. Could you please share assembly instruction which can be used to generate delay. Here target clock is 6.25 MHz.

Thanks in advance, please correct me if i am wrong.

Hello, Sherin:
Sorry I’m not very familiar with your use case.
Generally, you can control GPIO through sysfs node in user space (just for function verification, slow, long-delay), or make a private driver in kernel. A similar sample is to use GPIO for I2C simulation.

You can refer to kernel driver sample for GPIO control.


Hi Chenjian,

Thanks for the quick reply, I am not looking for any customization on gpio driver. Let me explain the scenario in brief.

  1. Need to toggle gpio either high, low or high impedence.
  2. need to hold the gpio state with reference to the target clock cycles.

Now i would like to know the instructions through which i need to generate n-cycles of delay.

Is it possible to set gpio state to high-impedence?

what is the gpio operating frequency?

Hello, Sherin:
GPIO states (high/low/high-impedence) are controlled by register. So software can write register to toggle GPIO state.