diff --git a/boot_loader/bl_config.h b/boot_loader/bl_config.h index 193d0bb1..95b1eca2 100644 --- a/boot_loader/bl_config.h +++ b/boot_loader/bl_config.h @@ -359,7 +359,7 @@ // Requires: UARTx_BASE // //***************************************************************************** -#define UART_CLOCK_ENABLE SYSCTL_RCGCUART_R4 +#define UART_CLOCK_ENABLE SYSCTL_RCGCUART_R1 //***************************************************************************** // @@ -370,7 +370,7 @@ // Requires: UART_CLOCK_ENABLE // //***************************************************************************** -#define UARTx_BASE UART4_BASE +#define UARTx_BASE UART1_BASE //***************************************************************************** // @@ -381,7 +381,7 @@ // Requires: UART_RXPIN_BASE, UART_RXPIN_PCTL and UART_RXPIN_POS // //***************************************************************************** -#define UART_RXPIN_CLOCK_ENABLE SYSCTL_RCGCGPIO_R4 +#define UART_RXPIN_CLOCK_ENABLE SYSCTL_RCGCGPIO_R0 //***************************************************************************** // @@ -414,7 +414,7 @@ // Requires: UART_RXPIN_CLOCK_ENABLE, UART_RXPIN_BASE and UART_RXPIN_PCTL // //***************************************************************************** -#define UART_RXPIN_POS 2 +#define UART_RXPIN_POS 0 //***************************************************************************** // @@ -425,7 +425,7 @@ // Requires: UART_TXPIN_BASE, UART_TXPIN_PCTL and UART_TXPIN_POS // //***************************************************************************** -#define UART_TXPIN_CLOCK_ENABLE SYSCTL_RCGCGPIO_R4 +#define UART_TXPIN_CLOCK_ENABLE SYSCTL_RCGCGPIO_R0 //***************************************************************************** // @@ -458,7 +458,7 @@ // Requires: UART_TXPIN_CLOCK_ENABLE, UART_TXPIN_BASE and UART_TXPIN_PCTL // //***************************************************************************** -#define UART_TXPIN_POS 3 +#define UART_TXPIN_POS 1 //***************************************************************************** // diff --git a/projects/cm_mcu/CommandLineTask.c b/projects/cm_mcu/CommandLineTask.c index d69037c2..cb0f0ddd 100644 --- a/projects/cm_mcu/CommandLineTask.c +++ b/projects/cm_mcu/CommandLineTask.c @@ -511,8 +511,14 @@ static BaseType_t mon_ctl(char *m, size_t s, const char *mm) dcdc_args.n_commands-1); return pdFALSE; } - + // update times, in seconds + TickType_t now = pdTICKS_TO_MS( xTaskGetTickCount())/1000; + TickType_t last = pdTICKS_TO_MS(dcdc_args.updateTick)/1000; int copied = 0; + if ( (now-last) > 60 ) { + int mins = (now-last)/60; + copied += snprintf(m+copied, s-copied, "%s: stale data, last update %d minutes ago\r\n", __func__, mins); + } copied += snprintf(m+copied, s-copied, "%s\r\n", dcdc_args.commands[i1].name); for (int ps = 0; ps < dcdc_args.n_devices; ++ps) { copied += snprintf(m+copied, s-copied, "SUPPLY %s\r\n", @@ -621,6 +627,17 @@ static BaseType_t ff_ctl(char *m, size_t s, const char *mm) int copied = 0; static int whichff = 0; + if ( whichff == 0 ) { + // check for stale data + TickType_t now = pdTICKS_TO_MS( xTaskGetTickCount())/1000; + TickType_t last = pdTICKS_TO_MS(getFFupdateTick())/1000; + if ( (now-last) > 60 ) { + int mins = (now-last)/60; + copied += snprintf(m+copied, s-copied, "%s: stale data, last update %d minutes ago\r\n", __func__, mins); + } + + } + if ( argc == 0 ) { // default command: temps if ( whichff == 0 ) { @@ -696,6 +713,13 @@ static BaseType_t fpga_ctl(char *m, size_t s, const char *mm) static int whichfpga = 0; int howmany = fpga_args.n_devices*fpga_args.n_pages; if ( whichfpga == 0 ) { + TickType_t now = pdTICKS_TO_MS( xTaskGetTickCount())/1000; + TickType_t last = pdTICKS_TO_MS(getFFupdateTick())/1000; + if ( (now-last) > 60 ) { + int mins = (now-last)/60; + copied += snprintf(m+copied, s-copied, "%s: stale data, last update %d minutes ago\r\n", __func__, mins); + } + copied += snprintf(m+copied, s-copied, "FPGA monitors\r\n"); copied += snprintf(m+copied, s-copied, "%s\r\n", fpga_args.commands[0].name); } diff --git a/projects/cm_mcu/FireFlyTask.c b/projects/cm_mcu/FireFlyTask.c index 01a1d3fc..03ae373a 100644 --- a/projects/cm_mcu/FireFlyTask.c +++ b/projects/cm_mcu/FireFlyTask.c @@ -125,6 +125,12 @@ int8_t getFFvalue(const uint8_t i) return ff_temp[i]; } +static TickType_t ff_updateTick = 0; +TickType_t getFFupdateTick() +{ + return ff_updateTick; +} + static int write_ff_register(const char *name, uint8_t reg, uint16_t value, int size) { @@ -300,7 +306,7 @@ void FireFlyTask(void *parameters) break; } } - + ff_updateTick = xTaskGetTickCount(); // select the appropriate output for the mux data[0] = 0x1U << ff_i2c_addrs[ff].mux_bit; char tmp[64]; diff --git a/projects/cm_mcu/FreeRTOSConfig.h b/projects/cm_mcu/FreeRTOSConfig.h index fd7ae7ee..64026764 100644 --- a/projects/cm_mcu/FreeRTOSConfig.h +++ b/projects/cm_mcu/FreeRTOSConfig.h @@ -137,6 +137,7 @@ header file. */ #define CLI_UART UART4_BASE // Front panel //#define CLI_UART UART1_BASE // Zynq +#define pdTICKS_TO_MS( xTicks ) ( ( ( TickType_t ) ( xTicks ) * 1000u ) / configTICK_RATE_HZ ) #ifdef __cplusplus } diff --git a/projects/cm_mcu/MonitorTask.c b/projects/cm_mcu/MonitorTask.c index 4eae6add..5b6c0d38 100644 --- a/projects/cm_mcu/MonitorTask.c +++ b/projects/cm_mcu/MonitorTask.c @@ -85,6 +85,7 @@ void MonitorTask(void *parameters) bool log = true; int current_error_cnt = 0; + args->updateTick = xLastWakeTime; // initial value for (;;) { // check if the 3.3V is there or not. If it disappears then nothing works @@ -105,6 +106,7 @@ void MonitorTask(void *parameters) else { good = true; } + args->updateTick = xTaskGetTickCount(); // current time in ticks // loop over devices for ( uint8_t ps = 0; ps < args->n_devices; ++ ps ) { if ( getPSStatus(5) != PWR_ON) diff --git a/projects/cm_mcu/MonitorTask.h b/projects/cm_mcu/MonitorTask.h index 74ff6869..31cba583 100644 --- a/projects/cm_mcu/MonitorTask.h +++ b/projects/cm_mcu/MonitorTask.h @@ -44,6 +44,7 @@ struct MonitorTaskArgs_t { const int n_pages; tSMBus *smbus; volatile tSMBusStatus *smbus_status; + volatile TickType_t updateTick; }; // DC-DC converter #define NSUPPLIES_PS (5) // 5 devices, 2 pages each diff --git a/projects/cm_mcu/Tasks.h b/projects/cm_mcu/Tasks.h index 0c189650..d1573952 100644 --- a/projects/cm_mcu/Tasks.h +++ b/projects/cm_mcu/Tasks.h @@ -58,6 +58,8 @@ extern QueueHandle_t xFFlyQueue; const char* getFFname(const uint8_t i); int8_t getFFvalue(const uint8_t i); +TickType_t getFFupdateTick(); + int disable_xcvr_cdr(const char *name);