Skip to content

USB to MDIO (aka Serial Management Interface) adapter

License

Notifications You must be signed in to change notification settings

chmousset/USB2MDIO

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

USB2MDIO

This is a simple USB serial to MDIO controller.

Building the Firmware

Based on ChibiOS, it requires the toolchain arm-none-eabi-gcc.

make

Loading the firmware can be done via dfu-util utility, leveraging the built-in USB bootloader. It requires pushing the BOOT0 button on the board, then resetting the MCU. Once this is done, the dfu loader can be called

make flash-dfu

Now the MCU reboots and enmerates on the USB, ready to be used.

Basic Software usage

The UsbMdio adapter handles serial communication and provides a simple read/write reg API:

from usb2mdio.adapter import UsbMdio

adapter = UsbMdio("COM5")
adapter.write_reg(0x0F, 1<<14)  # Software Reset
print(f"ID= {adapter.read_reg(2)}")

Datasheet parsing and html visualisation

Some PHY can have hundereds of registers and multiple hundreds bitfields, making it cumbersome to peek/poke at them one by one. A small utility parses HTML formatted documentation (such as the ones from ti.com) to extract register definition, reads all register values, compares them to the reset values then display every register, their bitfields and modified values in an HTML file, making it quick to have a global picture of the PHY's state.

python dp83tc813_dump.py

About

USB to MDIO (aka Serial Management Interface) adapter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published