ADI GMSL2 SERDES SPI

https://www.analog.com/media/en/technical-documentation/user-guides/gmsl2-general-user-guide.pdf

https://www.analog.com/media/en/technical-documentation/data-sheets/max96752.pdf

https://www.analog.com/media/en/technical-documentation/data-sheets/max9295d.pdf

GMSL2 General User Guide

Key Features

• Four-wire main (connects to remote peripheral) or four-wire subordinate (connects to µC/SoC).

• Remote-side SPI bus supports SPI modes 0 or 3; local-side SPI bus supports SPI mode 0.

• Device filtering on (multiple SPI interfaces with different SPI IDs) or off (point-to-point SPI interface).

• Subordinate Select active low or high.

• 600kHz to 25MHz or 50MHz SPI clock (depending on device).

• MSB first (for control commands).

• Pin or I2C control of RO and BNE input/output.

18.Serial Peripheral Interface

image.png

18.3.3.1 SPI Burst Write

  1. Set RO.
  2. Send 0xA0 (Set SPI Target = 0, optional if only one device).
  3. Send 0xA4/A5 (Assert SS1/SS2).
  4. Clear RO.
  5. Send Cmd Byte (Read/Write and Address MS bit).
  6. Send Addrs Byte.
  7. Send Write Byte.
  8. Set RO.
  9. Wait for BNE = 1.
  10. Send 0xA6/Read Byte (Discard).
  11. Clear RO.
  12. Repeat 7 - 11 until all data is written.
  13. Set RO.
  14. Wait for BNE = 1.
  15. Send 0xA6/Read Byte (Discard) (Clear SS).
  16. Send 0xA6/Read Byte (Discard) (Clear SS).

18.3.3.2 SPI Burst Read

  1. Set RO.
  2. Send 0xA0 (Set SPI Target = 0, optional if only one device).
  3. Send 0xA4/A5 (Assert SS1/SS2).
  4. Clear RO.
  5. Send Cmd Byte (Read/Write and Address MS bit).
  6. Send Addrs Byte.
  7. Set RO.
  8. Wait for BNE = 1.
  9. Send 0xA7/Read Byte (Read Data) (Discard first two reads, remaining are valid).
  10. Repeat Steps 8 - 9 until all but two bytes are read.
  11. Wait for BNE = 1.
  12. Send 0xA6/Read Byte (Valid Data) (Clear SS).
  13. Send 0xA6/Read Byte (Last Valid Data) (Clear SS).

硬件框图

image.png

SPI 初始化

详细寄存器描述可以参考官网提供的 DataSheet

Index Device Reg Value Desc
1 MAX9295D 0x173 0xFA
2 MAX9295D 0x174 0xFA SCK 600KHz
3 MAX9295D 0x175 0xFA SCK 600KHz
4 MAX9295D 0x176 0x0C
5 MAX96752 0x4E6 0x03 0x4E6 0x4F6
6 MAX96752 0x4E9 0x00 0x4E9 0x4F9
7 MAX9295D 0x172 0x00 #SPI mode 0
8 MAX96752 0x4E0 0x09 0x4E0 0x4F0
9 MAX9295D 0X170 0X0B

SPI mode 0 的波形

image.png

image.png

image.png

image.png

SPI mode 3 配置

0x172 设置 0x0C OK

image.png

image.png

image.png

错误的配置:0x172 设置 0x04

image.png

image.png

image.png