ADC Fault Detection (not tested yet)
This commit is contained in:
parent
d4516f83d2
commit
8c54032298
@ -73,7 +73,10 @@
|
|||||||
#define CONFIG_1SHOT (1<<5)
|
#define CONFIG_1SHOT (1<<5)
|
||||||
#define CONFIG_3WIRE (1<<4)
|
#define CONFIG_3WIRE (1<<4)
|
||||||
#define CONFIG_24WIRE (0<<4)
|
#define CONFIG_24WIRE (0<<4)
|
||||||
// Fault Detection not implemented yet
|
#define CONFIG_FAULTCYCLE_NO (0<<2)
|
||||||
|
#define CONFIG_FAULTCYCLE_AUTO (1<<2)
|
||||||
|
#define CONFIG_FAULTCYCLE_MANUAL1 (2<<2)
|
||||||
|
#define CONFIG_FAULTCYCLE_MANUAL2 (3<<2)
|
||||||
#define CONFIG_FAULTSTATCLEAR (1<<1)
|
#define CONFIG_FAULTSTATCLEAR (1<<1)
|
||||||
#define CONFIG_FILT50HZ (1<<0)
|
#define CONFIG_FILT50HZ (1<<0)
|
||||||
#define CONFIG_FILT60HZ (0<<0)
|
#define CONFIG_FILT60HZ (0<<0)
|
||||||
@ -85,7 +88,7 @@
|
|||||||
#define FAULT_RTDINLOW 0x08
|
#define FAULT_RTDINLOW 0x08
|
||||||
#define FAULT_OVUV 0x04
|
#define FAULT_OVUV 0x04
|
||||||
|
|
||||||
#define CONFIG (U8)(CONFIG_VBIAS_ON | CONFIG_MODE_OFF | CONFIG_24WIRE | CONFIG_FILT60HZ) // enable Vbias; autoconvert off; 4-wire; 60Hz;
|
#define CONFIG (U8)(CONFIG_VBIAS_ON | CONFIG_MODE_OFF | CONFIG_24WIRE | CONFIG_FAULTCYCLE_AUTO | CONFIG_FILT60HZ) // enable Vbias; autoconvert off; 4-wire; Fault detection auto 60Hz;
|
||||||
|
|
||||||
#define EVENT_ENABLE ((U32)(1<<0))
|
#define EVENT_ENABLE ((U32)(1<<0))
|
||||||
#define EVENT_DISABLE ((U32)(1<<1))
|
#define EVENT_DISABLE ((U32)(1<<1))
|
||||||
@ -207,10 +210,14 @@ BOOL ADCD_boInitializeModule( VOID )
|
|||||||
|
|
||||||
DIPO_vSetOutput(DIPO_eCS_C);
|
DIPO_vSetOutput(DIPO_eCS_C);
|
||||||
boOK &= boWriteReg(REG_CONFIG, (U16) CONFIG | CONFIG_FAULTSTATCLEAR, FALSE);
|
boOK &= boWriteReg(REG_CONFIG, (U16) CONFIG | CONFIG_FAULTSTATCLEAR, FALSE);
|
||||||
|
boOK &= boWriteReg(REG_HIGH_FAULT_MSB, (U16) 0x5b12 , TRUE);
|
||||||
|
boOK &= boWriteReg(REG_LOW_FAULT_MSB, (U16) 0x2690 , TRUE);
|
||||||
DIPO_vResetOutput(DIPO_eCS_C);
|
DIPO_vResetOutput(DIPO_eCS_C);
|
||||||
|
|
||||||
DIPO_vSetOutput(DIPO_eCS_H);
|
DIPO_vSetOutput(DIPO_eCS_H);
|
||||||
boOK &= boWriteReg(REG_CONFIG, (U16) CONFIG | CONFIG_FAULTSTATCLEAR, FALSE);
|
boOK &= boWriteReg(REG_CONFIG, (U16) CONFIG | CONFIG_FAULTSTATCLEAR, FALSE);
|
||||||
|
boOK &= boWriteReg(REG_HIGH_FAULT_MSB, (U16) 0x5b12 , TRUE);
|
||||||
|
boOK &= boWriteReg(REG_LOW_FAULT_MSB, (U16) 0x2690 , TRUE);
|
||||||
DIPO_vResetOutput(DIPO_eCS_H);
|
DIPO_vResetOutput(DIPO_eCS_H);
|
||||||
|
|
||||||
osMutexRelease( m_pstMutexID );
|
osMutexRelease( m_pstMutexID );
|
||||||
@ -271,9 +278,10 @@ BOOL ADCD_dReadData(ADCD_EnTemps eChannel, PU8 pu8Error, PU16 pu16Data)
|
|||||||
osMutexAcquire( m_pstMutexID, osWaitForever );
|
osMutexAcquire( m_pstMutexID, osWaitForever );
|
||||||
DIPO_vSetOutput(CS);
|
DIPO_vSetOutput(CS);
|
||||||
boOK &= boReadReg(REG_FAULT_STATUS, &u16Data, FALSE);
|
boOK &= boReadReg(REG_FAULT_STATUS, &u16Data, FALSE);
|
||||||
|
boWriteReg(REG_CONFIG, (U16) CONFIG | CONFIG_FAULTSTATCLEAR, FALSE);
|
||||||
DIPO_vResetOutput(CS);
|
DIPO_vResetOutput(CS);
|
||||||
osMutexRelease( m_pstMutexID );
|
osMutexRelease( m_pstMutexID );
|
||||||
//boWriteReg(REG_CONFIG, (U16) CONFIG | CONFIG_FAULTSTATCLEAR, FALSE);
|
|
||||||
*pu8Error |= u16Data & 0xFC;
|
*pu8Error |= u16Data & 0xFC;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -33,12 +33,13 @@
|
|||||||
#include "../PDEF_ProjectDefinitions.h"
|
#include "../PDEF_ProjectDefinitions.h"
|
||||||
#include "ANPI_AnalogPortsIn.h"
|
#include "ANPI_AnalogPortsIn.h"
|
||||||
|
|
||||||
|
#include "PECO_PeltierController.h"
|
||||||
|
|
||||||
//Application
|
//Application
|
||||||
//#include "../Application/ELOG_ErrorLogger.h"
|
//#include "../Application/ELOG_ErrorLogger.h"
|
||||||
|
|
||||||
// Toolbox
|
// Toolbox
|
||||||
#include "../Toolbox/UTIL_Utility.h"
|
#include "../Toolbox/UTIL_Utility.h"
|
||||||
#include "DIPO_DigitalPorts.h"
|
|
||||||
|
|
||||||
// include STM32 drivers
|
// include STM32 drivers
|
||||||
#include "stm32l4xx_hal.h"
|
#include "stm32l4xx_hal.h"
|
||||||
@ -298,7 +299,7 @@ VOID ANPI_vTask( PVOID arg )
|
|||||||
|
|
||||||
for(U16 u16Cnt = 0; u16Cnt < ANPI_eInNumberOfInputs; u16Cnt++ )
|
for(U16 u16Cnt = 0; u16Cnt < ANPI_eInNumberOfInputs; u16Cnt++ )
|
||||||
{
|
{
|
||||||
if(u16Cnt == ANPI_eOutputVoltage){
|
if(u16Cnt == ANPI_eOutputVoltage && !PECO_isEnabled()){
|
||||||
m_aflValues[u16Cnt] = 0.0f;
|
m_aflValues[u16Cnt] = 0.0f;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ BOOL PECO_boInitializeModule( VOID )
|
|||||||
{
|
{
|
||||||
BOOL boOK = TRUE;
|
BOOL boOK = TRUE;
|
||||||
|
|
||||||
//boOK &= ((m_pstThreadID = osThreadNew( PECO_vTask, NULL, &stTaskAttribute )) == NULL ) ? FALSE : TRUE;
|
boOK &= ((m_pstThreadID = osThreadNew( PECO_vTask, NULL, &stTaskAttribute )) == NULL ) ? FALSE : TRUE;
|
||||||
boOK &= ((m_pstEventID = osEventFlagsNew( &stEventAttribute )) == NULL) ? FALSE : TRUE;
|
boOK &= ((m_pstEventID = osEventFlagsNew( &stEventAttribute )) == NULL) ? FALSE : TRUE;
|
||||||
boOK &= (m_pstUpdateTimer = osTimerNew( vEventCallback, osTimerPeriodic, (PVOID)EVENT_TIMER_UPDATE, &stTimerAttribute )) == NULL ? FALSE : TRUE;
|
boOK &= (m_pstUpdateTimer = osTimerNew( vEventCallback, osTimerPeriodic, (PVOID)EVENT_TIMER_UPDATE, &stTimerAttribute )) == NULL ? FALSE : TRUE;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user