Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -r036a75d76ab01912646a480b935d97187a231a19 -r794a0f21a465227d432a91d7b7fd7d513cfe3ecb --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 036a75d76ab01912646a480b935d97187a231a19) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 794a0f21a465227d432a91d7b7fd7d513cfe3ecb) @@ -135,9 +135,7 @@ static U32 bpControlTimerCounter; ///< Determines when to perform control on blood flow. -static U32 bpRotorRevStartTime; ///< Blood pump rotor rotation start time (in ms). static OVERRIDE_U32_T bloodPumpRotorCounter; ///< Running counter for blood pump rotor revolutions. -static U32 bpRotorSpeedTooFastPulseCount; ///< Counter for rotor pulses indicating RPM > 100. static BOOL bpStopAtHomePosition; ///< Stop blood pump at next home position. static U32 bpHomeStartTime; ///< When did blood pump home command begin? (in ms). @@ -185,7 +183,6 @@ bloodPumpControlMode = PUMP_CONTROL_MODE_CLOSED_LOOP; bpControlTimerCounter = 0; bloodFlowDataPublicationTimerCounter = DATA_PUBLISH_COUNTER_START_COUNT; - bpRotorRevStartTime = 0; bpHomeStartTime = 0; bpStopAtHomePosition = FALSE; @@ -367,46 +364,6 @@ /*********************************************************************//** * @brief - * The signalBloodPumpRotorHallSensor function handles the blood pump rotor - * hall sensor detection. Calculates rotor speed (in RPM). Stops pump if - * there is a pending request to home the pump. - * @details \b Inputs: bpRotorRevStartTime, bpStopAtHomePosition - * @details \b Outputs: bpRotorRevStartTime, bloodPumpRotorSpeedRPM, bloodPumpRotorCounter - * @return none - *************************************************************************/ -void signalBloodPumpRotorHallSensor( void ) -{ - U32 rotTime = getMSTimerCount(); - U32 deltaTime = calcTimeBetween( bpRotorRevStartTime, rotTime ); - F32 rotSpeed = ( 1.0F / (F32)deltaTime ) * (F32)MS_PER_SECOND * (F32)SEC_PER_MIN; // calculate rotor speed indicating by time between this and previous pulse - - // Increment rotor counter - bloodPumpRotorCounter.data++; - - // Count pulses indicating rotor speed too fast - if ( getMeasuredBloodPumpRotorSpeed() > BP_MAX_ROTOR_SPEED_RPM ) - { - bpRotorSpeedTooFastPulseCount++; - } - else - { - bpRotorSpeedTooFastPulseCount = 0; - } - - // Calculate rotor speed (in RPM) - bloodPumpRotorSpeedRPM.data = rotSpeed; - bpRotorRevStartTime = rotTime; - - // If we are supposed to stop pump at home position, stop pump now. - if ( TRUE == bpStopAtHomePosition ) - { - signalBloodPumpHardStop(); - bpStopAtHomePosition = FALSE; - } -} - -/*********************************************************************//** - * @brief * The homeBloodPump function initiates a blood pump home operation. * @details \b Inputs: bloodPumpState * @details \b Outputs: bpStopAtHomePosition, bpHomeStartTime, blood pump started (slow) @@ -510,6 +467,9 @@ // Update pump feedback from FPGA readPeristalticPumps(); + // Update rotor RPM + bloodPumpRotorSpeedRPM.data = getPeristalticPumpMeasRotorSpeed(); + // adcBloodPumpMCSpeedRPM.data = (F32)(SIGN_FROM_12_BIT_VALUE(bpRPM)) * BP_SPEED_ADC_TO_RPM_FACTOR; // adcBloodPumpMCCurrentmA.data = (F32)(SIGN_FROM_12_BIT_VALUE(bpmA)) * BP_CURRENT_ADC_TO_MA_FACTOR; Index: firmware/App/Controllers/BloodFlow.h =================================================================== diff -u -raa6d45143096dfab776ce2ed7c775cfe2dd6db18 -r794a0f21a465227d432a91d7b7fd7d513cfe3ecb --- firmware/App/Controllers/BloodFlow.h (.../BloodFlow.h) (revision aa6d45143096dfab776ce2ed7c775cfe2dd6db18) +++ firmware/App/Controllers/BloodFlow.h (.../BloodFlow.h) (revision 794a0f21a465227d432a91d7b7fd7d513cfe3ecb) @@ -60,7 +60,6 @@ BOOL setBloodPumpTargetFlowRate( U32 flowRate, MOTOR_DIR_T dir, PUMP_CONTROL_MODE_T mode ); BOOL setBloodPumpTargetRPM( U32 rpm, MOTOR_DIR_T dir ); void signalBloodPumpHardStop( void ); -void signalBloodPumpRotorHallSensor( void ); BOOL homeBloodPump( void ); BOOL isBloodPumpRunning( void ); BOOL isBloodPumpRampComplete( void ); Index: firmware/App/Services/AlarmMgmtSWFaults.h =================================================================== diff -u -raa6d45143096dfab776ce2ed7c775cfe2dd6db18 -r794a0f21a465227d432a91d7b7fd7d513cfe3ecb --- firmware/App/Services/AlarmMgmtSWFaults.h (.../AlarmMgmtSWFaults.h) (revision aa6d45143096dfab776ce2ed7c775cfe2dd6db18) +++ firmware/App/Services/AlarmMgmtSWFaults.h (.../AlarmMgmtSWFaults.h) (revision 794a0f21a465227d432a91d7b7fd7d513cfe3ecb) @@ -61,7 +61,7 @@ SW_FAULT_ID_CAN_PARITY_ERROR = 30, SW_FAULT_ID_CAN_OFF_ERROR = 31, SW_FAULT_ID_UNEXPECTED_DMA_INTERRUPT = 32, - SW_FAULT_ID_INTERRUPTS_INVALID_EDGE_DETECTED = 33, + SW_FAULT_ID_AVAILABLE1 = 33, SW_FAULT_ID_MSG_PENDING_ACK_LIST_FULL = 34, SW_FAULT_ID_MSG_QUEUES_ADD_QUEUE_FULL = 35, SW_FAULT_ID_MSG_QUEUES_ADD_INVALID_QUEUE = 36, Index: firmware/App/Services/Interrupts.c =================================================================== diff -u -r380b0afc95467d0861ff3aa2cdcde5d5d7ac85e7 -r794a0f21a465227d432a91d7b7fd7d513cfe3ecb --- firmware/App/Services/Interrupts.c (.../Interrupts.c) (revision 380b0afc95467d0861ff3aa2cdcde5d5d7ac85e7) +++ firmware/App/Services/Interrupts.c (.../Interrupts.c) (revision 794a0f21a465227d432a91d7b7fd7d513cfe3ecb) @@ -41,10 +41,6 @@ #define MAX_COMM_ERRORS 5 ///< Maximum number of a given comm error for a given time window. #define COMM_ERROR_TIME_WINDOW_MS (10 * SEC_PER_MIN * MS_PER_SECOND) ///< Time window for comm error counts. -#define HET1_EDGE_BP_ROTOR_HALL_SENSOR 0 ///< HET1 edge detector associated with blood pump rotor hall sensor. -#define HET1_EDGE_DPO_ROTOR_HALL_SENSOR 1 ///< HET1 edge detector associated with dialysate outlet pump rotor hall sensor. -#define HET1_EDGE_DPI_ROTOR_HALL_SENSOR 2 ///< HET1 edge detector associated with dialysate inlet pump rotor hall sensor. - // ********** private data ********** static BOOL sci2FEOEError = FALSE; ///< FPGA serial frame or overrun flag; @@ -248,33 +244,6 @@ /*********************************************************************//** * @brief - * The edgeNotification function handles hall sensor interrupts. - * @details \b Alarm: ALARM_ID_TD_SOFTWARE_FAULT if given edge is invalid/unexpected. - * @details \b Inputs: none - * @details \b Outputs: Hall sensor interrupt is handled according given pulse edge. - * @param hetREG HET controller associated with the edge - * @param edge ID of pulse edge that triggered this interrupt - * @return none - *************************************************************************/ -void edgeNotification(hetBASE_t * hetREG, uint32 edge) -{ - if ( hetREG == hetREG1 ) - { - switch ( edge ) - { - case HET1_EDGE_BP_ROTOR_HALL_SENSOR: -// signalBloodPumpRotorHallSensor(); - break; - - default: - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_SOFTWARE_FAULT, SW_FAULT_ID_INTERRUPTS_INVALID_EDGE_DETECTED, edge ) - break; - } - } -} - -/*********************************************************************//** - * @brief * The getSci2FEOEError function returns the sci2FEOEError (OE - Overrun, * FE - Framing Error) status and resets the status if TRUE * @details \b Inputs: sci2FEOEError Index: firmware/App/Tasks/TaskGeneral.c =================================================================== diff -u -r3fe55376370dc82b5edcb20ac6026d8f079e401b -r794a0f21a465227d432a91d7b7fd7d513cfe3ecb --- firmware/App/Tasks/TaskGeneral.c (.../TaskGeneral.c) (revision 3fe55376370dc82b5edcb20ac6026d8f079e401b) +++ firmware/App/Tasks/TaskGeneral.c (.../TaskGeneral.c) (revision 794a0f21a465227d432a91d7b7fd7d513cfe3ecb) @@ -220,6 +220,7 @@ // Get level sensor data readAirTrapLevelSensors(); // Control blood pump + execBloodFlowMonitor(); execBloodFlowController(); execAirPumpController(); @@ -232,10 +233,10 @@ if ( TRUE == start ) { - sta = 1; +// sta = 1; // lower the level - set3WayValveState( H13_VALV, VALVE_3WAY_COMMON_TO_OPEN_STATE ); - setAirPumpState( AIR_PUMP_STATE_ON, 50 ); +// set3WayValveState( H13_VALV, VALVE_3WAY_COMMON_TO_OPEN_STATE ); +// setAirPumpState( AIR_PUMP_STATE_ON, 50 ); } break; case 1: Index: firmware/TD.dil =================================================================== diff -u -r56100135135bb715d316b5fd002a4a4951b9334a -r794a0f21a465227d432a91d7b7fd7d513cfe3ecb --- firmware/TD.dil (.../TD.dil) (revision 56100135135bb715d316b5fd002a4a4951b9334a) +++ firmware/TD.dil (.../TD.dil) (revision 794a0f21a465227d432a91d7b7fd7d513cfe3ecb) @@ -1,4 +1,4 @@ -# RM46L852PGE 12/02/24 16:30:42 +# RM46L852PGE 05/22/25 11:16:18 # ARCH=RM46L852PGE # @@ -260,7 +260,7 @@ DRIVER.SYSTEM.VAR.FLASHW_BASE_ADDRESS.VALUE=0xFFF87000 DRIVER.SYSTEM.VAR.CORE_MPU_REGION_12_SUB_5_DISABLE.VALUE=0 DRIVER.SYSTEM.VAR.CORE_HANDLER_TABLE_FIQ_ENTRY.VALUE="ldr pc,[pc,#-0x1b0]" -DRIVER.SYSTEM.VAR.VIM_CHANNEL_10_INT_ENABLE.VALUE=1 +DRIVER.SYSTEM.VAR.VIM_CHANNEL_10_INT_ENABLE.VALUE=0 DRIVER.SYSTEM.VAR.SAFETY_INIT_CAN5_DP_PBISTCHECK_ENA.VALUE=0x00000000 DRIVER.SYSTEM.VAR.SCILIN_ENABLE.VALUE=0 DRIVER.SYSTEM.VAR.SPI_ENABLE.VALUE=0 @@ -6476,7 +6476,7 @@ DRIVER.HET.VAR.HET1_BIT16_DIR.VALUE=0x00000000 DRIVER.HET.VAR.HET2_PWM1_POLARITY.VALUE=3 DRIVER.HET.VAR.HET2_BIT18_ANDSHARE.VALUE=0x00000000 -DRIVER.HET.VAR.HET1_EDGE0_INTENA.VALUE=0x00020000 +DRIVER.HET.VAR.HET1_EDGE0_INTENA.VALUE=0x00000000 DRIVER.HET.VAR.HET2_BIT0_DOUT.VALUE=0 DRIVER.HET.VAR.HET1_PWM6_PIN_SELECT.VALUE=18 DRIVER.HET.VAR.HET2_EDGE2_EVENT.VALUE=1 Index: firmware/include/het.h =================================================================== diff -u -r73d8423edc56daed591bc0b3f7baee5540aea423 -r794a0f21a465227d432a91d7b7fd7d513cfe3ecb --- firmware/include/het.h (.../het.h) (revision 73d8423edc56daed591bc0b3f7baee5540aea423) +++ firmware/include/het.h (.../het.h) (revision 794a0f21a465227d432a91d7b7fd7d513cfe3ecb) @@ -559,13 +559,13 @@ | (uint32)0x00000000U \ | (uint32)0x00000000U \ | (uint32)0x00000000U \ - | (uint32)0x00020000U \ | (uint32)0x00000000U \ | (uint32)0x00000000U \ | (uint32)0x00000000U \ | (uint32)0x00000000U \ | (uint32)0x00000000U \ | (uint32)0x00000000U \ + | (uint32)0x00000000U \ | (uint32)0x00000000U) #define HET1_INTENAS_CONFIGVALUE ((uint32)0x00000000U \ @@ -584,13 +584,13 @@ | (uint32)0x00000000U \ | (uint32)0x00000000U \ | (uint32)0x00000000U \ - | (uint32)0x00020000U \ | (uint32)0x00000000U \ | (uint32)0x00000000U \ | (uint32)0x00000000U \ | (uint32)0x00000000U \ | (uint32)0x00000000U \ | (uint32)0x00000000U \ + | (uint32)0x00000000U \ | (uint32)0x00000000U) #define HET1_PCR_CONFIGVALUE ((uint32)0x00000005U) Index: firmware/include/sys_vim.h =================================================================== diff -u -r73d8423edc56daed591bc0b3f7baee5540aea423 -r794a0f21a465227d432a91d7b7fd7d513cfe3ecb --- firmware/include/sys_vim.h (.../sys_vim.h) (revision 73d8423edc56daed591bc0b3f7baee5540aea423) +++ firmware/include/sys_vim.h (.../sys_vim.h) (revision 794a0f21a465227d432a91d7b7fd7d513cfe3ecb) @@ -93,7 +93,6 @@ extern void rtiCompare0Interrupt(void); extern void rtiCompare1Interrupt(void); extern void rtiCompare3Interrupt(void); -extern void het1HighLevelInterrupt(void); extern void linHighLevelInterrupt(void); extern void adc1Group1Interrupt(void); extern void can1HighLevelInterrupt(void); @@ -274,7 +273,7 @@ | (uint32)((uint32)0U << 7U)\ | (uint32)((uint32)0U << 8U)\ | (uint32)((uint32)0U << 9U)\ - | (uint32)((uint32)1U << 10U)\ + | (uint32)((uint32)0U << 10U)\ | (uint32)((uint32)0U << 11U)\ | (uint32)((uint32)0U << 12U)\ | (uint32)((uint32)1U << 13U)\ Index: firmware/source/het.c =================================================================== diff -u -r73d8423edc56daed591bc0b3f7baee5540aea423 -r794a0f21a465227d432a91d7b7fd7d513cfe3ecb --- firmware/source/het.c (.../het.c) (revision 73d8423edc56daed591bc0b3f7baee5540aea423) +++ firmware/source/het.c (.../het.c) (revision 794a0f21a465227d432a91d7b7fd7d513cfe3ecb) @@ -1418,13 +1418,13 @@ | (uint32) 0x00000000U | (uint32) 0x00000000U | (uint32) 0x00000000U - | (uint32) 0x00020000U | (uint32) 0x00000000U | (uint32) 0x00000000U | (uint32) 0x00000000U | (uint32) 0x00000000U | (uint32) 0x00000000U | (uint32) 0x00000000U + | (uint32) 0x00000000U | (uint32) 0x00000000U; @@ -1932,35 +1932,5 @@ } } -/* USER CODE BEGIN (5) */ -/* USER CODE END */ -/** @fn void het1HighLevelInterrupt(void) -* @brief Level 0 Interrupt for HET1 -*/ -/* SourceId : HET_SourceId_018 */ -/* DesignId : HET_DesignId_017 */ -/* Requirements : HL_SR371, HL_SR380, HL_SR381 */ -void het1HighLevelInterrupt(void) -{ - uint32 vec = hetREG1->OFF1; - - if (vec < 18U) - { - if ((vec & 1U) != 0U) - { - pwmNotification(hetREG1,(vec >> 1U) - 1U, pwmEND_OF_PERIOD); - } - else - { - pwmNotification(hetREG1,(vec >> 1U) - 1U, pwmEND_OF_DUTY); - } - } - else - { - edgeNotification(hetREG1,vec - 18U); - } -} - - Index: firmware/source/sys_main.c =================================================================== diff -u -raa6d45143096dfab776ce2ed7c775cfe2dd6db18 -r794a0f21a465227d432a91d7b7fd7d513cfe3ecb --- firmware/source/sys_main.c (.../sys_main.c) (revision aa6d45143096dfab776ce2ed7c775cfe2dd6db18) +++ firmware/source/sys_main.c (.../sys_main.c) (revision 794a0f21a465227d432a91d7b7fd7d513cfe3ecb) @@ -57,7 +57,6 @@ #include "i2c.h" #include "etpwm.h" #include "gio.h" -#include "het.h" #include "mibspi.h" #include "sci.h" #include "rti.h" @@ -142,7 +141,6 @@ static void initProcessor( void ) { gioInit(); // Configure GPIO pins - hetInit(); // Configure HET1 adcInit(); // Configure internal ADC channels mibspiInit(); // Re-purposing MIBSPI5 I/O/C pins as GPIO etpwmInit(); // Configure PWMs Index: firmware/source/sys_startup.c =================================================================== diff -u -r73d8423edc56daed591bc0b3f7baee5540aea423 -r794a0f21a465227d432a91d7b7fd7d513cfe3ecb --- firmware/source/sys_startup.c (.../sys_startup.c) (revision 73d8423edc56daed591bc0b3f7baee5540aea423) +++ firmware/source/sys_startup.c (.../sys_startup.c) (revision 794a0f21a465227d432a91d7b7fd7d513cfe3ecb) @@ -641,12 +641,11 @@ // Shuffle IRQ priorities per design requirements vimChannelMap( 3, 40, &rtiCompare1Interrupt ); vimChannelMap( 5, 64, &rtiCompare3Interrupt ); - vimChannelMap( 10, 3, &het1HighLevelInterrupt ); - vimChannelMap( 13, 5, &linHighLevelInterrupt ); + vimChannelMap( 13, 3, &linHighLevelInterrupt ); vimChannelMap( 15, 29, &adc1Group1Interrupt ); vimChannelMap( 16, 15, &can1HighLevelInterrupt ); vimChannelMap( 29, 13, &can1LowLevelInterrupt ); - vimChannelMap( 40, 10, &dmaBTCAInterrupt ); + vimChannelMap( 40, 5, &dmaBTCAInterrupt ); vimChannelMap( 64, 16, &sciHighLevelInterrupt ); /* USER CODE END */ Index: firmware/source/sys_vim.c =================================================================== diff -u -r73d8423edc56daed591bc0b3f7baee5540aea423 -r794a0f21a465227d432a91d7b7fd7d513cfe3ecb --- firmware/source/sys_vim.c (.../sys_vim.c) (revision 73d8423edc56daed591bc0b3f7baee5540aea423) +++ firmware/source/sys_vim.c (.../sys_vim.c) (revision 794a0f21a465227d432a91d7b7fd7d513cfe3ecb) @@ -79,7 +79,7 @@ &phantomInterrupt, /* Channel 7 */ &phantomInterrupt, /* Channel 8 */ &phantomInterrupt, /* Channel 9 */ - &het1HighLevelInterrupt, /* Channel 10 */ + &phantomInterrupt, /* Channel 10 */ &phantomInterrupt, /* Channel 11 */ &phantomInterrupt, /* Channel 12 */ &linHighLevelInterrupt, /* Channel 13 */ @@ -372,7 +372,7 @@ | (uint32)((uint32)0U << 7U) | (uint32)((uint32)0U << 8U) | (uint32)((uint32)0U << 9U) - | (uint32)((uint32)1U << 10U) + | (uint32)((uint32)0U << 10U) | (uint32)((uint32)0U << 11U) | (uint32)((uint32)0U << 12U) | (uint32)((uint32)1U << 13U)