Skip to content
Snippets Groups Projects
Whinis's avatar
John Turner authored
e912eea5

SFP Uart Board

This firmware works for the SFP Buddy line of boards using a rp2040 as a usb->uart and i2c bridge. The code is setup in such as way that it supports basic UART PIO to GPIO 0,2,4,6,7,9,16,17,20, and 21 The PIO for TX is setup to directly output whatever byte is inserted out on the pin, the PIO for RX is designed to DMA into a 2kb buffer that is then transferred to a USB CDC interface every loop of core 0 A second CDC interface is used to configure the board and get information from the onboard ethernet PHY if on the board, read and write to the i2c bus on SFP module, or modify UART settings. The second CDC interface also outputs debug information from the module.Due to limitations in drivers for both windows and linux in regards composite devices a different approach was taken for i2c. For I2C a hid interface was established that using a custom hid report, limitations in HID reports limits the size of the report preventing reading entire eeprom addresses at once. With limitation in mind an arbitrary 32 byte return was selected. There is a secondary I2C bus that is used to communicate with a USB PD controller, eeprom, and optional I2C screen.

More information on the development of this SFP debug project can be read at http://whinis.com/projects/SFP_Media_Buddy_and_why_SERDES_is_painful/1j1ef6s

All changes are automatically built using gitlab CI

Large portions of this code were sourced from https://github.com/Nicolai-Electronics/rp2040-i2c-interface and https://github.com/Noltari/pico-uart-bridge

Latest firmware file can be found here

Building


Checkout the repository

run git submodule update --init

cd directory into pico-sdk

run git submodule update --init again

generate cmake

build desired release

Disclaimer

This software is provided without warranty, according to the MIT License, and should therefore not be used where it may endanger life, financial stakes, or cause discomfort and inconvenience to others.

Raspberry Pi Pico Pinout

Raspberry Pi Pico GPIO Function
GPIO0 (Pin 2) SFP RS0(Pin 7)
GPIO2 (Pin 4) SFP RS1(Pin 9)
GPIO3 (Pin 5) Media PHY RST
GPIO4 (Pin 6) SFP TX DISABLE (Pin 3)
GPIO6 (Pin 8) SFP RX LOS (Pin 8)
GPIO7 (Pin 9) SFP TX Fault LOS (Pin 2)
GPIO8 (Pin 10) SFP Enable
GPIO9 (Pin 12) SFP MOD ABS (Pin 6)
GPIO10 (Pin 13) PHY MDIO
GPIO11 (Pin 14) PHY MDC
GPIO12 (Pin 15) PHY Int
GPIO16 (Pin 27) SFP SDA (Pin 4)
GPIO17 (Pin 28) SFP SCL (Pin 5)
GPIO19 (Pin 30) PD Int
GPIO20 (Pin 31) Header RX
GPIO21 (Pin 32) Header TX
GPIO22 (Pin 34) PD SDA
GPIO23 (Pin 35) PD SCL
GPIO24 (Pin 36) Console Connected LED
GPIO25 (Pin 37) Media Link LED
GPIO28 (Pin 40) UART0 Debug RX
GPIO29 (Pin 41) UART1 Debug RX