Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Init scripts: SPI readback errors and no edge detected #1

Open
fsagbuya opened this issue Mar 15, 2024 · 3 comments
Open

Init scripts: SPI readback errors and no edge detected #1

fsagbuya opened this issue Mar 15, 2024 · 3 comments

Comments

@fsagbuya
Copy link

fsagbuya commented Mar 15, 2024

Issue Details

Hi. We are trying to setup fast-servo with linien in our lab and have encountered an issue while running the initialize.py script. It seems to fail to properly initialize the device, resulting in multiple SPI readback errors and inability to detect edges for tap delay configuration.

Here's the log for our test:

$ python3 initialize.py 
DEV ID: 0x5340
Si5340 OUTx_PDN CLK3: 0x1
Si5340 OUTx_FORMAT CLK3: 0x204
Si5340 OUTx_AMPL CLK3: 0x59
Si5340 OUTx_CM CLK3: 0x1
Numerator buffer: 0x00
Numerator buffer: 0x00
Numerator buffer: 0x00
Numerator buffer: 0x60
Numerator buffer: 0x22
Numerator buffer: 0x00
Denominator buffer: 0x00
Denominator buffer: 0x00
Denominator buffer: 0x00
Denominator buffer: 0x00
Spi readback register 0x01: 0xff
Different value read than sent in reg 0x02
Spi readback register 0x02: 0xff
Different value read than sent in reg 0x02
Spi readback register 0x03: 0xff
Different value read than sent in reg 0x03
Spi readback register 0x04: 0xff
Different value read than sent in reg 0x04
Performing bitslip (bitslip iteration: 0). Reason: current_frame is 0x00 instead of 0x0C
Performing bitslip (bitslip iteration: 1). Reason: current_frame is 0x00 instead of 0x0C
Performing bitslip (bitslip iteration: 2). Reason: current_frame is 0x00 instead of 0x0C
Performing bitslip (bitslip iteration: 3). Reason: current_frame is 0x00 instead of 0x0C
Tap delay: 0
Current frame: 0x00
Tap delay: 1
Current frame: 0x00
Tap delay: 2
Current frame: 0x00
Tap delay: 3
Current frame: 0x00
Tap delay: 4
Current frame: 0x00
Tap delay: 5
Current frame: 0x00
Tap delay: 6
Current frame: 0x00
Tap delay: 7
Current frame: 0x00
Tap delay: 8
Current frame: 0x00
Tap delay: 9
Current frame: 0x00
Tap delay: 10
Current frame: 0x00
Tap delay: 11
Current frame: 0x00
Tap delay: 12
Current frame: 0x00
Tap delay: 13
Current frame: 0x00
Tap delay: 14
Current frame: 0x00
Tap delay: 15
Current frame: 0x00
Tap delay: 16
Current frame: 0x00
Tap delay: 17
Current frame: 0x00
Tap delay: 18
Current frame: 0x00
Tap delay: 19
Current frame: 0x00
Tap delay: 20
Current frame: 0x00
Tap delay: 21
Current frame: 0x00
Tap delay: 22
Current frame: 0x00
Tap delay: 23
Current frame: 0x00
Tap delay: 24
Current frame: 0x00
Tap delay: 25
Current frame: 0x00
Tap delay: 26
Current frame: 0x00
Tap delay: 27
Current frame: 0x00
Tap delay: 28
Current frame: 0x00
Tap delay: 29
Current frame: 0x00
Tap delay: 30
Current frame: 0x00
Tap delay: 31
Current frame: 0x00
No edge detected; setting iDelay to: 11
ADC_CH0: 0x[0, 0, 0, 0]
Final ADC_CH0: 0x0000
Final ADC_CH1: 0x0000
Spi readback register 0x02: 0xff
Different value read than sent in reg 0x02
0
Unrecognized device: 0x00
=== Contents of spi buffer after DAC VERSION read back: ===
0x9F00
0x8200
0x8200
0x9400
0x9400
0x9400
0x9400
0x9400
0x9400
0x9400
0x9400
0x9400
0x9400
REG contents: 0b000
REG contents: 0b000

Any assistance in troubleshooting these issues would be greatly appreciated. We are looking for guidance on possible causes and solutions to resolve the SPI communication and initialization failures.

Thank you for your help.

@jmatyas
Copy link
Collaborator

jmatyas commented Mar 15, 2024

Hi!

I'm currently unable to test my hypothesis on hardware but I've got an initial guess on what might be going on there. Since you were able to load gateware on FPGA and communicate with Si5340 over I2C I would assume that there was a memory addresses mismatch and that's why you were unable to initialise ADC and DAC.

Are you able to blink front panel LEDs (pythonscripts/fp_leds.py)? If not, try swapping Linien offset lines:


# LINIEN_OFFSET = 0x300000

If that helped you probably fell victim of imprecise docs. Why that helped - answer below.

Hi. We are trying to setup fast-servo with linien in our lab and have encountered an issue while running the initialize.py script. It seems to fail to properly initialize the device, resulting in multiple SPI readback errors and inability to detect edges for tap delay configuration.

First thing I would check is how did you build the gateware? This might have been omitted in the README, but using only this repository you won't be able to build gateware for Fast Servo WITH Linien. This is only what it's name suggests - firmware layer or board support package. This repo (branch fast_servo_merging), however, contains code and instructions to build Linien on Fast Servo (be sure to read DEVNOTES.

So if you want to use Fast Servo Firmware without Linien (that is built only from this repository), linien_offset should be set to 0x00 and if you built Linien on Fast Servo you MUST set linien_offset to 0x300000. It was developed this way as a compatibility "feature" with the way Linien populates address space.

Let me know if that was it!

@fsagbuya
Copy link
Author

fsagbuya commented Mar 18, 2024

Thanks for your response.

Are you able to blink front panel LEDs (pythonscripts/fp_leds.py)?

Yes we have test that it is blinking.

$ python3 fp_leds.py 
addr: 0x40305000	start_addr: 0x0	stop_addr: 0x4
addr: 0x40305000	start_addr: 0x0	stop_addr: 0x4
addr: 0x40305000	start_addr: 0x0	stop_addr: 0x4
addr: 0x40305000	start_addr: 0x0	stop_addr: 0x4
addr: 0x40305000	start_addr: 0x0	stop_addr: 0x4
addr: 0x40305000	start_addr: 0x0	stop_addr: 0x4
addr: 0x40305800	start_addr: 0x2048	stop_addr: 0x2052
addr: 0x40305800	start_addr: 0x2048	stop_addr: 0x2052
addr: 0x40305800	start_addr: 0x2048	stop_addr: 0x2052
addr: 0x40305800	start_addr: 0x2048	stop_addr: 0x2052
addr: 0x40305800	start_addr: 0x2048	stop_addr: 0x2052
addr: 0x40305800	start_addr: 0x2048	stop_addr: 0x2052

First thing I would check is how did you build the gateware? This might have been omitted in the README, but using only this repository you won't be able to build gateware for Fast Servo WITH Linien. This is only what it's name suggests - firmware layer or board support package. This repo (branch fast_servo_merging), however, contains code and instructions to build Linien on Fast Servo (be sure to read DEVNOTES.

Yes we have build this from the mentioned linien fork using the command:

python -m gateware.fpga_image_helper -p fastservo

I have also set the linien_offset to 0x300000. The output have changed minimally but it seems the core issue is still there.

For reference, here is the full build log of the gateware:
https://gist.github.com/fsagbuya/2de2b4595e0420d4f1d9bc4eeed76f24

It would also be worth mentioning some changes we have made in order to build the gateware and the init scripts.

We are deploying everything using nix package manager. You can check the source code here. Looking forward to your response.

@fsagbuya
Copy link
Author

Hi @jmatyas. We made an adjustment to the spi.cshigh setting in adc.py and dac.py, setting it to False, based on the specifications in the datasheet. This change seems to have resolved the SPI readback errors. Could you please confirm if this modification aligns with the expected behavior? Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants