I’m trying to use RFSoC4x2 to build a RF receiver. The RFDC is driven by LMK&LMX chips, they are programmed by PS through SPI.
I have generated the register values from TICS pro, and use ‘XSpiPs_PolledTransfer’ function in Vitis to program LMK and LMX.
The two LMX are programmed with same value, but it is very strange that only PLL2(for DAC) can be programmed, PLL1(for ADC) and LMK does not repond, the LEDs on board is off, and I used ILA in vivado, PLL1 clock is not working.
I have been working on this problem for 2 weeks but no prograss, please help me!
LMK_LMX.c (12.8 KB)
LMK_LMX.h (805 Bytes)
Hi,
I haven’t check your whole library yet. May I ask is there any particular reason, you don’t want to use xrfclk library?
Best
Hello,
Thanks for your reply.
The xrfclk library is designed for Zed board series, which use I2C to program the clocks.
I’m using RFSoC4x2, and this board use SPI to program clock, they are not same thing, so I can’t use xrfclk library you mentioned to write to LMK and LMX.
Hi,
I understand the issue. The leds can be on or off based on your TICS PRO file (I had the similar issue, check RFSoC 4x2 PLL Lock Leds don’t turn on.
Can you tell me whether you changed the registers for DAC in LMK? What is your clock speed for all? Is PLL enabled in block design? Since DAC PLL is working, that might be wrong configuration in either of them.
Best
Hi,
The shortcut of my settings in TICS pro is shown in Figure 1-4 in the attachment, I think the LEDs are set to show lock state, not for read back, register values are attached in txt file.
Output clock for LMK is 250MHz and send to both LMX, Output clock for LMX is 5GHz for both ADC and DAC.
PLL is not enabled in block design in Vivado, will this have any effect?
I also tried to use other people’s register values from RFSoC-PYNQ/boards/RFSoC4x2/packages/tics/tics/register_txts/LMX2594_491.52.txt at master · Xilinx/RFSoC-PYNQ · GitHub
But none of them worked, the LEDs on board just won’t turn on.
My SPI clock is set in Vivado, which is 20MHz, shown in Figure 5.
and I use ‘XSpiPs_SetClkPrescaler(SpiInstancePtr, XSPIPS_CLK_PRESCALE_16)’ to divide the clock, so the actual SPI clock should be 1.25MHz.
I’m not sure which part went wrong.
Thanks!
figures.pdf (804.5 KB)
This is the reg values
LMK and LMX reg value.txt (3.6 KB)
Hi,
Thanks for the detailed explanation. I check your code again, I believe you need to add look up for SPI ID and I don’t see any initialization for your SPI, that might be another issue. Check out Adam Taylor SPI example, it might give you some insight about error.
I think you need to check your clocks again. I check the values on PYNQ as well, unfortunately, PLLs don’t lock.
Maybe you should start from using the BSP default values and go from there.
Best
Hello,
Thank you for your instruction, here is my feed back.
-
SPI ID
I’m using Vitis 2024.2, and DEVICE ID has been replaced with BASE ADDRESS in this version.
That is why I useSpiConfig = XSpiPs_LookupConfig(XPAR_XSPIPS_0_BASEADDR);
instead ofSpiConfig = XSpiPs_LookupConfig(SPI_DEVICE_ID);
-
Initialization
I checked Adam Taylor SPI example and I believeXSpi_Initialize( &Spi, QSPI_DEVICE_ID );
is for Spi, not SpiPs. There is a differnece, generally speaking, SpiPs is driver for things running on PS, and Spi is for PL.
I write my code follow xilinxxspips_flash_polled_example.c
andxspips_eeprom_polled_example.c
, you can find them on embeddedsw/XilinxProcessorIPLib/drivers/spips/examples/xspips_flash_polled_example.c at master · Xilinx/embeddedsw · GitHub and embeddedsw/XilinxProcessorIPLib/drivers/spips/examples/xspips_eeprom_polled_example.c at master · Xilinx/embeddedsw · GitHub .
Take SPI flash as an example, in Line 227, you can see that if SDT is defined (SDT is defined automaticlly in the latest version), there will be no need to use SPI ID, just BASE ADDRESS will do.
And in both examples, I don’t find anything related to SPI initialization, noXSpi_Initialize( &Spi, QSPI_DEVICE_ID );
exist. -
LMK&LMX values
I have tried defult values used by PYNQ downloaded from here, it didn’t work, but I will try again later. -
SPI clock
20 MHz for SPI clock is same with the PYNQ base layer. In LMK and LMX user manual, it said that SPI clock should not above 5MHz, that is why I useXSpiPs_SetClkPrescaler(SpiInstancePtr, XSPIPS_CLK_PRESCALE_16)
to divied SPI clock to 1.25MHz, but I’m not sure is it working because there is no way put a scope on SPI bus.
If you also have a RFSoC4x2 at hand, have you tried to use Vitis to program a bare-metal code to configure the LMK and LMX? If so, please share your finds with me, I’ll be much appreciated.
Thank you for spending time reading my code!
Best regards.
Hi,
I haven’t used the newer versions yet. Thanks for explaining, it was educational for me.
If the original file also didn’t work, your SPI is the problem. I check PYNQ repo again. Like you said, your clocks match there. However, I downloaded the board BSP from RealDigital website, that one uses 200 MHz clocks for SPI. So, I am not sure which one you should follow.
Unfortunately, I haven’t used baremetal on RFSoC4x2.
Let me know if anything changes.
Best
I just tried default reg values, LMK 245.76MHz, LMX 491.52MHz, still not working. I believe somewhere of SPI settings went wrong, but after all the things I have tried, I can’t figure out the reason.
I decided to use PYNQ, baremetal programming seems less populer, there is not much to reference.
New Progress!
I mananged to write to LMK&LMX!
It turns out that problem is not SPI, it is the programming requirement of the clock chips. LMK needs to set sel0, sel1 and rst signal, LMX needs to write register to rest first. After apply these code, 3 out of 4 LED turned on, they are ADC, DAC, PLL2.
Now there is another strange problem, LMK04828B has two PLL, PLL1 use external clock as reference, and PLL2 use PLL1 as reference, but from the LED status, PLL2 was locked without the lock of PLL1.
In this case, SPI writing is valid, both LMK and LMX was written, but PLL1 is not lock, why would this happen?
I use ILA in Vivado to check the clk_adc, which is set to 38.4MHz, and ILA clock is 749.999878MHz, here is the waveform.
Latest code is attached, in case someone wants to try baremetal on RFSoC4x2, just one last step missing!
LMK_LMX.c (9.2 KB)
LMK_LMX.h (847 Bytes)
TICS pro files is also attached, is there anything wrong with it?
LMX2594_491.52.txt (1.5 KB)
LMK04828_245.76.txt (2.0 KB)
Hi,
This is great news indeed! It seems you individually program LMX and LMK and used GPIOs for the signals you mentioned. I want to ask did you program FPGA to have those MIOs to be GPIO or not?
Can you readback MUXout from SPI to confirm the lock? Like I mentioned before, I had a similar issue. The PLLs are locked, but not showing on LEDs.
I never checked the output clocks from the RFDC. Is the clock period OK? For some regions, you have longer period.
Is this your configuration or the original one?
Best