소스 검색

RP2040: Fix random boot hangs

Sometimes flash_do_cmd() call would coincide with SysTick interrupt.
Interrupts should be disabled when running it.
Petteri Aimonen 2 년 전
부모
커밋
4f50677054
2개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      lib/ZuluSCSI_platform_BS2/ZuluSCSI_platform.cpp
  2. 2 0
      lib/ZuluSCSI_platform_RP2040/ZuluSCSI_platform.cpp

+ 2 - 0
lib/ZuluSCSI_platform_BS2/ZuluSCSI_platform.cpp

@@ -95,7 +95,9 @@ void platform_init()
     // Get flash chip size
     uint8_t cmd_read_jedec_id[4] = {0x9f, 0, 0, 0};
     uint8_t response_jedec[4] = {0};
+    __disable_irq();
     flash_do_cmd(cmd_read_jedec_id, response_jedec, 4);
+    __enable_irq();
     g_flash_chip_size = (1 << response_jedec[3]);
     logmsg("Flash chip size: ", (int)(g_flash_chip_size / 1024), " kB");
 

+ 2 - 0
lib/ZuluSCSI_platform_RP2040/ZuluSCSI_platform.cpp

@@ -111,7 +111,9 @@ void platform_init()
     // Get flash chip size
     uint8_t cmd_read_jedec_id[4] = {0x9f, 0, 0, 0};
     uint8_t response_jedec[4] = {0};
+    __disable_irq();
     flash_do_cmd(cmd_read_jedec_id, response_jedec, 4);
+    __enable_irq();
     g_flash_chip_size = (1 << response_jedec[3]);
     logmsg("Flash chip size: ", (int)(g_flash_chip_size / 1024), " kB");