From 58d9d3646b7dbf49ec7de8899ad7036d292c4e0c Mon Sep 17 00:00:00 2001 From: Gustavo de Souza dos Reis Date: Fri, 5 Jan 2024 12:44:05 -0300 Subject: [PATCH] Check if the clock configuration is successfully applied before FPGA_ON --- port/board/afc-v4/payload.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/port/board/afc-v4/payload.c b/port/board/afc-v4/payload.c index 7abac602a..e18772865 100644 --- a/port/board/afc-v4/payload.c +++ b/port/board/afc-v4/payload.c @@ -345,10 +345,10 @@ void vTaskPayload( void *pvParameters ) */ if (state == PAYLOAD_QUIESCED) { - QUIESCED_req = 0; - } else { - QUIESCED_req = 1; - } + QUIESCED_req = 0; + } else { + QUIESCED_req = 1; + } xEventGroupClearBits( amc_payload_evt, PAYLOAD_MESSAGE_QUIESCE ); } @@ -413,8 +413,10 @@ void vTaskPayload( void *pvParameters ) case PAYLOAD_STATE_FPGA_SETUP: /* Configure the clock switch according to the configuration saved in EEPROM*/ eeprom_24xx02_read(CHIP_ID_RTC_EEPROM, 0x0, clock_config, 16, 10); - clock_switch_write_reg(clock_config); - new_state = PAYLOAD_FPGA_ON; + /* Only change the state if the clock config is efective*/ + if (clock_switch_write_reg(clock_config)) { + new_state = PAYLOAD_FPGA_ON; + } break; case PAYLOAD_FPGA_ON: