SD-Init-Fix (LVS/Samsung-T7-Micro-SD)
This commit is contained in:
1 parent
d3dca674aa
commit
bb9827f821
7 files changed
+1692
-1925
No files matched your search
+3
-1
@@ -20,11 +20,13 @@ add_executable(usk main.c board_detect.c fuses.c pio_upload.c boot_detect.c conf
|
||||
|
||||
target_compile_definitions(usk PRIVATE PICO_NO_BINARY_INFO)
|
||||
|
||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/generated")
|
||||
|
||||
pico_generate_pio_header(usk ${CMAKE_CURRENT_LIST_DIR}/ws2812.pio OUTPUT_DIR ${CMAKE_CURRENT_LIST_DIR}/generated)
|
||||
pico_generate_pio_header(usk ${CMAKE_CURRENT_LIST_DIR}/emmc.pio OUTPUT_DIR ${CMAKE_CURRENT_LIST_DIR}/generated)
|
||||
|
||||
pico_set_program_name(usk "usk")
|
||||
pico_set_program_version(usk "2.7")
|
||||
pico_set_program_version(usk "3.00")
|
||||
|
||||
pico_set_binary_type(usk no_flash)
|
||||
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
# μsk
|
||||
# Woody-NX μsk V3.00
|
||||
|
||||
Rehius-based RP2040 firmware with Woody-NX modifications: custom Picofly screen, battery indicator, S1/LVS integration, Samsung eMMC CMD1 adjustment, V3.00 version and brighter LEDs with red error codes. No PWM.
|
||||
|
||||
Original Rehius license retained. The prepared Switch loader and custom additions are embedded in payload.h; complete original Switch-loader core source is not part of this native firmware directory.
|
||||
@@ -3,8 +3,8 @@
|
||||
#define OFFSET_MIN 6200
|
||||
#define OFFSET_MAX 6900
|
||||
|
||||
#define VER_HI 2
|
||||
#define VER_LO 80
|
||||
#define VER_HI 3
|
||||
#define VER_LO 0
|
||||
|
||||
bool is_configured();
|
||||
void init_config();
|
||||
|
||||
@@ -59,38 +59,39 @@ void finish_pins_leds() {
|
||||
gpio_disable_input_output(pwr_pin());
|
||||
}
|
||||
|
||||
void halt_with_error(uint32_t err, uint32_t bits)
|
||||
void halt_with_error(uint32_t long_mask, uint32_t blinks)
|
||||
{
|
||||
finish_pins_except_leds();
|
||||
pio_set_sm_mask_enabled(pio0, 0xF, false);
|
||||
pio_set_sm_mask_enabled(pio1, 0xF, false);
|
||||
set_sys_clock_khz(48000, true);
|
||||
vreg_set_voltage(VREG_VOLTAGE_0_95);
|
||||
if (bits != 1)
|
||||
if (blinks != 1)
|
||||
{
|
||||
put_pixel(0);
|
||||
sleep_ms(PAUSE_BEFORE);
|
||||
}
|
||||
for(int j = 0; j < CODE_REPEATS; j++)
|
||||
{
|
||||
for(int i = 0; i < bits; i++)
|
||||
for(int i = 0; i < blinks; i++)
|
||||
{
|
||||
bool is_long = err & (1 << (bits - i - 1));
|
||||
// Long mask in reverse.
|
||||
bool is_long = long_mask & (1 << (blinks - i - 1));
|
||||
sleep_ms(is_long ? LONG_PAUSE_TIME : SHORT_PAUSE_TIME);
|
||||
bool success = bits == 1 && is_long == 0;
|
||||
if (success)
|
||||
bool success = blinks == 1 && is_long == 0;
|
||||
if (blinks == 1)
|
||||
put_pixel(PIX_whi);
|
||||
else
|
||||
put_pixel(PIX_yel);
|
||||
put_pixel(0x004600); // GRB red; preserve native error blink timing
|
||||
sleep_ms(is_long ? LONG_TIME : success ? SHORT_TIME * 2 : SHORT_TIME);
|
||||
put_pixel(0);
|
||||
if (i != bits - 1 || j != CODE_REPEATS - 1)
|
||||
if (i != blinks - 1 || j != CODE_REPEATS - 1)
|
||||
sleep_ms(is_long ? LONG_PAUSE_TIME : SHORT_PAUSE_TIME);
|
||||
if (i == bits - 1 && j != CODE_REPEATS - 1)
|
||||
if (i == blinks - 1 && j != CODE_REPEATS - 1)
|
||||
sleep_ms(PAUSE_BETWEEN);
|
||||
}
|
||||
// first write case, do not repeat this kind of error code
|
||||
if (bits == 1)
|
||||
if (blinks == 1)
|
||||
break;
|
||||
}
|
||||
finish_pins_leds();
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#define PIX_blu 0x00003F
|
||||
#define PIX_yel 0x151500
|
||||
#define PIX_whi 0x111111
|
||||
#define PIX_blu 0x0000D0
|
||||
#define PIX_yel 0x383800
|
||||
#define PIX_whi 0x383838
|
||||
|
||||
#define PIX_b 0x00000F
|
||||
#define PIX_b 0x000015
|
||||
|
||||
void put_pixel(uint32_t pixel_grb);
|
||||
|
||||
void halt_with_error(uint32_t err, uint32_t bits);
|
||||
void halt_with_error(uint32_t pause, uint32_t blinks);
|
||||
|
||||
void gpio_disable_input_output(int pin);
|
||||
|
||||
|
||||
@@ -393,7 +393,7 @@ bool init_op_cond() {
|
||||
simple_cmd_exec(MMC_GO_IDLE_STATE, 0);
|
||||
if (!simple_cmd_exec_with_ret(MMC_SEND_OP_COND, 0, &res))
|
||||
return false;
|
||||
int retry = 100;
|
||||
int retry = 150;
|
||||
while(--retry > 0) {
|
||||
if (!simple_cmd_exec_with_ret(MMC_SEND_OP_COND, SD_OCR_CCS | SD_OCR_VDD_18, &res))
|
||||
return false;
|
||||
|
||||
Reference in new issue
Block a user