Skip to content

DS160PR810 PCIe 4.0 16-Gbps 8-Channel Linear Redriver Library for STM32 (ARM processors) using HAL drivers ⚡

License

Notifications You must be signed in to change notification settings

SMotlaq/DS160PR810

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Doxygen Action pages-build-deployment

DS160PR810 HAL Based Library

The DS160PR810 is an eight channel low-power high-performance linear redriver designed to support PCIe 4.0 and Ultra Path Interface (UPI) 2.0 up to 16 Gbps. The device is a protocol agnostic linear redriver that can operate for many differential interfaces. (Click for more info)

This library is a software library that works with the DS160PR810 PCIe 4.0 16-Gbps 8-channel linear redriver. This library provides a convenient and efficient way to access the I2C interfaces of the chip, allowing developers to easily integrate this redriver into their systems.

The library is designed to be easy to use and provides a simple, intuitive API for accessing the I2C interfaces of the DS160PR810. It includes a range of functions for performing common I2C operations, such as sending and receiving data, querying the status of the chip, reading, and configuring the DS160PR810 settings.

With this library, developers can quickly and easily integrate the DS160PR810 into their systems, enabling them to take full advantage of the chip's capabilities.

Key Features

  • Easy-to-use API for accessing the I2C interfaces of the DS160PR810
  • Support for common I2C operations, such as sending and receiving data, querying the status of the chip, reading, and configuring the DS160PR810 settings

Documentations

The full documents are available here

Schematic Symbol and Footprint

Footprint and schematic symbols are available in my Altium library.

Donate

Is it helpfull?

Buy me a Coffee

Getting Started

Quick Start

  1. Download the library source from the latest release

  2. Copy ds160pr810.c and ds160pr810.h file to your project directory and add them to your IDE if necessary.

  3. It is recommended to import Debugger amd Logger as well, to simply use logs.

  4. Inclued the library into your project:

    #include "ds160pr810.h"
  5. Create an object (instanse) from DS160PR810 struct with desired name:

    DS160PR810 my_redriver;
  6. Initialize the chip:

    DS160PR810_init(&my_redriver, &hi2c1, 0x18);

    Each argument is described on the doc page.

  7. Now you can config the redriver CTLE using DS160PR810_setCTLE function. For example:

    DS160PR810_setCTLE(&my_redriver, BANK0_ALL_CHANNELS, EQ_STAGE1_BYPASS_DISABLE, 4, 2);

    Or

    DS160PR810_setCTLE(&my_redriver, BANK1_CHANNEL0_1, EQ_STAGE1_BYPASS_DISABLE, 2, 3);

    Or

    DS160PR810_setCTLE(&my_redriver, CHANNEL6_7, EQ_STAGE1_BYPASS_ENABLE, 1, 7);

    Full description of this function is available here.

  8. Then you can config the DC gain and TX VOD using DS160PR810_setDCGain function. For example:

    DS160PR810_setDCGain(&my_redriver, CHANNEL0_1, TX_VOD_0db, EQ_DC_GAIN_3db5);

    Or

      DS160PR810_setDCGain(&my_redriver, BANK0_CHANNEL2_3, TX_VOD_m3db5, EQ_DC_GAIN_0db);

    Or

      DS160PR810_setDCGain(&my_redriver, BANK1_ALL_CHANNELS, TX_VOD_m1db6, EQ_DC_GAIN_3db5);	

    Full description of this function is available here.

Here is the whole code:

#include "ds160pr810.h"

DS160PR810 my_redriver;

if(STATUS_OK == DS160PR810_init(&my_redriver, &hi2c1, 0x18)){

  // Set CTLE
  DS160PR810_setCTLE(&my_redriver, BANK0_ALL_CHANNELS, EQ_STAGE1_BYPASS_DISABLE, 4, 2);
  DS160PR810_setCTLE(&my_redriver, BANK1_ALL_CHANNELS, EQ_STAGE1_BYPASS_ENABLE, 0, 6);

  // Set DC gain
  DS160PR810_setDCGain(&my_redriver, ALL_BANKS, TX_VOD_0db, EQ_DC_GAIN_0db);
  
}

Using some useful tools

If you want to use UART or virtual USB COM port on your microcontroller, it is recommended to use my Debug tool and include it to your project:

#include "debug.h"

Then open the debug.h and config the print settings acording to your setup: (you can ignore DEBUG_UART if using USB)

// Print setting -------------------
#define DEBUG_ENABLE  1
#define DEBUG_ON_USB  1
#define DEBUG_UART    (&huart1)
// ---------------------------------

By applying the above trick, you can simply use DEBUG(...) instead of conventional printf(...) to see status on the serial terminal.

There is another tool that helps you to check the redriver status better, just by importing logger and using its functions. Here is the previous code with these tools:

#include "ds160pr810.h"
#include "debug.h"
#include "logger.h"

DS160PR810 my_redriver;

if(STATUS_OK == DS160PR810_init(&my_redriver, &hi2c1, 0x18)){
  
  DEBUG("Redriver init done \n\r");
  
  // Set CTLE
  DS160PR810_setCTLE(&my_redriver, BANK0_ALL_CHANNELS, EQ_STAGE1_BYPASS_DISABLE, 4, 2);
  DS160PR810_setCTLE(&my_redriver, BANK1_ALL_CHANNELS, EQ_STAGE1_BYPASS_ENABLE, 0, 6);

  // Set DC gain
  DS160PR810_setDCGain(&my_redriver, ALL_BANKS, TX_VOD_0db, EQ_DC_GAIN_0db);

  DEBUG("Redriver config done \n\r");

  log_All2(&my_redriver);
  
}
else{
  DEBUG("Redriver init failed \n\r");
}

The output will be like this:

Redriver init done 
Redriver config done 
---------------------------------------------------------------------------------
| Ch index | Stage 1 Stat | Stage 1 | Stage 2 | DC Gain |  Tx VOD  | RX  Detect |
---------------------------------------------------------------------------------
|     0    |    ACTIVE    |    4    |    2    |  0   db |   0   db |    NONE    |
|     1    |    ACTIVE    |    4    |    2    |  0   db |   0   db |    NONE    |
|     2    |    ACTIVE    |    4    |    2    |  0   db |   0   db |    NONE    |
|     3    |    ACTIVE    |    4    |    2    |  0   db |   0   db |    NONE    |
|     4    |   BYPASSED   |    0    |    6    |  0   db |   0   db |    NONE    |
|     5    |   BYPASSED   |    0    |    6    |  0   db |   0   db |    NONE    |
|     6    |   BYPASSED   |    0    |    6    |  0   db |   0   db |    NONE    |
|     7    |   BYPASSED   |    0    |    6    |  0   db |   0   db |    NONE    |
---------------------------------------------------------------------------------

Advanced Options

Reset Registers

DS160PR810 can reset the register values by software. If you want to reset all of the register values you can use DS160PR810_resetRegisters function:

DS160PR810_resetRegisters(&my_redriver);

(see more)

Getting the Current Configurations

You can read each setting individually by calling the appropriate function:

  • DS160PR810_getCTLE_EQStage1Bypass to read first stage status (see more)
  • DS160PR810_getCTLE_Stage1 to read the gain index of first stage (see more)
  • DS160PR810_getCTLE_Stage2 to read the gain index of first stage (see more)
  • DS160PR810_getDCGain_EQDCGain to read the DC gain (see more)
  • DS160PR810_getDCGain_TxVOD to read the TX VOD (see more)

Example:

void log_EQ_Channel(DS160PR810* self, ApplyTo channel){
  DEBUG("   - EQ Settings:\n\r");
  DEBUG("     - Stage1 Status: %s \n\r", DS160PR810_getCTLE_EQStage1Bypass(self, channel) ? "BY PASSED" : "ACTIVE");
  DEBUG("     -     Stage1 EQ: %d \n\r", DS160PR810_getCTLE_Stage1(self, channel));
  DEBUG("     -     Stage2 EQ: %d \n\r", DS160PR810_getCTLE_Stage2(self, channel));	
}

log_EQ_Channel(&my_redriver, CHANNEL0);

RX Detect Status

You can read the RX detect status by calling the DS160PR810_getRxDetectStatus function. To see the return values see here

Getting Device IDs

If you want to get the device IDs, you can use these functions:

For example:

DEBUG("The IDs are: \n\r Bank0: \n\r  - ID1: 0x%02X \n\r  - ID0: 0x%02X \n\r Bank1: \n\r  - ID1: 0x%02X \n\r  - ID0: 0x%02X \n\r",
  DS160PR810_getDevID1(&my_redriver, BANK0),
  DS160PR810_getDevID0(&my_redriver, BANK0),
  DS160PR810_getDevID1(&my_redriver, BANK1),
  DS160PR810_getDevID0(&my_redriver, BANK1)
);

Contact me via E-mail or Telegram

(back to top)

About

DS160PR810 PCIe 4.0 16-Gbps 8-Channel Linear Redriver Library for STM32 (ARM processors) using HAL drivers ⚡

Resources

License

Stars

Watchers

Forks

Sponsor this project

Languages