Post Go back to editing

tddn off_raw parameter

Category: Software
Product Number: Pluto
Software Version: v0.39

Hello. In the pluto_tddn.py example in the pyadi-iio examples, the TDD engine is setup as following.

tddn.channel[0].on_raw = 0
tddn.channel[0].off_raw = 0
tddn.channel[0].polarity = 0
tddn.channel[0].enable = 1

# RX DMA SYNC
tddn.channel[1].on_raw = 0
tddn.channel[1].off_raw = 10
tddn.channel[1].polarity = 0
tddn.channel[1].enable = 1

# TX DMA SYNC
tddn.channel[2].on_raw = 0
tddn.channel[2].off_raw = 10
tddn.channel[2].polarity = 0
tddn.channel[2].enable = 1

The tddn's class documentation is unfortunately very minimal and barely explains how it works and how to modify this for different use cases. One has to look at the HDL documentation and diagram in Vivado to begin to have an idea of how to understand it and I don't have much experience with it. So some more in-depth explanation directly in the pyadi-iio would be appreciated.

From what I understand looking at the Vivado project, the uncommented 1st channel is connected to the GPIO 0 pin. So is it just for external sync or do the channel[0] properties matter if we are doing software sync?

Why the magic number 10 in the off_raw property of channel[1] and channel[2]? From what I understand this property "turns off" the DMA SYNC channels 10 clock cycles before the frame is finished. If I try to set off_raw to 0 in the RX DMA SYNC channel I get the following error

x = self._rx_buffered_data()
        ^^^^^^^^^^^^^^^^^^^^^^^^
  File "[...]/adi/compat.py", line 149, in _rx_buffered_data
    self._rxbuf.refill()
  File "[...]/iio.py", line 1003, in refill
    _buffer_refill(self._buffer)
  File "[...]/iio.py", line 62, in _check_negative
    raise OSError(-result, _strerror(-result))
TimeoutError: [Errno 110] Connection timed out

Which I can't recover from even after setting the value back to 10 unless I turn the Pluto off and on again.

If I set tddn.channel[2].off_raw = 0, then basically only 0's are sent to the transceiver for transmission.

Using off_raw = 2 seems to work. I would be grateful if someone could provide an explanation on how to pick this value and if it is possible to use off_raw = 0 so that samples aren't lost between frames.

Finally, what does polarity do?

Parents
  • Hello,

    The on_raw and off_raw attributes control the time from the beggining of the initial pulse trigger until the start and end respectively of the first pulse on the channel. This way, based on the configuration of frame lentgh on_raw and off_raw, one can control the duty_cycle of the pulse on the tdd channel. The attributes on_raw and off_raw specify raw values, the conversion in ms is available via the off_ms and on_ms attributes, available in the tddn class: https://github.com/analogdevicesinc/pyadi-iio/blob/main/adi/tddn.py#L171. Therefore, off_raw = 10 would translate to about 0.000040 from the initial trigger to the end of your channel's pulse, and then it stays low until the end of the frame length. If for a specific use case you need your pulse to stay in the reerse state for a certain period of time, you would need to set off_raw accordingly or simply set "off_ms" for that period.

    Channel 0 is most likely the enable channel, that channel is probably not tied to anything else but it is necessary to be enabled in order to enable the rest of the tdd channels, that's why no particular configuration is necessary for it.

    Finally, polarity refers to the polarity of the tdd channel, if it's regular polarity (from 0 to 1)  or inverse polarity (from 1 to 0).

    I hope this clarifies the attributes and their purpose a bit. Please let me know if you have any additional questions. I attach below a diagram that shows the timing.

  • Yes, the documentation on Pluto TDD is pretty thin right now.  But we'll be adding a page to this soon.  In the meantime, you can check out this presentation for a little bit more explanation:  https://youtu.be/ZnCi-LHJ0GQ?si=pNMoINfIuOYfcGl0&t=991

Reply Children
No Data