summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2022-09-02 00:46:45 -0700
committerH. Peter Anvin <hpa@zytor.com>2022-09-02 00:46:45 -0700
commit1477864feeae5d7447d66bea9d1e48b6c77fb06c (patch)
tree8ccfbb1dc615d4500d52429e2352d6af5a61f800
parent634b03c355e27d34bb0ee94b0f936758a65a17da (diff)
downloadblinktest-1477864feeae5d7447d66bea9d1e48b6c77fb06c.tar.gz
blinktest-1477864feeae5d7447d66bea9d1e48b6c77fb06c.tar.xz
blinktest-1477864feeae5d7447d66bea9d1e48b6c77fb06c.zip
httpd: show canonical serial number on the status screen
-rw-r--r--esp32/max80/common.h1
-rw-r--r--esp32/max80/max80.ino26
-rw-r--r--esp32/output/max80.ino.binbin801664 -> 801744 bytes
-rw-r--r--esp32/www/lang/sv3
-rw-r--r--esp32/www/status.html4
-rw-r--r--esp32/www/update.html2
-rw-r--r--fpga/output/bypass.rpd.gzbin67414 -> 67414 bytes
-rw-r--r--fpga/output/max80.fwbin924727 -> 924819 bytes
-rw-r--r--fpga/output/v1.fwbin765274 -> 765342 bytes
-rw-r--r--fpga/output/v1.rpd.gzbin217875 -> 217875 bytes
-rw-r--r--fpga/output/v2.fwbin765866 -> 765941 bytes
-rw-r--r--fpga/output/v2.rpd.gzbin217584 -> 217584 bytes
12 files changed, 13 insertions, 23 deletions
diff --git a/esp32/max80/common.h b/esp32/max80/common.h
index 8940fe0..f19ea8b 100644
--- a/esp32/max80/common.h
+++ b/esp32/max80/common.h
@@ -78,6 +78,7 @@ extern_c int reboot_delayed(void);
* Main MAC address from efuses
*/
extern_c uint8_t efuse_default_mac[6];
+extern_c char serial_number[16];
/*
* Time sync status
diff --git a/esp32/max80/max80.ino b/esp32/max80/max80.ino
index b37bc1c..0888ef4 100644
--- a/esp32/max80/max80.ino
+++ b/esp32/max80/max80.ino
@@ -23,14 +23,14 @@
#define PIN_USB_PWR_SINK 8
uint8_t efuse_default_mac[6];
+char serial_number[16]; // Canonical board serial number
void setup_usb_ids()
{
uint8_t * const mac = efuse_default_mac;
- char serial[16];
esp_efuse_mac_get_default(mac);
- snprintf(serial, sizeof serial, "%02X%02X%02X-%02X%02X%02X",
+ snprintf(serial_number, sizeof serial_number, "%02X%02X%02X-%02X%02X%02X",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
USB.VID(0x4680);
@@ -38,7 +38,7 @@ void setup_usb_ids()
USB.firmwareVersion(1); // Do something smarter here
USB.productName("MAX80 Network Controller");
USB.manufacturerName("Peter & Per");
- USB.serialNumber(serial);
+ USB.serialNumber(serial_number);
}
static void heap_info()
@@ -60,8 +60,6 @@ static void dump_config()
printf("--- End configuration and status\n");
}
-uint8_t max80_board_version;
-
static void init_hw()
{
// Start out with disabled shared I/O pins
@@ -84,22 +82,6 @@ static void init_hw()
pinMode(PIN_USB_PWR_SINK, OUTPUT); // IO8: USB_PWR_SINK
digitalWrite(PIN_USB_PWR_SINK, 0); // This is a power sink
- #if 0
- pinMode(PIN_USB_PWR_EN, OUTPUT);
- digitalWrite(PIN_USB_PWR_EN, 0);
- delayMicroseconds(100);
-
- pinMode(PIN_USB_PWR_EN, INPUT_PULLUP);
- delayMicroseconds(50);
-
- pinMode(PIN_USB_PWR_EN, INPUT);
- delayMicroseconds(50);
-
- max80_board_version = digitalRead(PIN_USB_PWR_EN) ? 1 : 2;
-#else
- max80_board_version = 2;
-#endif
-
pinMode(PIN_USB_PWR_EN, OUTPUT);
digitalWrite(PIN_USB_PWR_EN, 0);
delayMicroseconds(50);
@@ -123,6 +105,8 @@ void setup() {
printf("[FW] MAX80 firmware compiled on %s\n", fwdate);
printf("[PCB] MAX80 board version: %s\n", board_info.version_str);
setenv_cond("status.max80.hw.ver", board_info.version_str);
+ printf("[PCB] MAX80 serial number: %s\n", serial_number);
+ setenv_cond("status.max80.hw.serial", serial_number);
Serial.println("MAX80 start");
init_config();
diff --git a/esp32/output/max80.ino.bin b/esp32/output/max80.ino.bin
index 5fc83cb..5635bad 100644
--- a/esp32/output/max80.ino.bin
+++ b/esp32/output/max80.ino.bin
Binary files differ
diff --git a/esp32/www/lang/sv b/esp32/www/lang/sv
index 3736b13..6746440 100644
--- a/esp32/www/lang/sv
+++ b/esp32/www/lang/sv
@@ -29,7 +29,8 @@ button .hide=Göm
.onerr .console=Se serieport för mer detaljerad status
.wifi-sta legend=Wifi-klient (normal)
.wifi-ap legend=Wifi-accesspunkt (backup)
-.hw .ver b, .hw legend=Hårdvaruversion
+.hw .serial b=Serienummer
+.hw .ver b, .hw legend.ver=Hårdvaruversion
.hw .unlock b=Tillåt programmering
.hw button=Programmera flash
.hw .warnrev=Var försiktig: att programmera fel version kan hindra kortet från att starta, i vilket fall det måste programmeras om via USB eller serieport.
diff --git a/esp32/www/status.html b/esp32/www/status.html
index 8ce823d..cf6f946 100644
--- a/esp32/www/status.html
+++ b/esp32/www/status.html
@@ -16,6 +16,10 @@
<b>Hardware version</b>
<input type="text" name="max80.hw.ver" />
</label>
+ <label class="serial">
+ <b>Serial Number</b>
+ <input type="text" name="max80.hw.serial" />
+ </label>
<label class="fpgaok">
<b>FPGA online</b>
<input type="checkbox" name="max80.fpga" />
diff --git a/esp32/www/update.html b/esp32/www/update.html
index b4cfa37..3923d0f 100644
--- a/esp32/www/update.html
+++ b/esp32/www/update.html
@@ -11,7 +11,7 @@
<form class="hw" id="boardid" action="sys/setboardrev" method="post"
onsubmit="uploadform()" data-ref="1" data-ref-url="update.html">
<fieldset>
- <legend>Hardware Version</legend>
+ <legend class="ver">Hardware Version</legend>
<label class="unlock">
<b>Unlock Programming</b>
<input type="checkbox" name="unlock" id="unlock" onchange="bropen()">
diff --git a/fpga/output/bypass.rpd.gz b/fpga/output/bypass.rpd.gz
index dc460c3..d6d9a5b 100644
--- a/fpga/output/bypass.rpd.gz
+++ b/fpga/output/bypass.rpd.gz
Binary files differ
diff --git a/fpga/output/max80.fw b/fpga/output/max80.fw
index 386fe61..caf7f07 100644
--- a/fpga/output/max80.fw
+++ b/fpga/output/max80.fw
Binary files differ
diff --git a/fpga/output/v1.fw b/fpga/output/v1.fw
index 479a4da..f8ba598 100644
--- a/fpga/output/v1.fw
+++ b/fpga/output/v1.fw
Binary files differ
diff --git a/fpga/output/v1.rpd.gz b/fpga/output/v1.rpd.gz
index 7cbbcd6..b986494 100644
--- a/fpga/output/v1.rpd.gz
+++ b/fpga/output/v1.rpd.gz
Binary files differ
diff --git a/fpga/output/v2.fw b/fpga/output/v2.fw
index 8ea59b2..1228ad5 100644
--- a/fpga/output/v2.fw
+++ b/fpga/output/v2.fw
Binary files differ
diff --git a/fpga/output/v2.rpd.gz b/fpga/output/v2.rpd.gz
index 3aecc34..3d82779 100644
--- a/fpga/output/v2.rpd.gz
+++ b/fpga/output/v2.rpd.gz
Binary files differ