Index: firmware/.launches/DG.launch =================================================================== diff -u -re66245baae86e539e8470aa9739a99a2146d5f17 -r439894cb0508e69af3ece09ae57a62feac09e3f2 --- firmware/.launches/DG.launch (.../DG.launch) (revision e66245baae86e539e8470aa9739a99a2146d5f17) +++ firmware/.launches/DG.launch (.../DG.launch) (revision 439894cb0508e69af3ece09ae57a62feac09e3f2) @@ -1,6 +1,6 @@ - + Index: firmware/App/DGCommon.h =================================================================== diff -u -r2b5a19425bbae7d18a7afb5b006dcaaa401dc50f -r439894cb0508e69af3ece09ae57a62feac09e3f2 --- firmware/App/DGCommon.h (.../DGCommon.h) (revision 2b5a19425bbae7d18a7afb5b006dcaaa401dc50f) +++ firmware/App/DGCommon.h (.../DGCommon.h) (revision 439894cb0508e69af3ece09ae57a62feac09e3f2) @@ -25,20 +25,21 @@ #define DG_VERSION_MAJOR 0 #define DG_VERSION_MINOR 4 #define DG_VERSION_MICRO 5 -#define DG_VERSION_BUILD 3 +#define DG_VERSION_BUILD 0 // ********** build switches ********** #ifndef _RELEASE_ #ifndef _VECTORCAST_ // #define RM46_EVAL_BOARD_TARGET 1 // #define SIMULATE_UI 1 +// #define TASK_TIMING_OUTPUT_ENABLED 1 // re-purposes alarm lamp pins for task timing // #define CAN_TEST 1 // #define BETA_V1_BUILD 1 // #define DISABLE_HEATERS_AND_TEMPS 1 // #define ENABLE_DIP_SWITCHES 1 // #define EMC_TEST_BUILD 1 - #define ALARMS_DEBUG 1 + #define ALARMS_DEBUG 1 // #define HEATERS_DEBUG 1 // #define PRESSURES_DEBUG 1 #include Index: firmware/App/Services/AlarmMgmt.c =================================================================== diff -u -ra7bf3ca23ea37a61000379facae628a31b3ecc59 -r439894cb0508e69af3ece09ae57a62feac09e3f2 --- firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision a7bf3ca23ea37a61000379facae628a31b3ecc59) +++ firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 439894cb0508e69af3ece09ae57a62feac09e3f2) @@ -127,12 +127,14 @@ } activateAlarm( alarm ); #ifdef DEBUG_ENABLED -#ifdef ALARMS_DEBUG +#ifdef ALARMS_DEBUG + if ( FALSE == alarmIsActive[ alarm ].data ) { // TODO - temporary debug code - remove later char debugStr[ 256 ]; - sprintf( debugStr, "ALARM triggered:%5d \n", alarm ); + sprintf( debugStr, "ALARM trig:%5d \n", alarm ); sendDebugData( (U08*)debugStr, strlen(debugStr) ); + sendDebugDataToUI( (U08*)debugStr ); } #endif #endif @@ -159,12 +161,14 @@ } activateAlarm( alarm ); #ifdef DEBUG_ENABLED -#ifdef ALARMS_DEBUG +#ifdef ALARMS_DEBUG + if ( FALSE == alarmIsActive[ alarm ].data ) { // TODO - temporary debug code - remove later char debugStr[ 256 ]; - sprintf( debugStr, "ALARM triggered:%5d %8X \n", alarm, alarmData.data.uInt.data ); + sprintf( debugStr, "ALARM trig:%5d %8X \n", alarm, alarmData.data.uInt.data ); sendDebugData( (U08*)debugStr, strlen(debugStr) ); + sendDebugDataToUI( (U08*)debugStr ); } #endif #endif @@ -193,11 +197,13 @@ activateAlarm( alarm ); #ifdef DEBUG_ENABLED #ifdef ALARMS_DEBUG + if ( FALSE == alarmIsActive[ alarm ].data ) { // TODO - temporary debug code - remove later char debugStr[ 256 ]; - sprintf( debugStr, "ALARM triggered:%5d %8X %8X \n", alarm, alarmData1.data.uInt.data, alarmData2.data.uInt.data ); + sprintf( debugStr, "ALARM trig:%5d %8X %8X \n", alarm, alarmData1.data.uInt.data, alarmData2.data.uInt.data ); sendDebugData( (U08*)debugStr, strlen(debugStr) ); + sendDebugDataToUI( (U08*)debugStr ); } #endif #endif @@ -225,11 +231,13 @@ alarmIsActive[ alarm ].data = FALSE; #ifdef DEBUG_ENABLED #ifdef ALARMS_DEBUG + if ( FALSE == alarmIsActive[ alarm ].data ) { // TODO - temporary debug code - remove later char debugStr[ 256 ]; sprintf( debugStr, "ALARM cleared:%5d \n", alarm ); sendDebugData( (U08*)debugStr, strlen(debugStr) ); + sendDebugDataToUI( (U08*)debugStr ); } #endif #endif Index: firmware/App/Services/CommBuffers.c =================================================================== diff -u -ra7bf3ca23ea37a61000379facae628a31b3ecc59 -r439894cb0508e69af3ece09ae57a62feac09e3f2 --- firmware/App/Services/CommBuffers.c (.../CommBuffers.c) (revision a7bf3ca23ea37a61000379facae628a31b3ecc59) +++ firmware/App/Services/CommBuffers.c (.../CommBuffers.c) (revision 439894cb0508e69af3ece09ae57a62feac09e3f2) @@ -139,6 +139,12 @@ } else // buffer too full to add this much data { +#ifdef DEBUG_ENABLED + char debugStr[50]; + sprintf( debugStr, "Buffer Overflow: #%3d, %3d bytes, %02X %02X %02X %02X %02X %02X %02X %02X \n", buffer, len, data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7] ); + sendDebugData( (U08*)debugStr, strlen(debugStr) ); + sendDebugDataToUI( (U08*)debugStr ); +#endif bufferFull = TRUE; clearBuffer( buffer ); } @@ -161,14 +167,6 @@ { firstBufferOverflowTimeStamp = getMSTimerCount(); } -#ifdef DEBUG_ENABLED - { - // TODO - temporary debug code - remove later - char debugStr[ 256 ]; - sprintf( debugStr, "Comm Buffer Overflow:%5d \n", (U32)buffer ); - sendDebugData( (U08*)debugStr, strlen(debugStr) ); - } -#endif } else { // if good for persistence time period, reset persistence check Index: firmware/App/Services/CommBuffers.h =================================================================== diff -u -ra7bf3ca23ea37a61000379facae628a31b3ecc59 -r439894cb0508e69af3ece09ae57a62feac09e3f2 --- firmware/App/Services/CommBuffers.h (.../CommBuffers.h) (revision a7bf3ca23ea37a61000379facae628a31b3ecc59) +++ firmware/App/Services/CommBuffers.h (.../CommBuffers.h) (revision 439894cb0508e69af3ece09ae57a62feac09e3f2) @@ -34,7 +34,8 @@ COMM_BUFFER_OUT_CAN_DG_BROADCAST, COMM_BUFFER_IN_CAN_UI_BROADCAST, COMM_BUFFER_IN_CAN_PC, - COMM_BUFFER_OUT_CAN_PC, + COMM_BUFFER_OUT_CAN_PC, + COMM_BUFFER_OUT_CAN_DG_2_UI, #ifdef DEBUG_ENABLED COMM_BUFFER_IN_UART_PC, COMM_BUFFER_OUT_UART_PC, Index: firmware/App/Services/FPGA.c =================================================================== diff -u -ra7bf3ca23ea37a61000379facae628a31b3ecc59 -r439894cb0508e69af3ece09ae57a62feac09e3f2 --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision a7bf3ca23ea37a61000379facae628a31b3ecc59) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision 439894cb0508e69af3ece09ae57a62feac09e3f2) @@ -76,7 +76,9 @@ typedef struct { U08 fpgaId; ///< Reg 0. FPGA ID code. Checked against expected value at power up to verify basic FPGA communication and operation. - U08 fpgaRev; ///< Reg 1. FPGA revision being reported. + U08 fpgaRev; ///< Reg 1. FPGA revision being reported. + U08 fpgaRevLab; ///< Reg 2. FPGA lab rev number. + U08 fpgaRevMajor; ///< Reg 3. FPGA minor rev number. } FPGA_HEADER_T; // read only on FPGA typedef struct // TODO - add all sensor readings to this structure per FPGA register map @@ -974,23 +976,24 @@ return fpgaHeader.fpgaRev; } +/*********************************************************************//** + * @brief + * The getFPGAVersions function gets the fpga version numbers. + * @details + * Inputs : fpgaHeader + * Outputs : none + * @return none + *************************************************************************/ +void getFPGAVersions( U08 *Id, U08 *Maj, U08 *Min, U08 *Lab ) +{ + *Id = fpgaHeader.fpgaId; + *Maj = fpgaHeader.fpgaRev; + *Min = fpgaHeader.fpgaRevMajor; + *Lab = fpgaHeader.fpgaRevLab; +} + /*********************************************************************//** * @brief - * The getFPGAStatus function gets the version read from the diagnostic register \n - * of the FPGA. - * @details - * Inputs : fpgaHeader - * Outputs : none - * @param none - * @return fpgaHeader.fpgaStatus - *************************************************************************/ -U16 getFPGAStatus( void ) -{ - return 0;//fpgaSensorReadings.fpgaStatus; -} - -/*********************************************************************//** - * @brief * The getFPGALoadCellA1 function gets the latest load cell A 1 reading. * @details * Inputs : fpgaSensorReadings Index: firmware/App/Services/FPGA.h =================================================================== diff -u -ra7bf3ca23ea37a61000379facae628a31b3ecc59 -r439894cb0508e69af3ece09ae57a62feac09e3f2 --- firmware/App/Services/FPGA.h (.../FPGA.h) (revision a7bf3ca23ea37a61000379facae628a31b3ecc59) +++ firmware/App/Services/FPGA.h (.../FPGA.h) (revision 439894cb0508e69af3ece09ae57a62feac09e3f2) @@ -36,7 +36,7 @@ void setFPGAValveStates( U16 valveStates ); void setFPGADrainPumpSpeed( U08 drainPumpDAC ); -U16 getFPGAStatus( void ); +void getFPGAVersions( U08 *Id, U08 *Maj, U08 *Min, U08 *Lab ); U16 getFPGAValveStates( void ); U16 getFPGAROPumpFlowRate( void ); U16 getFPGADrainPumpSpeed( void ); Index: firmware/App/Services/Interrupts.c =================================================================== diff -u -ra7bf3ca23ea37a61000379facae628a31b3ecc59 -r439894cb0508e69af3ece09ae57a62feac09e3f2 --- firmware/App/Services/Interrupts.c (.../Interrupts.c) (revision a7bf3ca23ea37a61000379facae628a31b3ecc59) +++ firmware/App/Services/Interrupts.c (.../Interrupts.c) (revision 439894cb0508e69af3ece09ae57a62feac09e3f2) @@ -105,36 +105,36 @@ { can1ParityCnt++; #ifdef DEBUG_ENABLED - // TODO - temporary debug code - remove later - sprintf( debugStr, "CAN parity error:%5d \n", can1ParityCnt ); - sendDebugData( (U08*)debugStr, strlen(debugStr) ); + sprintf( debugStr, "CAN parity error:%5d \n", can1ParityCnt ); + sendDebugData( (U08*)debugStr, strlen(debugStr) ); + sendDebugDataToUI( (U08*)debugStr ); #endif } else if ( notification & canLEVEL_BUS_OFF ) { can1BusOffCnt++; #ifdef DEBUG_ENABLED - // TODO - temporary debug code - remove later - sprintf( debugStr, "CAN bus off error:%5d \n", can1BusOffCnt ); - sendDebugData( (U08*)debugStr, strlen(debugStr) ); + sprintf( debugStr, "CAN bus off error:%5d \n", can1BusOffCnt ); + sendDebugData( (U08*)debugStr, strlen(debugStr) ); + sendDebugDataToUI( (U08*)debugStr ); #endif } else if ( notification & canLEVEL_WARNING ) { can1WarningCnt++; #ifdef DEBUG_ENABLED - // TODO - temporary debug code - remove later - sprintf( debugStr, "CAN bus warning:%5d \n", can1WarningCnt ); - sendDebugData( (U08*)debugStr, strlen(debugStr) ); + sprintf( debugStr, "CAN bus warning:%5d \n", can1WarningCnt ); + sendDebugData( (U08*)debugStr, strlen(debugStr) ); + sendDebugDataToUI( (U08*)debugStr ); #endif } else if ( notification & canLEVEL_PASSIVE ) { can1PassiveCnt++; #ifdef DEBUG_ENABLED - // TODO - temporary debug code - remove later - sprintf( debugStr, "CAN passive warning:%5d \n", can1PassiveCnt ); - sendDebugData( (U08*)debugStr, strlen(debugStr) ); + sprintf( debugStr, "CAN passive warning:%5d \n", can1PassiveCnt ); + sendDebugData( (U08*)debugStr, strlen(debugStr) ); + sendDebugDataToUI( (U08*)debugStr ); #endif } else @@ -170,9 +170,9 @@ clearSCI2CommErrors(); // TODO - try to do something to recover (+ max retries = comm fault) #ifdef DEBUG_ENABLED - // TODO - temporary debug code - remove later - sprintf( debugStr, "FPGA UART frame error:%5d \n", sci2FrameErrorCnt ); + sprintf( debugStr, "FPGA UART FR err:%5d \n", sci2FrameErrorCnt ); sendDebugData( (U08*)debugStr, strlen(debugStr) ); + sendDebugDataToUI( (U08*)debugStr ); #endif } if ( ( flags & SCI_OE_INT ) != 0 ) @@ -181,9 +181,9 @@ clearSCI2CommErrors(); // TODO - try to do something to recover (+ max retries = comm fault) #ifdef DEBUG_ENABLED - // TODO - temporary debug code - remove later - sprintf( debugStr, "FPGA UART overrun error:%5d \n", sci2OverrunErrorCnt ); + sprintf( debugStr, "FPGA UART OR err:%5d \n", sci2OverrunErrorCnt ); sendDebugData( (U08*)debugStr, strlen(debugStr) ); + sendDebugDataToUI( (U08*)debugStr ); #endif } } @@ -195,18 +195,18 @@ sci1FrameErrorCnt++; clearSCI1CommErrors(); // TODO - try to do something to recover (+ max retries = comm fault) - // TODO - temporary debug code - remove later - sprintf( debugStr, "Debug UART frame error:%5d \n", sci1FrameErrorCnt ); + sprintf( debugStr, "Debug UART FR err:%5d \n", sci1FrameErrorCnt ); sendDebugData( (U08*)debugStr, strlen(debugStr) ); + sendDebugDataToUI( (U08*)debugStr ); } if ( ( flags & SCI_OE_INT ) != 0 ) { sci1OverrunErrorCnt++; clearSCI1CommErrors(); // TODO - try to do something to recover (+ max retries = comm fault) - // TODO - temporary debug code - remove later - sprintf( debugStr, "Debug UART overrun error:%5d \n", sci1OverrunErrorCnt ); + sprintf( debugStr, "Debug UART OR err:%5d \n", sci1OverrunErrorCnt ); sendDebugData( (U08*)debugStr, strlen(debugStr) ); + sendDebugDataToUI( (U08*)debugStr ); } } #endif Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -ra7bf3ca23ea37a61000379facae628a31b3ecc59 -r439894cb0508e69af3ece09ae57a62feac09e3f2 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision a7bf3ca23ea37a61000379facae628a31b3ecc59) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 439894cb0508e69af3ece09ae57a62feac09e3f2) @@ -30,7 +30,7 @@ // ********** private definitions ********** -#define NUM_OF_CAN_OUT_BUFFERS 4 // # of CAN buffers for transmit +#define NUM_OF_CAN_OUT_BUFFERS 5 // # of CAN buffers for transmit #define NUM_OF_CAN_IN_BUFFERS 6 // # of CAN buffers for receiving #ifndef DEBUG_ENABLED #define NUM_OF_MSG_IN_BUFFERS 6 // # of Msg buffers for receiving @@ -72,8 +72,9 @@ { COMM_BUFFER_OUT_CAN_DG_ALARM, COMM_BUFFER_OUT_CAN_DG_2_HD, - COMM_BUFFER_OUT_CAN_DG_BROADCAST, - COMM_BUFFER_OUT_CAN_PC + COMM_BUFFER_OUT_CAN_DG_BROADCAST, + COMM_BUFFER_OUT_CAN_PC, + COMM_BUFFER_OUT_CAN_DG_2_UI }; const COMM_BUFFER_T MSG_IN_BUFFERS[ NUM_OF_MSG_IN_BUFFERS ] = Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -ra7bf3ca23ea37a61000379facae628a31b3ecc59 -r439894cb0508e69af3ece09ae57a62feac09e3f2 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision a7bf3ca23ea37a61000379facae628a31b3ecc59) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 439894cb0508e69af3ece09ae57a62feac09e3f2) @@ -17,7 +17,8 @@ #include // for memcpy() -#include "DrainPump.h" +#include "DrainPump.h" +#include "FPGA.h" #include "Heaters.h" #include "LoadCell.h" #include "MsgQueues.h" @@ -41,6 +42,10 @@ #define ACK_REQUIRED TRUE #define ACK_NOT_REQUIRED FALSE +#ifdef DEBUG_ENABLED + #define DEBUG_EVENT_MAX_TEXT_LEN 40 +#endif + #pragma pack(push,1) typedef struct @@ -52,6 +57,18 @@ U16 alarmsFlags; // bit flags: 1 = true, 0 = false for each bit } ALARM_COMP_STATUS_PAYLOAD_T; +typedef struct +{ + U08 major; + U08 minor; + U08 micro; + U16 build; + U08 fpgaId; + U08 fpgaMajor; + U08 fpgaMinor; + U08 fpgaLab; +} DG_VERSIONS_T; + typedef struct { U32 treatmentTimePrescribedinSec; @@ -719,25 +736,24 @@ void handleFWVersionCmd( MESSAGE_T *message ) { MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - U08 major = (U08)DG_VERSION_MAJOR; - U08 minor = (U08)DG_VERSION_MINOR; - U08 micro = (U08)DG_VERSION_MICRO; - U16 build = (U16)DG_VERSION_BUILD; - - // create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_VERSION; - msg.hdr.payloadLen = sizeof( U08 ) + sizeof( U08 ) + sizeof( U08 ) + sizeof( U16 ); - - memcpy( payloadPtr, &major, sizeof( U08 ) ); - payloadPtr += sizeof( U08 ); - memcpy( payloadPtr, &minor, sizeof( U08 ) ); - payloadPtr += sizeof( U08 ); - memcpy( payloadPtr, µ, sizeof( U08 ) ); - payloadPtr += sizeof( U08 ); - memcpy( payloadPtr, &build, sizeof( U16 ) ); - + DG_VERSIONS_T payload; + U08 *payloadPtr = msg.payload; + + // populate payload + payload.major = (U08)DG_VERSION_MAJOR; + payload.minor = (U08)DG_VERSION_MINOR; + payload.micro = (U08)DG_VERSION_MICRO; + payload.build = (U16)DG_VERSION_BUILD; + getFPGAVersions( &payload.fpgaId, &payload.fpgaMajor, &payload.fpgaMinor, &payload.fpgaLab ); + + // create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_VERSION; + msg.hdr.payloadLen = sizeof( DG_VERSIONS_T ); + + // fill message payload + memcpy( payloadPtr, &payload, sizeof( DG_VERSIONS_T ) ); + // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_BROADCAST, ACK_NOT_REQUIRED ); } @@ -972,26 +988,54 @@ *************************************************************************/ -/************************************************************************* - * @brief sendDebugData - * The sendDebugData function sends debug data out to the PC port. - * @details - * Inputs : none - * Outputs : PC serial port - * @param dbgData : Pointer to debug data - * @param len : # of bytes of debug data - * @return TRUE if debug data was successfully queued for transmit, FALSE if not - *************************************************************************/ -#ifdef DEBUG_ENABLED -BOOL sendDebugData( U08 *dbgData, U32 len ) -{ - BOOL result; +#ifdef DEBUG_ENABLED + /************************************************************************* + * @brief sendDebugData + * The sendDebugData function sends debug data out to the PC port. + * @details + * Inputs : none + * Outputs : PC serial port + * @param dbgData : Pointer to debug data + * @param len : # of bytes of debug data + * @return TRUE if debug data was successfully queued for transmit, FALSE if not + *************************************************************************/ + BOOL sendDebugData( U08 *dbgData, U32 len ) + { + BOOL result; - // add serialized message data to appropriate comm buffer - result = addToCommBuffer( COMM_BUFFER_OUT_UART_PC, dbgData, len ); + // add serialized message data to appropriate comm buffer + result = addToCommBuffer( COMM_BUFFER_OUT_UART_PC, dbgData, len ); - return result; -} + return result; + } + + /************************************************************************* + * @brief + * The sendDebugDataToUI function sends debug string to the UI for logging. + * @details + * Inputs : none + * Outputs : Message constructed and queued for transmit + * @param str : Pointer to debug string + * @return none + *************************************************************************/ + void sendDebugDataToUI( U08 *str ) + { + MESSAGE_T msg; + U32 txtLen = strlen( (char*)str ); + U08 *payloadPtr = msg.payload; + + // create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_DEBUG_EVENT; + msg.hdr.payloadLen = DEBUG_EVENT_MAX_TEXT_LEN + 1; // add 1 byte for null terminator + if ( txtLen <= DEBUG_EVENT_MAX_TEXT_LEN ) + { + memcpy( payloadPtr, str, txtLen + 1 ); + + // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_2_UI, ACK_NOT_REQUIRED ); + } + } #endif /************************************************************************* Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -ra7bf3ca23ea37a61000379facae628a31b3ecc59 -r439894cb0508e69af3ece09ae57a62feac09e3f2 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision a7bf3ca23ea37a61000379facae628a31b3ecc59) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 439894cb0508e69af3ece09ae57a62feac09e3f2) @@ -96,6 +96,9 @@ #ifdef DEBUG_ENABLED // DEBUG OUTPUT BOOL sendDebugData( U08 *dbgData, U32 len ); + +// Debug message to UI for logging +void sendDebugDataToUI( U08 *str ); #endif // MSG_TESTER_LOG_IN Index: firmware/App/Tasks/TaskGeneral.c =================================================================== diff -u -ra7bf3ca23ea37a61000379facae628a31b3ecc59 -r439894cb0508e69af3ece09ae57a62feac09e3f2 --- firmware/App/Tasks/TaskGeneral.c (.../TaskGeneral.c) (revision a7bf3ca23ea37a61000379facae628a31b3ecc59) +++ firmware/App/Tasks/TaskGeneral.c (.../TaskGeneral.c) (revision 439894cb0508e69af3ece09ae57a62feac09e3f2) @@ -27,6 +27,13 @@ #include "SystemCommMessages.h" #include "WatchdogMgmt.h" #include "TaskGeneral.h" + +#ifdef TASK_TIMING_OUTPUT_ENABLED + #include "mibspi.h" + #define TASK_TIMING_TEST_PIN_SPI1_PORT_MASK 0x00000020 // (CS5 - re-purposed as output GPIO) + #define SET_TASK_ON() { mibspiREG3->PC3 |= TASK_TIMING_TEST_PIN_SPI1_PORT_MASK; } + #define SET_TASK_OFF() { mibspiREG3->PC3 &= ~TASK_TIMING_TEST_PIN_SPI1_PORT_MASK; } +#endif /************************************************************************* * @brief taskGeneral @@ -41,6 +48,10 @@ *************************************************************************/ void taskGeneral( void ) { +#ifdef TASK_TIMING_OUTPUT_ENABLED +// SET_TASK_ON(); +#endif + // check in with watchdog manager checkInWithWatchdogMgmt( TASK_GENERAL ); // do this first to keep timing consistent with watchdog management @@ -90,7 +101,8 @@ // manage data to be transmitted to other sub-systems execSystemCommTx(); - // toggle GPIO to indicate general task has executed -// gioToggleBit( gioPORTB, 1 ); +#ifdef TASK_TIMING_OUTPUT_ENABLED +// SET_TASK_OFF(); +#endif } Index: firmware/App/Tasks/TaskPriority.c =================================================================== diff -u -ra7bf3ca23ea37a61000379facae628a31b3ecc59 -r439894cb0508e69af3ece09ae57a62feac09e3f2 --- firmware/App/Tasks/TaskPriority.c (.../TaskPriority.c) (revision a7bf3ca23ea37a61000379facae628a31b3ecc59) +++ firmware/App/Tasks/TaskPriority.c (.../TaskPriority.c) (revision 439894cb0508e69af3ece09ae57a62feac09e3f2) @@ -29,7 +29,14 @@ #include "WatchdogMgmt.h" #include "TemperatureSensors.h" #include "Heaters.h" - + +#ifdef TASK_TIMING_OUTPUT_ENABLED + #include "mibspi.h" + #define TASK_TIMING_TEST_PIN_SPI1_PORT_MASK 0x00000020 // (CS5 - re-purposed as output GPIO) + #define SET_TASK_ON() { mibspiREG3->PC3 |= TASK_TIMING_TEST_PIN_SPI1_PORT_MASK; } + #define SET_TASK_OFF() { mibspiREG3->PC3 &= ~TASK_TIMING_TEST_PIN_SPI1_PORT_MASK; } +#endif + /************************************************************************* * @brief taskPriority * The taskPriority function handles the scheduled Priority Task interrupt. @@ -40,6 +47,10 @@ *************************************************************************/ void taskPriority( void ) { +#ifdef TASK_TIMING_OUTPUT_ENABLED +// SET_TASK_ON(); +#endif + // 1st pass for FPGA execFPGAIn(); @@ -77,7 +88,8 @@ // check in with watchdog manager checkInWithWatchdogMgmt( TASK_PRIORITY ); - // toggle GPIO to indicate priority task has executed - //gioToggleBit( gioPORTB, 3 ); +#ifdef TASK_TIMING_OUTPUT_ENABLED +// SET_TASK_OFF(); +#endif } Index: firmware/App/Tasks/TaskTimer.c =================================================================== diff -u -ra7bf3ca23ea37a61000379facae628a31b3ecc59 -r439894cb0508e69af3ece09ae57a62feac09e3f2 --- firmware/App/Tasks/TaskTimer.c (.../TaskTimer.c) (revision a7bf3ca23ea37a61000379facae628a31b3ecc59) +++ firmware/App/Tasks/TaskTimer.c (.../TaskTimer.c) (revision 439894cb0508e69af3ece09ae57a62feac09e3f2) @@ -32,14 +32,17 @@ *************************************************************************/ void taskTimer( void ) { +#ifdef TASK_TIMING_OUTPUT_ENABLED +#endif + // increment ms timer count incMSTimerCount(); // check in with watchdog manager checkInWithWatchdogMgmt( TASK_TIMER ); - // toggle GPIO to indicate timer task has executed - //gioToggleBit( gioPORTB, 0 ); +#ifdef TASK_TIMING_OUTPUT_ENABLED +#endif } Index: firmware/DG.dil =================================================================== diff -u -r0953a2a6940f9f096fa98cc1e8a5578deab4d8ef -r439894cb0508e69af3ece09ae57a62feac09e3f2 --- firmware/DG.dil (.../DG.dil) (revision 0953a2a6940f9f096fa98cc1e8a5578deab4d8ef) +++ firmware/DG.dil (.../DG.dil) (revision 439894cb0508e69af3ece09ae57a62feac09e3f2) @@ -1,4 +1,4 @@ -# RM46L852PGE 06/14/20 15:30:06 +# RM46L852PGE 07/15/20 18:27:09 # ARCH=RM46L852PGE # @@ -3678,7 +3678,7 @@ DRIVER.CAN.VAR.CAN_3_MESSAGE_9_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_11_BOOL_ENA.VALUE=0 DRIVER.CAN.VAR.CAN_2_MESSAGE_6_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_1_MESSAGE_11_INT_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_1_MESSAGE_11_INT_ENA.VALUE=0x00000800 DRIVER.CAN.VAR.CAN_1_MESSAGE_4_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_3_MESSAGE_62_RTR.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_54_RTR.VALUE=0x00000000 @@ -3981,7 +3981,7 @@ DRIVER.CAN.VAR.CAN_2_MESSAGE_10_INT_LEVEL.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_5_RTR.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_1_INT_LEVEL.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_1_MESSAGE_11_ID.VALUE=11 +DRIVER.CAN.VAR.CAN_1_MESSAGE_11_ID.VALUE=0x070 DRIVER.CAN.VAR.CAN_1_NOMINAL_BIT_TIME.VALUE=9 DRIVER.CAN.VAR.CAN_3_MESSAGE_61_INT_ENA_REF.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_53_INT_ENA_REF.VALUE=0x00000000 @@ -5009,7 +5009,7 @@ DRIVER.CAN.VAR.CAN_3_MESSAGE_7_INT_ENA_REF.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_59_EOB.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_59_DIR.VALUE=0x20000000 -DRIVER.CAN.VAR.CAN_1_MESSAGE_11_INT_ENA_REF.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_1_MESSAGE_11_INT_ENA_REF.VALUE=0x00000001 DRIVER.CAN.VAR.CAN_3_MESSAGE_59_BOOL_ENA.VALUE=0 DRIVER.CAN.VAR.CAN_3_MESSAGE_5_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_3_PIN_MODE.VALUE=0 @@ -5310,7 +5310,7 @@ DRIVER.CAN.VAR.CAN_1_MESSAGE_34_BOOL_ENA.VALUE=0 DRIVER.CAN.VAR.CAN_1_MESSAGE_26_BOOL_ENA.VALUE=0 DRIVER.CAN.VAR.CAN_1_MESSAGE_18_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_1_MESSAGE_11_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_1_MESSAGE_11_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_3_PORT_TX_PDR.VALUE=0 DRIVER.CAN.VAR.CAN_3_MESSAGE_9_INT_LEVEL.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_4_RTR.VALUE=0x00000000 @@ -5325,7 +5325,7 @@ DRIVER.CAN.VAR.CAN_1_MESSAGE_57_INT_ENA_REF.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_49_INT_ENA_REF.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_11_EOB.VALUE=0x00000080 -DRIVER.CAN.VAR.CAN_1_MESSAGE_11_DIR.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_1_MESSAGE_11_DIR.VALUE=0x20000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_20_BOOL_ENA.VALUE=0 DRIVER.CAN.VAR.CAN_2_MESSAGE_12_BOOL_ENA.VALUE=0 DRIVER.CAN.VAR.CAN_2_MESSAGE_7_BOOL_ENA.VALUE=0 @@ -5417,7 +5417,7 @@ DRIVER.CAN.VAR.CAN_2_MESSAGE_17_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_20_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_12_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_1_MESSAGE_11_BOOL_ENA.VALUE=0 +DRIVER.CAN.VAR.CAN_1_MESSAGE_11_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_3_MESSAGE_5_RTR.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_58_INT_LEVEL.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_11_ID.VALUE=11 Index: firmware/source/can.c =================================================================== diff -u -rc4434389fe6c3314c2bba98dc2f4cf737551f637 -r439894cb0508e69af3ece09ae57a62feac09e3f2 --- firmware/source/can.c (.../can.c) (revision c4434389fe6c3314c2bba98dc2f4cf737551f637) +++ firmware/source/can.c (.../can.c) (revision 439894cb0508e69af3ece09ae57a62feac09e3f2) @@ -373,6 +373,25 @@ canREG1->IF2CMD = (uint8) 0xF8U; canREG1->IF2NO = 10U; + /** - Initialize message 11 + * - Wait until IF1 is ready for use + * - Set message mask + * - Set message control word + * - Set message arbitration + * - Set IF1 control byte + * - Set IF1 message number + */ + /*SAFETYMCUSW 28 D MR:NA "Potentially infinite loop found - Hardware Status check for execution sequence" */ + while ((canREG1->IF1STAT & 0x80U) ==0x80U) + { + } /* Wait */ + + canREG1->IF1MSK = 0xC0000000U | (uint32)((uint32)((uint32)0x000007FFU & (uint32)0x000007FFU) << (uint32)18U); + canREG1->IF1ARB = (uint32)0x80000000U | (uint32)0x00000000U | (uint32)0x20000000U | (uint32)((uint32)((uint32)0x070U & (uint32)0x000007FFU) << (uint32)18U); + canREG1->IF1MCTL = 0x00001000U | (uint32)0x00000800U | (uint32)0x00000000U | (uint32)0x00000080U | (uint32)8U; + canREG1->IF1CMD = (uint8) 0xF8U; + canREG1->IF1NO = 11U; + /** - Setup IF1 for data transmission * - Wait until IF1 is ready for use * - Set IF1 control byte