Skip to content

Commit

Permalink
Sound/white noise Clock fix (#625)
Browse files Browse the repository at this point in the history
  • Loading branch information
jLynx committed May 4, 2022
1 parent 8957d69 commit fe33c12
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions firmware/application/portapack.cpp
Expand Up @@ -403,6 +403,7 @@ bool init() {
// if( !hackrf::cpld::load_sram() ) {
// chSysHalt();
// }
chThdSleepMilliseconds(100);

configure_pins_portapack();

Expand All @@ -412,6 +413,8 @@ bool init() {

i2c0.stop();

chThdSleepMilliseconds(10);

set_clock_config(clock_config_irc);
cgu::pll1::disable();

Expand Down Expand Up @@ -452,9 +455,11 @@ bool init() {
cgu::pll1::direct();

i2c0.start(i2c_config_fast_clock);
chThdSleepMilliseconds(10);

touch::adc::init();
controls_init();
chThdSleepMilliseconds(10);

clock_manager.set_reference_ppb(persistent_memory::correction_ppb());
clock_manager.enable_first_if_clock();
Expand All @@ -465,10 +470,10 @@ bool init() {
sdcStart(&SDCD1, nullptr);
sd_card::poll_inserted();

chThdSleepMilliseconds(1);
chThdSleepMilliseconds(10);

if( !portapack::cpld::update_if_necessary(portapack_cpld_config()) ) {
chThdSleepMilliseconds(1);
chThdSleepMilliseconds(10);
// If using a "2021/12 QFP100", press and hold the left button while booting. Should only need to do once.
if (load_config() != 3){
shutdown_base();
Expand All @@ -480,11 +485,13 @@ bool init() {
chSysHalt();
}

chThdSleepMilliseconds(1); // This delay seems to solve white noise audio issues
chThdSleepMilliseconds(10); // This delay seems to solve white noise audio issues

LPC_CREG->DMAMUX = portapack::gpdma_mux;
gpdma::controller.enable();

chThdSleepMilliseconds(10);

audio::init(portapack_audio_codec());


Expand Down

0 comments on commit fe33c12

Please sign in to comment.