Skip to content

Commit

Permalink
Reduce clock before resetting core1
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelBell committed Oct 14, 2023
1 parent a6b3d05 commit 324df7e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -365,8 +367,6 @@ void DisplayDriver::run() {
clear_sprite(i);
}

multicore_reset_core1();

if (heartbet_led) {
pwm_set_gpio_level(PIN_LED, 0);
}
Expand Down
16 changes: 16 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 324df7e

Please sign in to comment.