diff --git a/display.cpp b/display.cpp index 96e584e..7415829 100644 --- a/display.cpp +++ b/display.cpp @@ -241,6 +241,8 @@ void DisplayDriver::run() { } } + //pwm_set_gpio_level(PIN_LED, frame_data.frame_table_header.bank_number ? 255*255 : 0); + frame_data.get_frame_table(frame_counter, frame_table); if (frame_data.config.v_repeat != dvi0.vertical_repeat) { @@ -365,8 +367,6 @@ void DisplayDriver::run() { clear_sprite(i); } - multicore_reset_core1(); - if (heartbet_led) { pwm_set_gpio_level(PIN_LED, 0); } diff --git a/main.cpp b/main.cpp index f6fd959..95604a0 100644 --- a/main.cpp +++ b/main.cpp @@ -14,6 +14,7 @@ #include "hardware/structs/pads_qspi.h" #include "hardware/structs/ioqspi.h" #include "hardware/adc.h" +#include "pico/multicore.h" #include "i2c_interface.hpp" #include "display.hpp" @@ -373,6 +374,21 @@ int main() { display.run(); + // Set the clock rate back down to 125MHz. + // It appears that weird stuff happens if we try to reset core 1 + // while running at 400MHz!! + + // Deinit I2C before adjusting clock + i2c_slave_if::deinit(); + + set_sys_clock_khz(125000, true); + + stdio_init_all(); + multicore_reset_core1(); + + // Reinit I2C now clock is set. + i2c_slave_if::init(handle_i2c_sprite_write, handle_i2c_reg_write); + printf("DV Driver: Display stopped\n"); regs[0xFD] = 0; }