summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2022-06-23 19:53:11 -0700
committerH. Peter Anvin <hpa@zytor.com>2022-06-23 19:53:11 -0700
commit15629011c5e654bf640858cf8079909844abeb02 (patch)
tree746598df93d98cc6b57dec04921923e91c4576f5
parent378d46cb8fd3472d19f348c28c6ac3408d98dc2f (diff)
downloadblinktest-15629011c5e654bf640858cf8079909844abeb02.tar.gz
blinktest-15629011c5e654bf640858cf8079909844abeb02.tar.xz
blinktest-15629011c5e654bf640858cf8079909844abeb02.zip
esp32: enable input on both UART and USB
Enable data read on both UART and USB -- will be used to enable FPGA firmware upload.
-rw-r--r--esp32/max80/max80.ino45
-rw-r--r--esp32/output/max80.ino.binbin774352 -> 791792 bytes
-rw-r--r--fpga/output/v1.fwbin746390 -> 757100 bytes
-rw-r--r--fpga/output/v2.fwbin746828 -> 757577 bytes
4 files changed, 40 insertions, 5 deletions
diff --git a/esp32/max80/max80.ino b/esp32/max80/max80.ino
index 5d57d17..3a83bd5 100644
--- a/esp32/max80/max80.ino
+++ b/esp32/max80/max80.ino
@@ -14,6 +14,24 @@
#include <esp_task_wdt.h>
#include <esp_mac.h>
#include <USB.h>
+#include <HardwareSerial.h>
+
+static void Read_Echo(Stream &from)
+{
+ int byte;
+
+ while ((byte = from.read()) >= 0)
+ from.write(byte);
+}
+
+static void onrx_usb(void *foo, const char *bar, int baz, void *quux)
+{
+ Read_Echo(Serial);
+}
+static void onrx_uart(void)
+{
+ Read_Echo(Serial0);
+}
#define PIN_USB_PWR_EN 7
#define PIN_USB_PWR_SINK 8
@@ -48,6 +66,9 @@ uint8_t max80_board_version;
static void init_hw()
{
+ Serial0.begin(115200);
+ Serial0.onReceive(onrx_uart, false);
+
// Start out with disabled shared I/O pins
for (int i = 1; i <= 18; i++)
pinMode(i, INPUT);
@@ -76,6 +97,9 @@ static void init_hw()
pinMode(PIN_USB_PWR_EN, OUTPUT);
digitalWrite(PIN_USB_PWR_EN, 0);
+ delayMicroseconds(50);
+
+ Serial.onEvent(ARDUINO_USB_CDC_RX_EVENT, onrx_usb);
// Configure LEDs
led_init();
@@ -92,15 +116,21 @@ void setup() {
const char *fwdate = __DATE__ " " __TIME__;
printf("[START] MAX80 firmware compiled on %s\n", fwdate);
init_hw();
+ Serial.println("MAX80 start");
fpga_service_init();
+ Serial.println("0.2");
init_config();
+ Serial.println("0.3");
setenv_cond("status.max80.fw.date", fwdate);
fpga_service_enable(true);
+ Serial.println("0.4");
SetupWiFi();
+ Serial.println("0.5");
printf("[RDY]\n");
dump_config();
led_set(LED_BLUE, LED_ON); // Software ready
+ Serial.println("0.5");
printf("Total heap: %d\n"
"Free heap: %d\n"
"Total PSRAM: %d\n"
@@ -145,12 +175,17 @@ static void dump_tasks(void)
}
void loop() {
- printf("loop task: %s\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
- printf("idle task: %s\n", pcTaskGetName(xTaskGetIdleTaskHandle()));
+ static int x = 0;
+
+ if (0) {
+ printf("loop task: %s\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
+ printf("idle task: %s\n", pcTaskGetName(xTaskGetIdleTaskHandle()));
- dump_tasks();
+ dump_tasks();
- putchar('\n');
+ putchar('\n');
+ }
- vTaskDelay(120 * configTICK_RATE_HZ);
+ Serial.println(++x);
+ vTaskDelay(2 * configTICK_RATE_HZ);
}
diff --git a/esp32/output/max80.ino.bin b/esp32/output/max80.ino.bin
index 9728a2d..36bbdb5 100644
--- a/esp32/output/max80.ino.bin
+++ b/esp32/output/max80.ino.bin
Binary files differ
diff --git a/fpga/output/v1.fw b/fpga/output/v1.fw
index df65004..32ab734 100644
--- a/fpga/output/v1.fw
+++ b/fpga/output/v1.fw
Binary files differ
diff --git a/fpga/output/v2.fw b/fpga/output/v2.fw
index 6c23da7..480ea7c 100644
--- a/fpga/output/v2.fw
+++ b/fpga/output/v2.fw
Binary files differ