Closed maleadt closed 2 years ago
A better solution would be to disable the DMA loop from the interrupt handler when an underflow occurs, and re-enable it in liblitepcie from dma_process or when fetching a new write buffer. But that's more finicky, and I just wanted something that would work for now.
Turns out that doesn't work, the DMA engine expects to be run contiguously and stopping/re-starting it will introduce unwanted behavior/synchronization issues. A better solution would be to introduce a register to disable the RF output when set, which could be toggled by the driver when detecting an underflow.
The alternative: a CSR that temporarily disables transmission, https://github.com/enjoy-digital/xtrx_julia/commit/9737744842416868bf8c1c9541c30459efa3c4f3. I'll look into integrating this.
As per @staticfloat's request, this avoids retransmitting previous buffers by wiping them in the interrupt handler. This is a hacky solution because it's expensive to wipe these buffers, esp. when we'll start using GPUs again (because this would result in writes to GPU memory over the PCIe bus, which I'm not even sure is OK to do in an interrupt handler). But for now, it might help debugging the other issues we're dealing with.
A better solution would be to disable the DMA loop from the interrupt handler when an underflow occurs, and re-enable it in liblitepcie from dma_process or when fetching a new write buffer. But that's more finicky, and I just wanted something that would work for now.
Test script:
Before this change:
After: