Add spidev on device tree #49

Merged
sb10q merged 1 commits from fsagbuya/nix-servo:spidev into master 2024-03-15 11:58:49 +08:00
Collaborator

Description

Fix SPI interface for devices in pyfastservo.

Device tree reference:
https://github.com/elhep/Fast-Servo-Firmware/blob/master/builds/fast_servo_petalinux/project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi

Test log:

[nix-shell:~/pyfastservo]# 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

Closes #48.

### Description Fix SPI interface for devices in `pyfastservo`. Device tree reference: https://github.com/elhep/Fast-Servo-Firmware/blob/master/builds/fast_servo_petalinux/project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi Test log: ``` [nix-shell:~/pyfastservo]# 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 ``` Closes #48.
fsagbuya added 1 commit 2024-03-15 11:56:52 +08:00
sb10q merged commit 628582a981 into master 2024-03-15 11:58:49 +08:00
Owner

No edge detected; setting iDelay to: 11
Different value read than sent in reg 0x02

Those don't look good. Those init scripts are very poorly written so it's unclear what the problem is though.

> No edge detected; setting iDelay to: 11 > Different value read than sent in reg 0x02 Those don't look good. Those init scripts are very poorly written so it's unclear what the problem is though.
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/nix-servo#49
No description provided.