|  | Dual Active Bridge Development Board (Part-No. ) |
Content |  |  |  |  |  |

Loading...
Searching...
No Matches
dev_vin_isolated.c
1/*
2 (c) 2024 Microchip Technology Inc. and its subsidiaries. You may use this
3 software and any derivatives exclusively with Microchip products.
4
5 THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
6 EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
7 WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
8 PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION
9 WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION.
10
11 IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
12 INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
13 WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
14 BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
15 FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
16 ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
17 THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
18
19 MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE
20 TERMS.
21 */
22
23#include <xc.h>
24#include <p33CK256MP506.h>
25#include "input_capture/sccp2.h"
26#include "clc/clc2.h"
27#include "dma/dma.h"
28
29#include "dev_vin_isolated.h"
30#include "dev_fault_common.h"
31#include "pwrctrl/dev_pwrctrl_typedef.h"
32
33
34
40 FAULT_OBJ_T Vin_Fault_Min;
41 FAULT_OBJ_T Vin_Fault_Max;
42
43extern POWER_CONTROL_t dab;
44
45void Dev_VinIsolated_Initialize(void)
46{
47 CCP2CON1Hbits.RTRGEN = 1;
48 DMA_SourceAddressSet(DMA_CHANNEL_2, (uint16_t)&CCP2BUFL);
49 DMA_DestinationAddressSet(DMA_CHANNEL_2, (uint16_t)&dab.Adc.VInputVoltage);
50
51 // ToDo: Check with Cormac the Fault_Persistence_Count
52 #if(FAULT_VIN_UV == true)
53 FAULT_Init(
54 &Vin_Fault_Min,
55 UV_THRESHOLD_RAW,
56 UV_LOWER_THRESHOLD_WITH_HYST,
57 FAULT_PERSISTENCE_COUNT,
58 FAULT_PERSISTENCE_COUNT
59 ) ;
60 #endif
61
62 #if(FAULT_VIN_OV == true)
63 FAULT_Init(
64 &Vin_Fault_Max,
65 OV_THRESHOLD_RAW,
66 OV_UPPER_THRESHOLD_WITH_HYST,
67 FAULT_PERSISTENCE_COUNT,
68 FAULT_PERSISTENCE_COUNT );
69 #endif
70
71}
dab
POWER_CONTROL_t dab
Global data object for a DAB Converter.
Definition pwrctrl.c:28
FAULT_Init
void FAULT_Init(FAULT_OBJ_T *faultInput, int16_t threshold, int16_t hysLimit, uint16_t thresholdCnt, uint32_t hysCnt)
This function initializes the fault object data structure with the values that required to detect a f...
Definition fault_common.c:27
FAULT_OBJ_T
The Fault object data structure contains a list of elements/variables that are used to detect/check a...
Definition fault_common.h:23
POWER_CONTROL_s
Power control API structure.
Definition pwrctrl_typedef.h:167