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
  • I was confused and thought that off_raw was counting from the end of the frame. Of course setting it to 0 causes problems reading from the buffer since there's nothing to read. So if I want the channel to stay on for the whole frame I need to set off_raw to be equal to the frame length.

    I am still confused as to why the pluto_tddn.py example uses off_raw = 10 when the frame_length is 4 ms, and the DMA channels are being turned off after 0.25 microseconds (40 Mhz is the clock rate, correct)?

Reply
  • I was confused and thought that off_raw was counting from the end of the frame. Of course setting it to 0 causes problems reading from the buffer since there's nothing to read. So if I want the channel to stay on for the whole frame I need to set off_raw to be equal to the frame length.

    I am still confused as to why the pluto_tddn.py example uses off_raw = 10 when the frame_length is 4 ms, and the DMA channels are being turned off after 0.25 microseconds (40 Mhz is the clock rate, correct)?

Children
No Data