diff --git a/Src/control.c b/Src/control.c index fb25499..1450cff 100644 --- a/Src/control.c +++ b/Src/control.c @@ -91,7 +91,7 @@ void program_eeprom() { HAL_GPIO_WritePin(GPIOC, GPIO_PIN_4, GPIO_PIN_SET); // Check if the data is written - if (write_counter < 5) { + if (write_counter < 100) { // Select correct device and address select_device(memory_map_0[0]); write_address(address_counter); @@ -121,9 +121,9 @@ void program_eeprom() { send_rd(0); printf("Progress: %i/%i\r", address_counter, control.eeprom.length); - } else if (read_counter > 2000) { + } else if (read_counter > 4000) { // In case we failed, try again - printf("Trying again!\n\r"); + printf("Trying again! %x != %x (%i)\n\r", d, control.eeprom.data[address_counter], address_counter); read_counter = 0; write_counter = 0; send_rd(0); @@ -260,7 +260,9 @@ void handle_ioreq() { void cycle() { // Make sure data get reset as input - enable_data_out(0); + if (!control.eeprom.programming) { + enable_data_out(0); + } // We need this not detect IO multiple times static uint8_t had_ioreq = 0;