diff --git a/firmware/baseband/w25q80bv.cpp b/firmware/baseband/w25q80bv.cpp index f83bfff1e..c3c056d11 100644 --- a/firmware/baseband/w25q80bv.cpp +++ b/firmware/baseband/w25q80bv.cpp @@ -77,7 +77,8 @@ void wait_for_device() { do { device_id = get_device_id(); } while (device_id != W25Q80BV_DEVICE_ID_RES && - device_id != W25Q16DV_DEVICE_ID_RES); + device_id != W25Q16DV_DEVICE_ID_RES && + device_id != W25Q32JV_DEVICE_ID_RES); } void wait_not_busy() { diff --git a/firmware/baseband/w25q80bv.hpp b/firmware/baseband/w25q80bv.hpp index b1705e2bf..9beae42d5 100644 --- a/firmware/baseband/w25q80bv.hpp +++ b/firmware/baseband/w25q80bv.hpp @@ -83,6 +83,7 @@ #define W25Q80BV_DEVICE_ID_RES 0x13 /* Expected device_id for W25Q80BV */ #define W25Q16DV_DEVICE_ID_RES 0x14 /* Expected device_id for W25Q16DV */ +#define W25Q32JV_DEVICE_ID_RES 0x15 /* Expected device_id for W25Q32JV (Praline) */ #define SSP_CR1(port) MMIO32(port + 0x004) #define PERIPH_BASE_APB0 0x40080000 diff --git a/flashing/mayhem_flasher.bat b/flashing/mayhem_flasher.bat index d8a69ce9d..bf3e22945 100644 --- a/flashing/mayhem_flasher.bat +++ b/flashing/mayhem_flasher.bat @@ -36,17 +36,19 @@ REM ── Step 2: Select action ─────────────── echo What would you like to do? echo. echo 1. Flash Mayhem firmware -echo 2. Flash via DFU (unbrick - run HackRF firmware from RAM) -echo 3. Flash factory HackRF firmware (HackRF only - removes PortaPack support) +echo 2. Flash DFU then Mayhem (DFU unbrick followed by Mayhem flash in one go) +echo 3. Flash via DFU (unbrick - run HackRF firmware from RAM) +echo 4. Flash factory HackRF firmware (HackRF only - removes PortaPack support) echo. -set /p ACTION_CHOICE="Enter your choice (1, 2 or 3): " +set /p ACTION_CHOICE="Enter your choice (1, 2, 3 or 4): " if "%ACTION_CHOICE%"=="1" goto :flash_mayhem -if "%ACTION_CHOICE%"=="2" goto :flash_dfu -if "%ACTION_CHOICE%"=="3" goto :flash_factory +if "%ACTION_CHOICE%"=="2" goto :flash_dfu_then_mayhem +if "%ACTION_CHOICE%"=="3" goto :flash_dfu +if "%ACTION_CHOICE%"=="4" goto :flash_factory echo. -echo Invalid choice. Please run the script again and enter 1, 2, or 3. +echo Invalid choice. Please run the script again and enter 1, 2, 3, or 4. echo. pause exit /b @@ -70,18 +72,17 @@ echo. if not exist %FIRMWARE% ( echo ERROR: The firmware file "%FIRMWARE%" was not found. echo Please ensure you have downloaded the latest release from: - echo https://github.com/portapack-mayhem/mayhem-firmware/releases/ + echo https://release.hackrf.app/ echo. pause exit /b ) -pause echo. "utils/hackrf_spiflash.exe" -R -w %FIRMWARE% echo. echo If your device does not boot after flashing, see the troubleshooting wiki: -echo https://github.com/portapack-mayhem/mayhem-firmware/wiki/Won%27t-boot +echo https://github.com/portapack-mayhem/mayhem-firmware/wiki/Wont-boot echo. pause exit /b @@ -110,13 +111,12 @@ if "%DEVICE_CHOICE%"=="3" ( if not exist "%DFU_FILE%" ( echo ERROR: "%DFU_FILE%" was not found. echo Please ensure you have downloaded the latest release from: - echo https://github.com/portapack-mayhem/mayhem-firmware/releases/ + echo https://release.hackrf.app/ echo. pause exit /b ) -pause echo. "utils/dfu-util-static.exe" --device 1fc9:000c --download "%DFU_FILE%" echo. @@ -124,7 +124,68 @@ pause exit /b -REM ── Action 3: Flash factory HackRF firmware ──────────────── +REM ── Action 3: DFU then flash Mayhem ───────────────────────── +:flash_dfu_then_mayhem +echo. +echo *** DFU unbrick followed by Mayhem firmware flash *** +echo. +echo This will first load HackRF firmware into RAM via DFU, then flash Mayhem. +echo. +echo Before pressing any key, put your device into DFU mode: +echo 1. Hold down both the DFU and RESET buttons. +echo 2. Release the RESET button first (the one closest to the edge). +echo 3. Then release the DFU button. +echo. + +if "%DEVICE_CHOICE%"=="3" ( + set DFU_FILE=firmware\hackrf_hpro_usb.dfu +) else ( + set DFU_FILE=firmware\hackrf_usb.dfu +) + +if not exist "%DFU_FILE%" ( + echo ERROR: "%DFU_FILE%" was not found. + echo Please ensure you have downloaded the latest release from: + echo https://release.hackrf.app/ + echo. + pause + exit /b +) + +if "%DEVICE_CHOICE%"=="1" set FIRMWARE=firmware\firmware_hackrf.bin +if "%DEVICE_CHOICE%"=="2" set FIRMWARE=firmware\firmware_portarf.bin +if "%DEVICE_CHOICE%"=="3" set FIRMWARE=firmware\firmware_hpro.bin + +if not exist "%FIRMWARE%" ( + echo ERROR: The firmware file "%FIRMWARE%" was not found. + echo Please ensure you have downloaded the latest release from: + echo https://release.hackrf.app/ + echo. + pause + exit /b +) + +echo Step 1 of 2: Loading HackRF firmware via DFU... +echo. +"utils/dfu-util-static.exe" --device 1fc9:000c --download "%DFU_FILE%" + +echo. +echo DFU complete. Waiting 5 seconds for device to re-enumerate... +timeout /t 5 /nobreak >nul + +echo. +echo Step 2 of 2: Flashing Mayhem firmware (%FIRMWARE%)... +echo. +"utils/hackrf_spiflash.exe" -R -w "%FIRMWARE%" +echo. +echo If your device does not boot after flashing, see the troubleshooting wiki: +echo https://github.com/portapack-mayhem/mayhem-firmware/wiki/Wont-boot +echo. +pause +exit /b + + +REM ── Action 4: Flash factory HackRF firmware ──────────────── :flash_factory echo. echo *** Restore factory HackRF firmware *** @@ -142,19 +203,14 @@ if "%DEVICE_CHOICE%"=="3" ( if not exist "%FACTORY_BIN%" ( echo ERROR: "%FACTORY_BIN%" was not found. echo Please ensure you have downloaded the latest release from: - echo https://github.com/portapack-mayhem/mayhem-firmware/releases/ + echo https://release.hackrf.app/ echo. pause exit /b ) -pause echo. "utils/hackrf_spiflash.exe" -R -w "%FACTORY_BIN%" echo. pause exit /b - - - -