Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bb9827f821 | ||
|
|
d3dca674aa | ||
|
|
06f6f2b4f6 | ||
|
|
d2e58f6a8a | ||
|
|
1c497e1f1e | ||
|
|
476dd2212e |
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.
|
||||
+13
-8
@@ -12,7 +12,7 @@ bool board_detected = false;
|
||||
|
||||
bool wait_for_boot(int timeout_ms) {
|
||||
absolute_time_t tio_full = make_timeout_time_ms(timeout_ms);
|
||||
absolute_time_t tio_cmd1 = tio_full;
|
||||
absolute_time_t tio_shrt = tio_full;
|
||||
init_glitch_pio();
|
||||
reset_cpu();
|
||||
uint32_t word=0, last_word=0;
|
||||
@@ -21,14 +21,19 @@ bool wait_for_boot(int timeout_ms) {
|
||||
int reset_attempts = 0;
|
||||
|
||||
while(1) {
|
||||
if (time_reached(tio_cmd1))
|
||||
if (time_reached(tio_full))
|
||||
{
|
||||
if (reset_attempts > 4)
|
||||
halt_with_error(3, 3);
|
||||
return false;
|
||||
}
|
||||
if (time_reached(tio_shrt))
|
||||
{
|
||||
if (reset_attempts > 10)
|
||||
{
|
||||
if (was_read_zero) {
|
||||
halt_with_error(1, 3);
|
||||
}
|
||||
else if (tio_cmd1 != tio_full) {
|
||||
else if (tio_shrt != tio_full) {
|
||||
halt_with_error(0, 3);
|
||||
}
|
||||
else if (was_cmd1) {
|
||||
@@ -40,23 +45,23 @@ bool wait_for_boot(int timeout_ms) {
|
||||
}
|
||||
reset_attempts++;
|
||||
reset_cpu();
|
||||
tio_cmd1 = tio_full;
|
||||
tio_shrt = make_timeout_time_ms(1000);
|
||||
}
|
||||
if(!pio_sm_is_rx_fifo_empty(pio1, 0))
|
||||
{
|
||||
word = pio_sm_get(pio1, 0);
|
||||
if (last_word == 0x41000000 && word == 0x00F9) // cmd1 request
|
||||
{
|
||||
tio_cmd1 = make_timeout_time_ms(20);
|
||||
tio_shrt = make_timeout_time_ms(50);
|
||||
was_cmd1 = true;
|
||||
}
|
||||
else if (last_word == 0x00F9 && (word >> 24) == 0x3F) // cmd1 responce
|
||||
{
|
||||
tio_cmd1 = tio_full;
|
||||
tio_shrt = tio_full;
|
||||
}
|
||||
else if (last_word == 0x51000000 && word == 0x0055) //read block 0
|
||||
{
|
||||
tio_cmd1 = make_timeout_time_ms(100);
|
||||
tio_shrt = make_timeout_time_ms(400);
|
||||
was_read_zero = true;
|
||||
} else if (was_read_zero && last_word == 0x4D000200 && word == 0x00B1) // read status - erista only
|
||||
{
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
#define OFFSET_MIN 6200
|
||||
#define OFFSET_MAX 6900
|
||||
|
||||
#define VER_HI 2
|
||||
#define VER_LO 78
|
||||
#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