From 23c5dc43a1b3b08b4c91879f52102d3a8a2774fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=20K=C3=A9vin?= Date: Thu, 16 Jun 2022 18:14:01 +0200 Subject: [PATCH] doc: add flashing instructions --- DEVELOPMENT.md | 13 ++++++++++ eeprom.bin | Bin 0 -> 256 bytes eeprom.rb | 68 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100644 eeprom.bin create mode 100644 eeprom.rb diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 4d41237..8e99697 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -81,3 +81,16 @@ to export gerber files for PCB manufacturer (and photo preview + overview docume rake fabrication ~~~ +flashing +======== + +the USB hub gets its configuration from an external EEPROM. +running `eeprom.rb` will generate the EEPROM configuration in `eeprom.bin`. +this must then be flashed on the board EEPROM. +it is possible to flash it in circuit using the corresponding header, and by holding the RST signal low to prevent the USB hub from interfering with the communication. + +to flash it using [minipro](https://gitlab.com/DavidGriffith/minipro/): + +~~~ +minipro --device "AT24C16@SOIC8" --write eeprom.bin -s +~~~ diff --git a/eeprom.bin b/eeprom.bin new file mode 100644 index 0000000000000000000000000000000000000000..71fe33966c22c17521864673c3ce2c6f16475498 GIT binary patch literal 256 zcmWHLtx7avoZP_7z`($0#Aw9D!pXtQ<;+mZ5XO)XgehPWC`ke+0O~1cNM$HuP+$mU i2xf2s(iuP#lZZ0Ih{1rt2nY=r%oq%T*Z@e<4gdg=QViw* literal 0 HcmV?d00001 diff --git a/eeprom.rb b/eeprom.rb new file mode 100644 index 0000000..293c04b --- /dev/null +++ b/eeprom.rb @@ -0,0 +1,68 @@ +eeprom = [ + 0x50, # VID LSB (OpenMoko) + 0x1d, # VID MSB (OpenMoko) + 0x7a, # PID LSB + 0x61, # PID MSB + 0x32, # DID_LSB board revision (BCD format) + 0x01, # DID_MSB board version (BCD format) + 0b10010011, # CONFIG_BYTE_1: SELF_BUS_PWR = 1 (indicate self-powered, superseeded by DYNAMIC), reserved, HS_DISABLE = 0 (allow high speed), MTT_ENABLE = 1 (one TT per port), EOP_DISABLE = normal, CURRENT_SNS = Individual port-by-port, PORT_PWR = Individual port-by-port switching + 0b10000000, # CONFIG_BYTE_2: DYNAMIC = Dynamic Auto-switching capable, Reserved, OC_TIMER = 00 = 0.1ms, COMPOUND = No, Reserved + 0b000000011, # CONFIG_BYTE_3: PRTMAP_EN = Standard Mode, LED_MODE = Speed Indication Mode, STRING_EN = String Support Enabled + 0x00, # NR_DEVICE = no non-removable devices + 0x00, # PORT_DIS_SP = no port disable + 0x00, # PORT_DIS_BP = no bus powered port disable + 1, # MAX_PWR_SP = 2 mA + 50, # MAX_PWR_BP = 100 mA (neede to charge all capacitor) + 1, # HC_MAX_C_SP = MAX_PWR_SP + 50, # HC_MAX_C_BP = MAX_PWR_BP + 10, # POWER_ON_TIME = 20 ms + 0x04, # LANG_ID_H = US + 0x09, # LANG_ID_L = english + 0, # MFR_STR_LEN will be encoded below + 0, # PRD_STR_LEN will be encoded below + 0, # SER_STR_LEN will be encoded below + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # MFR_STR will be encoded below + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # PRD_STR will be encoded below + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # SER_STR will be encoded below + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,# reserved + 0x00, # BOOST_IOUT = no boost + 0x00, # Boost_7:5 = no boost + 0x00, # Boost_4:0 = no boost+ + 0x00, # 0xf9 reserved (undocumented debug mode using LED pins) + 0x00, # PRTSP = no port is swapped + 0x00, # PRTR12 = no remap + 0x00, # PRTR34 = no remap + 0x00, # PRTR56 = no remap + 0x00, # PRTR7 = no remap + 0x00, # Status/Command (not used) +] + +# encode manufacturer +MANUFACTURER = "CuVoodoo" +MFR_STR_LEN = 0x13 +eeprom[MFR_STR_LEN] = MANUFACTURER.length +MFR_STR = 0x16 +MANUFACTURER_BYTES = MANUFACTURER.encode("UTF-16LE").unpack("C*") +eeprom[MFR_STR, MANUFACTURER_BYTES.length] = MANUFACTURER_BYTES + +# encode product +PRODUCT = "power USB hub" +PRD_STR_LEN = 0x14 +eeprom[PRD_STR_LEN] = PRODUCT.length +PRD_STR = 0x54 +PRODUCT_BYTES = PRODUCT.encode("UTF-16LE").unpack("C*") +eeprom[PRD_STR, PRODUCT_BYTES.length] = PRODUCT_BYTES + +# encode serial +SERIAL = "2022061601" +SER_STR_LEN = 0x15 +eeprom[SER_STR_LEN] = SERIAL.length +SER_STR = 0x92 +SERIAL_BYTES = SERIAL.encode("UTF-16LE").unpack("C*") +eeprom[SER_STR, SERIAL_BYTES.length] = SERIAL_BYTES + +# output epprom +raise "EEPROM length not 256" unless eeprom.length == 256 +File.open("eeprom.bin", "wb") do |file| + file.write eeprom.pack("C*") +end