From 11c58adff6c35b028e6eaa8cbb2de7c725958f30 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Tue, 24 Jul 2018 14:42:34 +0300 Subject: uart Receive Timeout handling. --- .../Embedded/Communication/CommunicationTask.c | 2 +- .../Embedded/Communication/Connection.c | 2 +- .../Embedded_SW/Embedded/Drivers/Uart_Comm/Uart.c | 24 +++++++++++++++++----- Software/Embedded_SW/Embedded/Main.c | 3 ++- .../Embedded/Modules/AlarmHandling/Diagnostics.c | 21 ++++++++++--------- .../Embedded/StateMachines/Printing/JobSTM.c | 2 +- .../Embedded/StateMachines/Printing/PrintingSTM.h | 2 +- 7 files changed, 36 insertions(+), 20 deletions(-) (limited to 'Software/Embedded_SW') diff --git a/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c b/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c index 8d0f65bbe..ce90617f9 100644 --- a/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c +++ b/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c @@ -146,7 +146,7 @@ int32_t SetCommunicationPath(bool UARTorUSB) * ======== communicationTask ======== * Task for this function is created statically. See the project's .cfg file. * this communication task is created statically in system initialization, in blocking mode - * over one of the chosen ommunication methods (USB or Blutooth). + * over one of the chosen Communication methods (USB or Bluetooth). ******************************************************************************/ void communicationTxTask(UArg arg0, UArg arg1) { diff --git a/Software/Embedded_SW/Embedded/Communication/Connection.c b/Software/Embedded_SW/Embedded/Communication/Connection.c index f7d86cf27..c5bda84d2 100644 --- a/Software/Embedded_SW/Embedded/Communication/Connection.c +++ b/Software/Embedded_SW/Embedded/Communication/Connection.c @@ -64,7 +64,7 @@ void DisconnectionRequest(MessageContainer* requestContainer) ReportStopReporting(); DiagnosticsStop(); HeatingStopReporting(); - JoStopReporting(); + JobStopReporting(); UART_ResetBuffers(); //------------------------------------------------------------------------------------------- uint8_t* container_buffer = malloc(message_container__get_packed_size(&responseContainer)); diff --git a/Software/Embedded_SW/Embedded/Drivers/Uart_Comm/Uart.c b/Software/Embedded_SW/Embedded/Drivers/Uart_Comm/Uart.c index 54346a4e6..11669b632 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Uart_Comm/Uart.c +++ b/Software/Embedded_SW/Embedded/Drivers/Uart_Comm/Uart.c @@ -68,7 +68,7 @@ void UARTIntHandler(UArg arg0); void Init_U0(void) { - ROM_IntMasterDisable(); + //ROM_IntMasterDisable(); UARTStdioConfig(0, U0_BAUDRATE, 120000000); // @@ -76,8 +76,6 @@ void Init_U0(void) // ROM_UARTIntClear(UART0_BASE, ROM_UARTIntStatus(UART0_BASE, false)); - //ROM_UARTIntEnable(UART0_BASE, (UART_INT_OE | UART_INT_BE | UART_INT_PE | - // UART_INT_FE | UART_INT_RT | UART_INT_TX | UART_INT_RX)); //MAP_UARTIntRegister(INT_UART0,UARTIntHandler,0); /* Install interrupt handler */ @@ -90,7 +88,10 @@ void Init_U0(void) System_abort("Can't create UART Hwi"); } - ROM_UARTIntEnable(UART0_BASE, /*UART_INT_TX |*/ UART_INT_RX ); +// ROM_UARTIntEnable(UART0_BASE, /*UART_INT_TX |*/ UART_INT_RX ); + ROM_UARTIntEnable(UART0_BASE, (UART_INT_RT | UART_INT_RX)); +// ROM_UARTIntEnable(UART0_BASE, (UART_INT_OE | UART_INT_BE | UART_INT_PE | +// UART_INT_FE | UART_INT_RT | UART_INT_TX | UART_INT_RX)); ROM_UARTEnable(UART0_BASE); @@ -100,7 +101,7 @@ void Init_U0(void) // ROM_IntEnable(INT_UART0); - ROM_IntMasterEnable(); + //ROM_IntMasterEnable(); } @@ -113,6 +114,13 @@ uint32_t Uart_tx_Counter = 0; uint32_t Uart_rx_Counter = 0; uint32_t Uart_rx_TotalCounter = 0; bool UartResetProcess = false; +//uint32_t uart_INT_OECounter = 0; +//uint32_t uart_INT_BECounter = 0; +//uint32_t uart_INT_PECounter = 0; +//uint32_t uart_INT_FECounter = 0; +uint32_t uart_INT_RTCounter = 0; +uint32_t uart_INT_RXCounter = 0; + //***************************************************************************** // // The UART interrupt handler. @@ -150,6 +158,12 @@ void UARTIntHandler(UArg arg0) // Get the interrrupt status. // ui32Status = ROM_UARTIntStatus(UART0_BASE, true); +// if (ui32Status&UART_INT_OE) uart_INT_OECounter++; +// if (ui32Status&UART_INT_BE) uart_INT_BECounter++; +// if (ui32Status&UART_INT_PE) uart_INT_PECounter++; +// if (ui32Status&UART_INT_FE) uart_INT_FECounter++; + if (ui32Status&UART_INT_RT) uart_INT_RTCounter++; + if (ui32Status&UART_INT_RX) uart_INT_RXCounter++; // // Clear the asserted interrupts. diff --git a/Software/Embedded_SW/Embedded/Main.c b/Software/Embedded_SW/Embedded/Main.c index af5ef1c92..ecddb8f16 100644 --- a/Software/Embedded_SW/Embedded/Main.c +++ b/Software/Embedded_SW/Embedded/Main.c @@ -188,10 +188,11 @@ int main(void) //Test_Write_Flash_Buf(); //----------------------------------------------------------- +#ifndef EVALUATION_BOARD DeActivateAllSSR(); ActivateChiller();//SSR12 - +#endif //EMAC_initEMAC(); ControlInit(); Heaters_Init(); diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/Diagnostics.c index 19fe66611..e67fe68bb 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/Diagnostics.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/Diagnostics.c @@ -123,16 +123,16 @@ void DiagnosticCollection(void) pollermotor[DiagnosticsIndex] = MotorGetSpeed (HARDWARE_MOTOR_TYPE__MOTO_LDRIVING); windermotor[DiagnosticsIndex] = MotorGetSpeed (HARDWARE_MOTOR_TYPE__MOTO_WINDER); screwmotor[DiagnosticsIndex] = MotorGetSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW); - mixertemperature[DiagnosticsIndex] = TemperatureSensorRead(TEMP_SENSE_ANALOG_MIXCHIP_TEMP); - headzone1temperature[DiagnosticsIndex] = TemperatureSensorRead(TEMP_SENSE_ANALOG_DYEINGH_TEMP1); - headzone2temperature[DiagnosticsIndex] = TemperatureSensorRead(TEMP_SENSE_ANALOG_DYEINGH_TEMP2); - headzone3temperature[DiagnosticsIndex] = TemperatureSensorRead(TEMP_SENSE_ANALOG_DYEINGH_TEMP3); - headzone4temperature[DiagnosticsIndex] = TemperatureSensorRead(TEMP_SENSE_ANALOG_DYEINGH_TEMP4); - headzone5temperature[DiagnosticsIndex] = TemperatureSensorRead(TEMP_SENSE_ANALOG_DYEINGH_TEMP5); - headzone6temperature[DiagnosticsIndex] = TemperatureSensorRead(TEMP_SENSE_AN_ENCLOSURETEMP3); - dryerzone1temperature[DiagnosticsIndex] = TemperatureSensorRead(TEMP_SENSE_ANALOG_DRYER_TEMP1); - dryerzone2temperature[DiagnosticsIndex] = TemperatureSensorRead(TEMP_SENSE_ANALOG_DRYER_TEMP2); - dryerzone3temperature[DiagnosticsIndex] = TemperatureSensorRead(TEMP_SENSE_ANALOG_DRYER_TEMP3); + mixertemperature[DiagnosticsIndex] = TemperatureSensorRead(TEMP_SENSE_ANALOG_MIXCHIP_TEMP)/100; + headzone1temperature[DiagnosticsIndex] = TemperatureSensorRead(TEMP_SENSE_ANALOG_DYEINGH_TEMP1)/100; + headzone2temperature[DiagnosticsIndex] = TemperatureSensorRead(TEMP_SENSE_ANALOG_DYEINGH_TEMP2)/100; + headzone3temperature[DiagnosticsIndex] = TemperatureSensorRead(TEMP_SENSE_ANALOG_DYEINGH_TEMP3)/100; + headzone4temperature[DiagnosticsIndex] = TemperatureSensorRead(TEMP_SENSE_ANALOG_DYEINGH_TEMP4)/100; + headzone5temperature[DiagnosticsIndex] = TemperatureSensorRead(TEMP_SENSE_ANALOG_DYEINGH_TEMP5)/100; + headzone6temperature[DiagnosticsIndex] = TemperatureSensorRead(TEMP_SENSE_AN_ENCLOSURETEMP3)/100; + dryerzone1temperature[DiagnosticsIndex] = TemperatureSensorRead(TEMP_SENSE_ANALOG_DRYER_TEMP1)/100; + dryerzone2temperature[DiagnosticsIndex] = TemperatureSensorRead(TEMP_SENSE_ANALOG_DRYER_TEMP2)/100; + dryerzone3temperature[DiagnosticsIndex] = TemperatureSensorRead(TEMP_SENSE_ANALOG_DRYER_TEMP3)/100; for (i=0;i