From 764165f7ba4aa5092ed04521c512a964411e908f Mon Sep 17 00:00:00 2001 From: Renze Nicolai Date: Sun, 15 May 2022 22:01:40 +0200 Subject: [PATCH] Add RP2040 UID reading function --- components/mch2022-rp2040 | 2 +- main/main.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/components/mch2022-rp2040 b/components/mch2022-rp2040 index 9135835..b5b6460 160000 --- a/components/mch2022-rp2040 +++ b/components/mch2022-rp2040 @@ -1 +1 @@ -Subproject commit 91358358eaffb12d699991e75b5243a02f1e2166 +Subproject commit b5b64602231a80708bb016d92c67c878ec4d226d diff --git a/main/main.c b/main/main.c index 3e71a42..9690662 100644 --- a/main/main.c +++ b/main/main.c @@ -645,7 +645,16 @@ void app_main(void) { } rp2040_updater(rp2040, pax_buffer, ili9341); // Handle RP2040 firmware update & bootloader mode - + + uint8_t rp2040_uid[8]; + if (rp2040_get_uid(rp2040, rp2040_uid) != ESP_OK) { + ESP_LOGE(TAG, "Failed to get RP2040 UID"); + display_fatal_error(pax_buffer, ili9341, "Failed to initialize", "Failed to read UID", NULL, NULL); + esp_restart(); + } + + printf("RP2040 UID: %02X%02X%02X%02X%02X%02X%02X%02X\n", rp2040_uid[0], rp2040_uid[1], rp2040_uid[2], rp2040_uid[3], rp2040_uid[4], rp2040_uid[5], rp2040_uid[6], rp2040_uid[7]); + if (bsp_ice40_init() != ESP_OK) { ESP_LOGE(TAG, "Failed to initialize the ICE40 FPGA"); display_fatal_error(pax_buffer, ili9341, "Failed to initialize", "ICE40 FPGA error", NULL, NULL);