├── ControlModule
└── .gitkeep
├── CellModule
├── Hardware
│ ├── PCB.PNG
│ ├── AltiumProject
│ │ ├── CarettaBMS.PrjPCBStructure
│ │ ├── CarettaBMS.PrjPCBVariants
│ │ ├── CarettaCellModule.PcbDoc
│ │ ├── CarettaCellModule.SchDoc
│ │ ├── Gerber.OutJob
│ │ └── CarettaBMS.PrjPCB
│ └── CarettaBMS_CellModule0v8.pdf
├── doxygen
│ └── Doxyfile.bat
├── CarettaBMS.atsln
└── CarettaBMS
│ ├── FIFO.h
│ ├── CarettaBMS.componentinfo.xml
│ ├── command.h
│ ├── Debug
│ └── Makefile
│ ├── FIFO.c
│ ├── CarettaBMS_CMD.h
│ ├── CarettaBMS.cproj
│ └── main.c
├── Doc
├── expansions.md
├── userManual.md
├── firmwareUpdate.md
├── moduleCalib.md
├── msg.md
├── devGuide.md
├── cellVoltageMeasurement.md
├── UARTcom.md
└── license.md
├── .gitignore
└── README.md
/ControlModule/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/CellModule/Hardware/PCB.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hrastovc/CarettaBMS/HEAD/CellModule/Hardware/PCB.PNG
--------------------------------------------------------------------------------
/Doc/expansions.md:
--------------------------------------------------------------------------------
1 | ---
2 | filename: 04_expansions
3 | title: Expansions
4 | layout: main
5 | ---
6 |
7 |
8 |
--------------------------------------------------------------------------------
/CellModule/Hardware/AltiumProject/CarettaBMS.PrjPCBStructure:
--------------------------------------------------------------------------------
1 | Record=TopLevelDocument|FileName=CarettaCellModule.SchDoc
2 |
--------------------------------------------------------------------------------
/Doc/userManual.md:
--------------------------------------------------------------------------------
1 | ---
2 | filename: 01_userManual
3 | title: User manual
4 | layout: main
5 | ---
6 |
7 | placeholder
8 |
--------------------------------------------------------------------------------
/CellModule/Hardware/CarettaBMS_CellModule0v8.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hrastovc/CarettaBMS/HEAD/CellModule/Hardware/CarettaBMS_CellModule0v8.pdf
--------------------------------------------------------------------------------
/CellModule/Hardware/AltiumProject/CarettaBMS.PrjPCBVariants:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hrastovc/CarettaBMS/HEAD/CellModule/Hardware/AltiumProject/CarettaBMS.PrjPCBVariants
--------------------------------------------------------------------------------
/CellModule/Hardware/AltiumProject/CarettaCellModule.PcbDoc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hrastovc/CarettaBMS/HEAD/CellModule/Hardware/AltiumProject/CarettaCellModule.PcbDoc
--------------------------------------------------------------------------------
/CellModule/Hardware/AltiumProject/CarettaCellModule.SchDoc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hrastovc/CarettaBMS/HEAD/CellModule/Hardware/AltiumProject/CarettaCellModule.SchDoc
--------------------------------------------------------------------------------
/Doc/firmwareUpdate.md:
--------------------------------------------------------------------------------
1 | ---
2 | filename: 03_firmwareUpdate
3 | title: Firmware update
4 | layout: main
5 | ---
6 |
7 | To enter the bootloader send 0x62 (on 8N1 or 8E2) until you receive 0xEB response or until now response is received. To test if the mouldes are in the bootloader send 0x30 0x20 (on 8N1), if in bootloader 0x14 0x10 response should be received.
8 |
--------------------------------------------------------------------------------
/Doc/moduleCalib.md:
--------------------------------------------------------------------------------
1 | ---
2 | filename: 02_moduleCalib
3 | title: Module calibibration
4 | layout: main
5 | ---
6 |
7 | Vref_corrected = Vref * ( Vdmm / Vbms )
8 |
9 | Vref_corrected ... correction value
10 | Vref ... ideal voltage refrance value (1500mv)
11 | Vdmm ... true cell voltage value measured with DMM (in mV)
12 | Vbms ... voltage measured reported by BMS (in mV)
13 |
--------------------------------------------------------------------------------
/CellModule/doxygen/Doxyfile.bat:
--------------------------------------------------------------------------------
1 | :: Batch file to generate a reference manual from the comments in the source code, with
2 | :: Doxygen. The following tools should be installed and added to the path:
3 | :: - DoxyGen (doxygen.exe)
4 | :: - Graphviz (dot.exe)
5 | :: - MikTex (pdflatex.exe)
6 | if exist ..\..\Doc\CarettaBMS_ReferenceManual.pdf del ..\..\Doc\CarettaBMS_ReferenceManual.pdf
7 | doxygen.exe Doxyfile
8 | call .\output\latex\make.bat
9 | call copy .\output\latex\refman.pdf ..\..\Doc\CarettaBMS_ReferenceManual.pdf
10 | ::pause
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | CellModule/CarettaBMS/Debug/*
3 | !CellModule/CarettaBMS/Debug/Makefile
4 |
5 | CellModule/CarettaBMS/Release/*
6 | !CellModule/CarettaBMS/Release/Makefile
7 |
8 | *.atsuo
9 |
10 | CellModule/doxygen/output
11 | Doc/CarettaBMS_ReferenceManual.pdf
12 |
13 | CellModule/Hardware/AltiumProject/*
14 | !CellModule/Hardware/AltiumProject/CarettaBMS.PrjPCB
15 | !CellModule/Hardware/AltiumProject/CarettaBMS.PrjPCBStructure
16 | !CellModule/Hardware/AltiumProject/CarettaBMS.PrjPCBVariants
17 | !CellModule/Hardware/AltiumProject/CarettaCellModule.PcbDoc
18 | !CellModule/Hardware/AltiumProject/CarettaCellModule.SchDoc
19 | !CellModule/Hardware/AltiumProject/Gerber.OutJob
20 |
--------------------------------------------------------------------------------
/CellModule/CarettaBMS.atsln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Atmel Studio Solution File, Format Version 11.00
4 | VisualStudioVersion = 14.0.23107.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "CarettaBMS", "CarettaBMS\CarettaBMS.cproj", "{DCE6C7E3-EE26-4D79-826B-08594B9AD897}"
7 | EndProject
8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CF9B79B3-EFFB-4BF3-8A57-8D678A2C9B78}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|AVR = Debug|AVR
13 | Release|AVR = Release|AVR
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|AVR.ActiveCfg = Debug|AVR
17 | {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|AVR.Build.0 = Debug|AVR
18 | {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|AVR.ActiveCfg = Release|AVR
19 | {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|AVR.Build.0 = Release|AVR
20 | EndGlobalSection
21 | GlobalSection(SolutionProperties) = preSolution
22 | HideSolutionNode = FALSE
23 | EndGlobalSection
24 | EndGlobal
25 |
--------------------------------------------------------------------------------
/CellModule/CarettaBMS/FIFO.h:
--------------------------------------------------------------------------------
1 | /************************************************************************************//**
2 | * \file FIFO.c
3 | * \brief This module implements a FIFO buffer.
4 | * \ingroup CarettaBMSFIFO
5 | * \internal
6 | *----------------------------------------------------------------------------------------
7 | * L I C E N S E
8 | *----------------------------------------------------------------------------------------
9 | * This file is part of CarettaBMS. CarettaBMS is free software: you can redistribute it
10 | * and/or modify it under the terms of the GNU General Public License version 3 as
11 | * published by the Free Software Foundation.
12 | *
13 | * CarettaBMS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
14 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 | * PURPOSE. See the GNU General Public License for more details.
16 | *
17 | * You have received a copy of the GNU General Public License along with CarettaBMS. It
18 | * should be located in ".\Doc\license.md". If not, check on gitHub repository to obtain
19 | * a copy.
20 | *
21 | * \endinternal
22 | ****************************************************************************************/
23 | /************************************************************************************//**
24 | * \defgroup CarettaBMSFIFO FIFO buffer module
25 | * \brief This module implements a FIFO buffer.
26 | * \ingroup CarettaBMS
27 | ****************************************************************************************/
28 | #ifndef FIFO_H_
29 | #define FIFO_H_
30 |
31 |
32 | /****************************************************************************************
33 | * Type definitions
34 | ****************************************************************************************/
35 | typedef struct
36 | {
37 | uint8_t * buffer;
38 | uint16_t size;
39 | uint8_t * end;
40 | uint8_t * head;
41 | uint8_t * tail;
42 | }FIFO_t;
43 |
44 |
45 | /****************************************************************************************
46 | * Function prototypes
47 | ****************************************************************************************/
48 | void FIFOinit(FIFO_t *p, uint8_t *buffer, uint16_t size);
49 | void FIFOflush(FIFO_t *p);
50 | uint8_t FIFOaddToBuffer(FIFO_t *p, uint8_t data);
51 | uint16_t FIFOavailable(FIFO_t *p);
52 | uint8_t FIFOread(FIFO_t *p);
53 | uint8_t FIFOpeek(FIFO_t *p);
54 |
55 |
56 | #endif /* FIFO_H_ */
57 | /************************************ end of FIFO.h ************************************/
--------------------------------------------------------------------------------
/Doc/msg.md:
--------------------------------------------------------------------------------
1 | ---
2 | filename: 08_msg
3 | title: UART frame
4 | layout: main
5 | ---
6 | # UART frame
7 |
8 | There was still the problem of how to distinguish between the commands of the control module and the responses of the cell modules. Dividing 8-bit data bytes into two messages is not desirable, so communication with nine data bits, odd parity, and one stop bit (shorter 9O1) is used. The ninth data bit allows signaling whether the message is a command or a response. The modules must execute the commands and only forward the responses. This mode of communication has been proven to be very reliable. The module always receives all message inside the interrupt routine. In case the received message is a command it needs to be saved and process later outside the interrupt. Otherwise, when you receive a reply from some other cell module, you just forward it. The 9O1 configuration is not common and is not supported by all devices. This can significantly limit the ability to use any processor in the control modules, which is not desirable. With a few smaller software solutions, we achieved that UART communication from the outside is visible as eight data bits, even parity and two stop bits (shorter 8E2). This is a much more widespread communication configuration and most processors should support it. 9O1 is still used inside the system, only on the outside it behaves like 8E2. This could only be achieved because 9O1 and 8E2 messages are the same length and have opposite parity. The picture shows us the structure of the messages in more detail. When message is received from 8E2 to 9O1, the parity bit becomes the ninth data bit. On the other hand when transmitting from 9O1 to 8E2, the ninth data bit becomes a parity bit. The downside is that this bit needs to be calculated in software, which takes some time in the interrupt routine, but it is feasible. Most likely, this kind of use of UART communication is not an example of good practice, but in this particular case it works great. The main advantage is that the user does not have to split 8-bit data bytes into two separate messages and modules can still distinguish commands from responses.
9 |
10 | 
11 |
12 | The module always accepts the command and executes it first with an appropriate response and only then forwards the command to the next module. This ensures an easier system synchronization. In this way, we avoid race condition when the first module would already start transmitting a response and the next module is still executing the command. Interrupts should ensure this still works, but it would be a weak point of communication that can lead to CPU overload due to nesting interrupts.
13 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # CarettaBMS
2 |
3 | CarettaBMS is the best price to performance battery management system and it's also open-source.
4 |
5 | # Overview
6 |
7 | In recent years, there has been an increase in the use of ultralight electric vehicles. A fairly new segment requires the use of smaller battery packs for energy storage to power vehicles. For safe use of battery packs, BMS is very important. There is a big shortage in the field of quality battery management systems, which would be suitable for smaller battery packs. Prices of the systems currently on the market are too high. The price of a BMS can exceed the price of a battery pack. The use of such BMS does not make sense. The most difficult task was to make the system as inexpensive as possible for use with smaller battery packs. Despite the low cost, BMS still has all the necessary safety mechanisms.
8 |
9 | By approaching the challenges in a creative way it was possible to find an innovative solutions, which enabled a very low-cost implementation of the system. Analog to digital converter (ADC) is used with swapped inputs reference and ADC input. This makes it possible to measure the supply voltage without the use a of voltage divider and additional static energy consumption a voltage divider would entail. The type A standard uncertainty of cell voltage measurement is 0.9 mV. The communication uses a built-in analog comparator and two external resistors. Despite the fact that series connected modules operate on different reference potentials, this does not affect the message transmission. Tests with artificially induced interference confirmed the communication reliability of an arbitrary number of modules connected in series.
10 |
11 | The work was released as an open source project with the name CarettaBMS. The purpose is to allow access to better quality BMS suitable for smaller battery packs to a wider audience.
12 |
13 | # System Arhitecure
14 |
15 | 
16 |
17 | # specifications
18 |
19 | - Operating voltage range: od 1.8V do 5.0V
20 | - Operating temperature range: od 0°C do 80°C
21 | - Voltage measurement accuracy: ±10mV
22 | - Voltage measurement resolution: at least 3mV
23 | - Temperature measurement accuracy: ±5°C
24 | - PCB size: 65mm × 18mm × 5mm
25 | - Passive cell balancing current: 1A
26 | - load characteristics: R = 3.6Ω, Pmax = 4W
27 | - Maximum of series connected cells: up to 256
28 | - Temperature sensors: at least 3 sensors per module (1 internal, 2 external)
29 | or up to 32 I2C sensors
30 | - Communication interface (cell modules with master): isolated UART 8E2
31 | (documented protocol)
32 | - Bootloader for future infield firmware upgrades
33 |
34 | # Cell Module
35 | 
36 |
37 | Schematic: https://github.com/Hrastovc/CarettaBMS/blob/master/CellModule/Hardware/CarettaBMS_CellModule0v8.pdf
38 |
39 | # License
40 |
41 | CarettaBMS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.
--------------------------------------------------------------------------------
/CellModule/CarettaBMS/CarettaBMS.componentinfo.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Device
8 | Startup
9 |
10 |
11 | Atmel
12 | 1.3.0
13 | C:/Program Files (x86)\Atmel\Studio\7.0\Packs
14 |
15 |
16 |
17 |
18 | C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATtiny_DFP\1.3.229\include
19 |
20 | include
21 | C
22 |
23 |
24 | include
25 |
26 |
27 |
28 |
29 | C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATtiny_DFP\1.3.229\include\avr\iotn402.h
30 |
31 | header
32 | C
33 | 97sq/0DPA4RaZH3mB2XIeQ==
34 |
35 | include/avr/iotn402.h
36 |
37 |
38 |
39 |
40 | C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATtiny_DFP\1.3.229\templates\main.c
41 | template
42 | source
43 | C Exe
44 | GD1k8YYhulqRs6FD1B2Hog==
45 |
46 | templates/main.c
47 | Main file (.c)
48 |
49 |
50 |
51 | C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATtiny_DFP\1.3.229\templates\main.cpp
52 | template
53 | source
54 | C Exe
55 | YXFphlh0CtZJU+ebktABgQ==
56 |
57 | templates/main.cpp
58 | Main file (.cpp)
59 |
60 |
61 |
62 | C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATtiny_DFP\1.3.229\gcc\dev\attiny402
63 |
64 | libraryPrefix
65 | GCC
66 |
67 |
68 | gcc/dev/attiny402
69 |
70 |
71 |
72 |
73 | ATtiny_DFP
74 | C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATtiny_DFP/1.3.229/Atmel.ATtiny_DFP.pdsc
75 | 1.3.229
76 | true
77 | ATtiny402
78 |
79 |
80 |
81 | Resolved
82 | Fixed
83 | true
84 |
85 |
86 |
--------------------------------------------------------------------------------
/CellModule/CarettaBMS/command.h:
--------------------------------------------------------------------------------
1 | //**** ATMEL AVR - A P P L I C A T I O N N O T E ************************
2 | //*
3 | //* Title: AVR061 - STK500 Communication Protocol
4 | //* Filename: command.h
5 | //* Version: 1.0
6 | //* Last updated: 09.09.2002
7 | //*
8 | //* Support E-mail: avr@atmel.com
9 | //*
10 | //**************************************************************************
11 |
12 | // *****************[ STK Message constants ]***************************
13 |
14 | #define STK_SIGN_ON_MESSAGE "AVR STK" // Sign on string for Cmnd_STK_GET_SIGN_ON
15 |
16 | // *****************[ STK Response constants ]***************************
17 |
18 | #define Resp_STK_OK 0x10 // ' '
19 | #define Resp_STK_FAILED 0x11 // ' '
20 | #define Resp_STK_UNKNOWN 0x12 // ' '
21 | #define Resp_STK_NODEVICE 0x13 // ' '
22 | #define Resp_STK_INSYNC 0x14 // ' '
23 | #define Resp_STK_NOSYNC 0x15 // ' '
24 |
25 | #define Resp_ADC_CHANNEL_ERROR 0x16 // ' '
26 | #define Resp_ADC_MEASURE_OK 0x17 // ' '
27 | #define Resp_PWM_CHANNEL_ERROR 0x18 // ' '
28 | #define Resp_PWM_ADJUST_OK 0x19 // ' '
29 |
30 | // *****************[ STK Special constants ]***************************
31 |
32 | #define Sync_CRC_EOP 0x20 // 'SPACE'
33 |
34 | // *****************[ STK Command constants ]***************************
35 |
36 | #define Cmnd_STK_GET_SYNC 0x30 // ' '
37 | #define Cmnd_STK_GET_SIGN_ON 0x31 // ' '
38 | #define Cmnd_STK_RESET 0x32 // ' '
39 | #define Cmnd_STK_SINGLE_CLOCK 0x33 // ' '
40 | #define Cmnd_STK_STORE_PARAMETERS 0x34 // ' '
41 |
42 | #define Cmnd_STK_SET_PARAMETER 0x40 // ' '
43 | #define Cmnd_STK_GET_PARAMETER 0x41 // ' '
44 | #define Cmnd_STK_SET_DEVICE 0x42 // ' '
45 | #define Cmnd_STK_GET_DEVICE 0x43 // ' '
46 | #define Cmnd_STK_GET_STATUS 0x44 // ' '
47 | #define Cmnd_STK_SET_DEVICE_EXT 0x45 // ' '
48 |
49 | #define Cmnd_STK_ENTER_PROGMODE 0x50 // ' '
50 | #define Cmnd_STK_LEAVE_PROGMODE 0x51 // ' '
51 | #define Cmnd_STK_CHIP_ERASE 0x52 // ' '
52 | #define Cmnd_STK_CHECK_AUTOINC 0x53 // ' '
53 | #define Cmnd_STK_CHECK_DEVICE 0x54 // ' '
54 | #define Cmnd_STK_LOAD_ADDRESS 0x55 // ' '
55 | #define Cmnd_STK_UNIVERSAL 0x56 // ' '
56 |
57 | #define Cmnd_STK_PROG_FLASH 0x60 // ' '
58 | #define Cmnd_STK_PROG_DATA 0x61 // ' '
59 | #define Cmnd_STK_PROG_FUSE 0x62 // ' '
60 | #define Cmnd_STK_PROG_LOCK 0x63 // ' '
61 | #define Cmnd_STK_PROG_PAGE 0x64 // ' '
62 | #define Cmnd_STK_PROG_FUSE_EXT 0x65 // ' '
63 |
64 | #define Cmnd_STK_READ_FLASH 0x70 // ' '
65 | #define Cmnd_STK_READ_DATA 0x71 // ' '
66 | #define Cmnd_STK_READ_FUSE 0x72 // ' '
67 | #define Cmnd_STK_READ_LOCK 0x73 // ' '
68 | #define Cmnd_STK_READ_PAGE 0x74 // ' '
69 | #define Cmnd_STK_READ_SIGN 0x75 // ' '
70 | #define Cmnd_STK_READ_OSCCAL 0x76 // ' '
71 | #define Cmnd_STK_READ_FUSE_EXT 0x77 // ' '
72 | #define Cmnd_STK_READ_OSCCAL_EXT 0x78 // ' '
73 |
74 | // *****************[ STK Parameter constants ]***************************
75 |
76 | #define Parm_STK_HW_VER 0x80 // ' ' - R
77 | #define Parm_STK_SW_MAJOR 0x81 // ' ' - R
78 | #define Parm_STK_SW_MINOR 0x82 // ' ' - R
79 | #define Parm_STK_LEDS 0x83 // ' ' - R/W
80 | #define Parm_STK_VTARGET 0x84 // ' ' - R/W
81 | #define Parm_STK_VADJUST 0x85 // ' ' - R/W
82 | #define Parm_STK_OSC_PSCALE 0x86 // ' ' - R/W
83 | #define Parm_STK_OSC_CMATCH 0x87 // ' ' - R/W
84 | #define Parm_STK_RESET_DURATION 0x88 // ' ' - R/W
85 | #define Parm_STK_SCK_DURATION 0x89 // ' ' - R/W
86 |
87 | #define Parm_STK_BUFSIZEL 0x90 // ' ' - R/W, Range {0..255}
88 | #define Parm_STK_BUFSIZEH 0x91 // ' ' - R/W, Range {0..255}
89 | #define Parm_STK_DEVICE 0x92 // ' ' - R/W, Range {0..255}
90 | #define Parm_STK_PROGMODE 0x93 // ' ' - 'P' or 'S'
91 | #define Parm_STK_PARAMODE 0x94 // ' ' - TRUE or FALSE
92 | #define Parm_STK_POLLING 0x95 // ' ' - TRUE or FALSE
93 | #define Parm_STK_SELFTIMED 0x96 // ' ' - TRUE or FALSE
94 |
95 |
96 | // *****************[ STK status bit definitions ]***************************
97 |
98 | #define Stat_STK_INSYNC 0x01 // INSYNC status bit, '1' - INSYNC
99 | #define Stat_STK_PROGMODE 0x02 // Programming mode, '1' - PROGMODE
100 | #define Stat_STK_STANDALONE 0x04 // Standalone mode, '1' - SM mode
101 | #define Stat_STK_RESET 0x08 // RESET button, '1' - Pushed
102 | #define Stat_STK_PROGRAM 0x10 // Program button, ' 1' - Pushed
103 | #define Stat_STK_LEDG 0x20 // Green LED status, '1' - Lit
104 | #define Stat_STK_LEDR 0x40 // Red LED status, '1' - Lit
105 | #define Stat_STK_LEDBLINK 0x80 // LED blink ON/OFF, '1' - Blink
106 |
107 |
108 | // *****************************[ End Of COMMAND.H ]**************************
109 |
--------------------------------------------------------------------------------
/CellModule/CarettaBMS/Debug/Makefile:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | # Automatically-generated file. Do not edit!
3 | ################################################################################
4 |
5 | SHELL := cmd.exe
6 | RM := rm -rf
7 |
8 | USER_OBJS :=
9 |
10 | LIBS :=
11 | PROJ :=
12 |
13 | O_SRCS :=
14 | C_SRCS :=
15 | S_SRCS :=
16 | S_UPPER_SRCS :=
17 | OBJ_SRCS :=
18 | ASM_SRCS :=
19 | PREPROCESSING_SRCS :=
20 | OBJS :=
21 | OBJS_AS_ARGS :=
22 | C_DEPS :=
23 | C_DEPS_AS_ARGS :=
24 | EXECUTABLES :=
25 | OUTPUT_FILE_PATH :=
26 | OUTPUT_FILE_PATH_AS_ARGS :=
27 | AVR_APP_PATH :=$$$AVR_APP_PATH$$$
28 | QUOTE := "
29 | ADDITIONAL_DEPENDENCIES:=
30 | OUTPUT_FILE_DEP:=
31 | LIB_DEP:=
32 | LINKER_SCRIPT_DEP:=
33 |
34 | # Every subdirectory with source files must be described here
35 | SUBDIRS :=
36 |
37 |
38 | # Add inputs and outputs from these tool invocations to the build variables
39 | C_SRCS += \
40 | ../FIFO.c \
41 | ../main.c
42 |
43 |
44 | PREPROCESSING_SRCS +=
45 |
46 |
47 | ASM_SRCS +=
48 |
49 |
50 | OBJS += \
51 | FIFO.o \
52 | main.o
53 |
54 | OBJS_AS_ARGS += \
55 | FIFO.o \
56 | main.o
57 |
58 | C_DEPS += \
59 | FIFO.d \
60 | main.d
61 |
62 | C_DEPS_AS_ARGS += \
63 | FIFO.d \
64 | main.d
65 |
66 | OUTPUT_FILE_PATH +=CarettaBMS.elf
67 |
68 | OUTPUT_FILE_PATH_AS_ARGS +=CarettaBMS.elf
69 |
70 | ADDITIONAL_DEPENDENCIES:=
71 |
72 | OUTPUT_FILE_DEP:= ./makedep.mk
73 |
74 | LIB_DEP+=
75 |
76 | LINKER_SCRIPT_DEP+=
77 |
78 |
79 | # AVR32/GNU C Compiler
80 | ./FIFO.o: .././FIFO.c
81 | @echo Building file: $<
82 | @echo Invoking: AVR/GNU C Compiler : 5.4.0
83 | $(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATtiny_DFP\1.3.229\include" -Os -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -mmcu=attiny402 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATtiny_DFP\1.3.229\gcc\dev\attiny402" -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<"
84 | @echo Finished building: $<
85 |
86 |
87 | ./main.o: .././main.c
88 | @echo Building file: $<
89 | @echo Invoking: AVR/GNU C Compiler : 5.4.0
90 | $(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATtiny_DFP\1.3.229\include" -Os -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -mmcu=attiny402 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATtiny_DFP\1.3.229\gcc\dev\attiny402" -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<"
91 | @echo Finished building: $<
92 |
93 |
94 |
95 |
96 |
97 | # AVR32/GNU Preprocessing Assembler
98 |
99 |
100 |
101 | # AVR32/GNU Assembler
102 |
103 |
104 |
105 |
106 | ifneq ($(MAKECMDGOALS),clean)
107 | ifneq ($(strip $(C_DEPS)),)
108 | -include $(C_DEPS)
109 | endif
110 | endif
111 |
112 | # Add inputs and outputs from these tool invocations to the build variables
113 |
114 | # All Target
115 | all: $(OUTPUT_FILE_PATH) $(ADDITIONAL_DEPENDENCIES)
116 |
117 | $(OUTPUT_FILE_PATH): $(OBJS) $(USER_OBJS) $(OUTPUT_FILE_DEP) $(LIB_DEP) $(LINKER_SCRIPT_DEP)
118 | @echo Building target: $@
119 | @echo Invoking: AVR/GNU Linker : 5.4.0
120 | $(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -o$(OUTPUT_FILE_PATH_AS_ARGS) $(OBJS_AS_ARGS) $(USER_OBJS) $(LIBS) -Wl,-Map="CarettaBMS.map" -Wl,--start-group -Wl,-lm -Wl,--end-group -Wl,--gc-sections -Wl,-section-start=.text=0x200 -mmcu=attiny402 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATtiny_DFP\1.3.229\gcc\dev\attiny402"
121 | @echo Finished building target: $@
122 | "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O ihex -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "CarettaBMS.elf" "CarettaBMS.hex"
123 | "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -j .eeprom --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex "CarettaBMS.elf" "CarettaBMS.eep" || exit 0
124 | "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objdump.exe" -h -S "CarettaBMS.elf" > "CarettaBMS.lss"
125 | "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O srec -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "CarettaBMS.elf" "CarettaBMS.srec"
126 | "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-size.exe" "CarettaBMS.elf"
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 | # Other Targets
135 | clean:
136 | -$(RM) $(OBJS_AS_ARGS) $(EXECUTABLES)
137 | -$(RM) $(C_DEPS_AS_ARGS)
138 | rm -rf "CarettaBMS.elf" "CarettaBMS.a" "CarettaBMS.hex" "CarettaBMS.lss" "CarettaBMS.eep" "CarettaBMS.map" "CarettaBMS.srec" "CarettaBMS.usersignatures"
139 |
--------------------------------------------------------------------------------
/CellModule/CarettaBMS/FIFO.c:
--------------------------------------------------------------------------------
1 | /************************************************************************************//**
2 | * \file FIFO.c
3 | * \brief This module implements a FIFO buffer.
4 | * \ingroup CarettaBMSFIFO
5 | * \internal
6 | *----------------------------------------------------------------------------------------
7 | * L I C E N S E
8 | *----------------------------------------------------------------------------------------
9 | * This file is part of CarettaBMS. CarettaBMS is free software: you can redistribute it
10 | * and/or modify it under the terms of the GNU General Public License version 3 as
11 | * published by the Free Software Foundation.
12 | *
13 | * CarettaBMS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
14 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 | * PURPOSE. See the GNU General Public License for more details.
16 | *
17 | * You have received a copy of the GNU General Public License along with CarettaBMS. It
18 | * should be located in ".\Doc\license.md". If not, check on gitHub repository to obtain
19 | * a copy.
20 | *
21 | * \endinternal
22 | ****************************************************************************************/
23 |
24 | /****************************************************************************************
25 | * Include files
26 | ****************************************************************************************/
27 | #include
28 | #include
29 | #include "FIFO.h"
30 |
31 |
32 | /****************************************************************************************
33 | * Function prototypes
34 | ****************************************************************************************/
35 | uint8_t FIFOincreaseHead(FIFO_t *p);
36 | uint8_t FIFOincreaseTail(FIFO_t *p);
37 |
38 |
39 | /****************************************************************************************
40 | * F I F O U T I L I T I E S
41 | ****************************************************************************************/
42 | /************************************************************************************//**
43 | ** \brief FIFOinit
44 | ** \param p Pointer to the FIFO structure
45 | ** \param buffer Pointer to the buffer
46 | ** \param size Size of the buffer
47 | **
48 | ****************************************************************************************/
49 | void FIFOinit(FIFO_t *p, uint8_t *buffer, uint16_t size)
50 | {
51 | p->buffer = buffer;
52 | p->size = size;
53 | p->end = p->buffer + p->size - 1;
54 | p->head = buffer;
55 | p->tail = buffer;
56 | } /*** end of FIFOinit ***/
57 |
58 |
59 | /************************************************************************************//**
60 | ** \brief FIFOflush
61 | ** \param p Pointer to the FIFO structure
62 | **
63 | ****************************************************************************************/
64 | void FIFOflush(FIFO_t *p)
65 | {
66 | p->tail = p->head;
67 | } /*** end of FIFOflush ***/
68 |
69 |
70 | /************************************************************************************//**
71 | ** \brief FIFOincreaseHead
72 | ** \param p Pointer to the FIFO structure
73 | ** \return True if successful, false otherwise.
74 | **
75 | ****************************************************************************************/
76 | uint8_t FIFOincreaseHead(FIFO_t *p)
77 | {
78 | p->head++;
79 | if(p->head > p->end) p->head = p->buffer;
80 | return (p->head != p->tail);
81 | } /*** end of FIFOincreaseHead ***/
82 |
83 |
84 | /************************************************************************************//**
85 | ** \brief FIFOincreaseTail
86 | ** \param p Pointer to the FIFO structure
87 | ** \return True if successful, false otherwise.
88 | **
89 | ****************************************************************************************/
90 | uint8_t FIFOincreaseTail(FIFO_t *p)
91 | {
92 | p->tail++;
93 | if(p->tail > p->end) p->tail = p->buffer;
94 | return (p->head != p->tail);
95 | } /*** end of FIFOincreaseTail ***/
96 |
97 |
98 | /************************************************************************************//**
99 | ** \brief FIFOaddToBuffer
100 | ** \param p Pointer to the FIFO structure
101 | ** \param data Byte to be stored
102 | ** \return True if successful, false otherwise.
103 | **
104 | ****************************************************************************************/
105 | uint8_t FIFOaddToBuffer(FIFO_t *p, uint8_t data)
106 | {
107 | *(p->head) = data;
108 | return FIFOincreaseHead(p);
109 | } /*** end of FIFOaddToBuffer ***/
110 |
111 |
112 | /************************************************************************************//**
113 | ** \brief FIFOavailable
114 | ** \param p Pointer to the FIFO structure
115 | ** \return size Size of unread data in buffer
116 | **
117 | ****************************************************************************************/
118 | uint16_t FIFOavailable(FIFO_t *p)
119 | {
120 | if(p->head >= p->tail) return (p->head - p->tail);
121 | else return (p->size - (p->tail - p->head));
122 | } /*** end of FIFOavailable ***/
123 |
124 |
125 | /************************************************************************************//**
126 | ** \brief FIFOread
127 | ** \param p Pointer to the FIFO structure
128 | ** \return data First unread byte from buffer
129 | **
130 | ****************************************************************************************/
131 | uint8_t FIFOread(FIFO_t *p)
132 | {
133 | uint8_t data = *(p->tail);
134 | FIFOincreaseTail(p);
135 | return data;
136 | } /*** end of FIFOread ***/
137 |
138 |
139 | /************************************************************************************//**
140 | ** \brief FIFOpeek
141 | ** \param p Pointer to the FIFO structure
142 | ** \return *(p->tail) First unread byte from buffer
143 | **
144 | ****************************************************************************************/
145 | uint8_t FIFOpeek(FIFO_t *p)
146 | {
147 | return *(p->tail);
148 | } /*** end of FIFOpeek ***/
149 |
150 |
151 | /************************************ end of FIFO.h ************************************/
--------------------------------------------------------------------------------
/Doc/devGuide.md:
--------------------------------------------------------------------------------
1 | ---
2 | filename: 05_devGuide
3 | title: Dev guide
4 | layout: main
5 | ---
6 | # Cell module source code simplified:
7 |
8 | ## State machine
9 | ```C
10 | /* Main program entry point. */
11 | int main(void)
12 | {
13 | /* CPUINT init */
14 | /* PORT init */
15 | /* VREF init */
16 | /* ADC init */
17 | /* AC init */
18 | /* USART init */
19 | /* TCA init */
20 | /* EVSYS init */
21 |
22 | /* Load settings from the EEPROM and USERROW*/
23 | /* Init. global variables. */
24 |
25 | /* RTC init */
26 |
27 | /* FIFO buffers init */
28 |
29 | /* Update bootloader flag, set to 0xEA to stay in the application. */
30 |
31 | /* WDT init */
32 |
33 | /* Main state machine */
34 | for(;;)
35 | {
36 | /* Read new command byte. */
37 | uint8_t ch = readSave();
38 |
39 | if(ch == CMD_ALARM_CODES)
40 | {
41 | /* Handle command */
42 | }
43 | else if(ch == CMD_GOTO_BOOTLOADER)
44 | {
45 | /* Handle command */
46 | }
47 | else
48 | {
49 | /* Unknown command, respond with error code. */
50 | /* Delete received command, we dont want to forwad bad commands. */
51 | }
52 |
53 | /* Forward command, no need if this is the last module. */
54 | }
55 | }
56 | ```
57 |
58 | ```C
59 | uint8_t readSave(void)
60 | {
61 | /* Wait for a new byte received. */
62 | uint8_t ch = readWait();
63 | /* Save byte (ch) to the command buffer. */
64 | /* Return received byte (ch). */
65 | return ch;
66 | }
67 | ```
68 |
69 | ```C
70 | uint8_t readWait(void)
71 | {
72 | /* Do the work while no new data was received. */
73 | do
74 | {
75 | /* Wait for the real time conter compare event; every */
76 | if((RTC_INTFLAGS & RTC_CMP_bm))
77 | {
78 | /* Do the work */
79 | task(&settings);
80 | }
81 | }
82 | while(!FIFOavailable(&RXfifo));
83 |
84 | /* New data received, now return the received data. */
85 | return FIFOread(&RXfifo);
86 | }
87 | ```
88 |
89 | Task function performs all the main operations of the cell module BMS.
90 | ```C
91 | void task(tSettings *p)
92 | {
93 | /* Sample two external inputs. */
94 | /* Sample internal temperature sensor. */
95 |
96 | /* Check for overvoltage condition */
97 | /* Check for charged condition */
98 | /* Check for empty condition */
99 | /* Check for undervoltage condition */
100 | /* Check for overtemperature condition */
101 | /* Balance cell, if needed apply balancing current. */
102 |
103 | /* Send all the alarms, if any occurred. */
104 |
105 | /* If undervoltage condition go to sleep.
106 | * else if empty condition or sleep requested go to standby mode.
107 | */
108 |
109 | /* Call watchdog timer. */
110 | }
111 | ```
112 |
113 | All the received commands are saved in a buffer. Once the command has been handled buffer with the command is forwarded to the next module. But if this is the bottom module commands don't need to be forwarded.
114 |
115 | ```C
116 | void forwardBufferIfNotBot(void)
117 | {
118 | /* Is this the bottom module? */
119 | if(!settings.moduleNum)
120 | {
121 | /* Delete received command, we dont want to forwad the command. */
122 | }
123 | else
124 | {
125 | /* Forward received command. */
126 | }
127 | }
128 | ```
129 |
130 |
131 | ## Communication
132 | ```C
133 | void respond(uint8_t data)
134 | {
135 | /* Is this the bottom module? */
136 | if(!settings.moduleNum)
137 | {
138 | /* Calculate parity bit. */
139 | }
140 |
141 | /* Wait for UART to be ready to send data. */
142 |
143 | /* Is this the bottom module? */
144 | if(!settings.moduleNum)
145 | {
146 | /* Set ninth data bit as parity bit, this converts from 9O1 to 8E2. */
147 | }
148 | else
149 | {
150 | /* Set ninth data bit to zero, this indicates data is a response. */
151 | }
152 |
153 | /* Send data */
154 | }
155 | ```
156 |
157 | ```C
158 | void forward(uint8_t data)
159 | {
160 | /* Wait for UART to be ready to send data. */
161 | /* Set ninth data bit to one, this indicates data is a command. */
162 | /* Send data */
163 | }
164 | ```
165 |
166 | ```C
167 | ISR(AC0_AC_vect)
168 | {
169 | /* Clear int. flag */
170 | /* Set invert enable signal depending on AC state to trigger UART receiver. */
171 | }
172 | ```
173 |
174 | ```C
175 | ISR(USART0_RXC_vect)
176 | {
177 | /* Read UART status registers. */
178 |
179 | /* Has frame or parity error occurred? */
180 | if(status & (USART_FERR_bm | USART_PERR_bm))
181 | {
182 | /* Create frame, parity alarm. */
183 | /* Send all the alarms. */
184 | /* Something went wrong, reset itself. */
185 | }
186 | /* Has receive complete interrupt occurred? */
187 | else if(status & USART_RXCIF_bm)
188 | {
189 | /* Is this a command? */
190 | if((status & 0x01) | settings.topModule)
191 | {
192 | /* Save the command, so it can be handled outside the ISR. */
193 | }
194 | /* This is a respone(not a command). */
195 | else
196 | {
197 | /* Respond with the data. */
198 | }
199 | }
200 | }
201 | ```
202 |
203 |
204 | ## Voltage measurement
205 | ```C
206 | ISR(ADC0_RESRDY_vect)
207 | {
208 | /* Convert new ADC sample to voltage measurement. */
209 | }
210 | ```
211 |
212 |
213 | ## Sleep
214 | ```C
215 | void goToSleep(uint8_t mode)
216 | {
217 | /* Make measure interval short, so we measure as soon as we wake up. */
218 | /* Wait for any outgoing transmitions to finish. */
219 | /* Enable PIN1 interrupt (wake up source). */
220 | /* Enable sleep mode. */
221 | /* Connect AC output to the PIN3 (UART signal change triggers PIN3 interrupt.)*/
222 | /* Go to sleep. */
223 | /* Clear the real time counter compare int. flag (wake up source). */
224 | }
225 | ```
226 |
227 | ```C
228 | ISR(PORTA_PORT_vect)
229 | {
230 | /* Disconnect AC output to the PIN3 (needs to be done as soon as possible). */
231 | /* Disable PIN3 interrupt (wake up source). */
232 | /* Clear int. flag. */
233 | }
234 | ```
235 |
236 | ```C
237 | ISR(RTC_PIT_vect)
238 | {
239 | /* Disconnect AC output to the PIN3 (needs to be done as soon as possible). */
240 | /* Disable PIN3 interrupt (wake up source). */
241 | /* Clear int. flag. */
242 | }
243 | ```
244 |
245 | ```C
246 | ISR(RTC_CNT_vect)
247 | {
248 | /* Clear the int. flag. */
249 | /* If sleep was not requested an error has occurred, create alarm. */
250 | /* Send all the alarms */
251 | /* Something went wrong, reset itself. */
252 | }
253 | ```
254 |
--------------------------------------------------------------------------------
/Doc/cellVoltageMeasurement.md:
--------------------------------------------------------------------------------
1 | ---
2 | filename: 06_cellVoltageMeasurement
3 | title: Voltage measurement
4 | layout: main
5 | ---
6 | # CarettaBMS cell voltage measurement
7 |
8 | The voltage measurement is heavily **cost-optimized**. Optimization was enabled due to some of the options offered by the processors ADC. For cell voltage measurement no external components are required. Although to achieve the performance needed, this measurement method required some additional software solutions.
9 |
10 | ## ADC configuration
11 |
12 | The processor has a 10-bit analog-to-digital converter (ADC) and some voltage references. The voltage references are not very accurate, but they are stable, which is important. During the production, it is necessary to calibrate the modules, so the exact value of the voltage reference is known. Typically, an ADC is used by connecting a voltage reference to its reference input and an unknown voltage, we want to measure, to its input. The input voltage we want to measure must always be lower than the reference voltage. In this case, the reference voltage used has an output of 1.5V, because it is the only available reference in the entire processor's power supply range. If this reference voltage were to be connected to the ADC's reference input, the maximum allowed voltage at the input would be less than 1.5V. There lies our problem as we want to measure the voltage range between 1.8V and 5V. The problem could be resolved by using a voltage divider at the ADC's input, but this solution is not acceptable as it has two major drawbacks. Due to the voltage divider, we would introduce additional static energy consumption, undesirable in battery applications. Although this could still be mitigated in some way by using a larger values resistors to limit the current. I think the bigger problem is the cost that two additional resistors would contribute too. The voltage measurement must be accurate to at least ±10mV and the resistors needed to achieve that accuracy are expensive. All of this led me to a different, lesser-known approach of using an ADC. Instead of connecting the reference voltage to the ADC reference input, cell voltage was connected to it. In the case of CarettaBMS, this is also the supply voltage of the processor. This now means that any voltage in the range between 0V and the processor supply can be measured at the ADCs input. It would make sense to connect a known value to the input, such as a voltage reference of 1.5V. The voltage will always be lower than the processor's power supply. This way of measuring has been used many times but is not well known and it's not common. The important thing is that ADC always operates within its own operating parameters.
13 |
14 | ## ADC resolution
15 |
16 | As this ADC configuration use is not widespread or well documented, there is no data on the accuracy and resolution of the measurement. For a BMS, these two are crucial. We need to take a closer look at the equations that describe how the ADC works. Of particular importance is the resolution of the measurement, which turns out to have a significant nonlinear dependence on the cell voltage.
17 |
18 | Below equation typically describes the operation of the ADC and is often used to convert the ADC output data back to the input voltage:
19 |
20 |
22 |
23 | We assume that the reference voltage Vref is a constant and we have a constant number of ADC bits (m). Only the ADC result (n) remains in the equation. This gives the classical linear equation, whit the linear dependence of the ADC result on the input voltage. We can also quickly recognize the resolution of the ADC, which is given as a fraction of the reference voltage or Uref / 2^m. Due to the unusual ADC configuration, where the quantities at the inputs of the ADC are swapped, we need to do the same in the previous equation. We get a new equation that describes the operation of the ADC in the current configuration:
24 |
25 |
27 |
28 | We would prefer to rearrange the new equation to be more like the first one because we want to calculate Uin from the ADC result:
29 |
30 |
32 |
33 | By the same analysis as we performed on the first equation, we can replace Uref and m by constants. The measured voltage no longer has a linear dependence on the ADC result. The equation no longer shows us the ADC resolution as the first equation did. Now, the path to the equation that describes the ADC resolution is much more difficult as the resolution changes. The resolution depends on the cell voltage. Briefly, we would summarize that the larger the difference between the reference voltage and the cell voltage, the lower the resolution. To facilitate the derivation of the equation, a simple mathematical model of the ADC was developed, where the two input quantities were replaced ([model](https://www.desmos.com/calculator/vjn2ooxamo)). The model has contributed greatly to a better understanding of ADC performance. The conclusion is that the resolution of the ADC is equal to the difference between the next ADC result, when we increase the voltage, and the current result. This is also described by the next equation:
34 |
35 |
38 |
39 | We further transform the equation to obtain a single fraction. This gives the equation:
40 |
41 |
43 |
44 | This equation describes how the resolution changes depending on the ADC result. To express the resolution of the ADC as a function of the input voltage Uin, we replace the ADC result (n) in the equation with the second equation. In doing so, we must take into account the property of the quantizer and the ADC result is always a natural number or 0. This is achieved with the floor function and an additional offset factor (o) that defines the operation of the ADC around the result 0. This factor can be 0 or 0.5. In this case, the offset factor is 0.
45 |
46 |
49 |
50 | When all parameters are inserted into the equation, it turns out that the ADC does not have a sufficient number of bits to achieve the sufficient resolution and consequently the accuracy specified in the requirements. However, the use of ADC in the described configuration was chosen because the cost is very important. In this configuration, no external components are required. The resolution problem was later solved in the program by oversampling the ADC, thus achieving the required measurement resolution.
51 |
52 | ## Resolution plot
53 |
54 | 
55 |
--------------------------------------------------------------------------------
/CellModule/Hardware/AltiumProject/Gerber.OutJob:
--------------------------------------------------------------------------------
1 | [OutputJobFile]
2 | Version=1.0
3 | Caption=
4 | Description=
5 | VaultGUID=
6 | ItemGUID=
7 | ItemHRID=
8 | RevisionGUID=
9 | RevisionId=
10 | VaultHRID=
11 | AutoItemHRID=
12 | NextRevId=
13 | FolderGUID=
14 | LifeCycleDefinitionGUID=
15 | RevisionNamingSchemeGUID=
16 |
17 | [OutputGroup1]
18 | Name=Gerber.OutJob
19 | Description=
20 | TargetOutputMedium=Folder Structure
21 | VariantName=[No Variations]
22 | VariantScope=0
23 | CurrentConfigurationName=
24 | TargetPrinter=NPIB8638C (HP LaserJet 100 colorMFP M175nw)
25 | PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1
26 | OutputMedium1=Print Job
27 | OutputMedium1_Type=Printer
28 | OutputMedium1_Printer=
29 | OutputMedium1_PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1
30 | OutputMedium2=PDF
31 | OutputMedium2_Type=Publish
32 | OutputMedium3=Folder Structure
33 | OutputMedium3_Type=GeneratedFiles
34 | OutputMedium4=Video
35 | OutputMedium4_Type=Multimedia
36 | OutputMedium5=export
37 | OutputMedium5_Type=GeneratedFiles
38 | OutputType1=Gerber
39 | OutputName1=Gerber Files
40 | OutputCategory1=Fabrication
41 | OutputDocumentPath1=CarettaCellModule.PcbDoc
42 | OutputVariantName1=
43 | OutputEnabled1=1
44 | OutputEnabled1_OutputMedium1=0
45 | OutputEnabled1_OutputMedium2=0
46 | OutputEnabled1_OutputMedium3=1
47 | OutputEnabled1_OutputMedium4=0
48 | OutputEnabled1_OutputMedium5=0
49 | OutputDefault1=0
50 | Configuration1_Name1=OutputConfigurationParameter1
51 | Configuration1_Item1=AddToAllLayerClasses.Set= |AddToAllPlots.Set=SerializeLayerHash.Version~2,ClassName~TLayerToBoolean|CentrePlots=False|DrillDrawingSymbol=GraphicsSymbol|DrillDrawingSymbolSize=200000|EmbeddedApertures=True|FilmBorderSize=10000000|FilmXSize=200000000|FilmYSize=160000000|FlashAllFills=False|FlashPadShapes=True|G54OnApertureChange=False|GenerateDRCRulesFile=True|GenerateDRCRulesFile=True|GenerateReliefShapes=True|GerberUnit=Imperial|GerberUnit=Imperial|IncludeUnconnectedMidLayerPads=False|LayerClassesMirror.Set= |LayerClassesPlot.Set= |LeadingAndTrailingZeroesMode=SuppressLeadingZeroes|MaxApertureSize=2500000|MinusApertureTolerance=50|MinusApertureTolerance=50|Mirror.Set=SerializeLayerHash.Version~2,ClassName~TLayerToBoolean|MirrorDrillDrawingPlots=False|MirrorDrillGuidePlots=False|NoRegularPolygons=False|NumberOfDecimals=5|NumberOfDecimals=5|OptimizeChangeLocationCommands=True|OptimizeChangeLocationCommands=True|OriginPosition=Relative|Panelize=False|Plot.Set=SerializeLayerHash.Version~2,ClassName~TLayerToBoolean,16973830~1,16973832~1,16973834~1,16777217~1,16842751~1,16973835~1,16973833~1,16973831~1,16908291~1|PlotPositivePlaneLayers=False|PlotUsedDrillDrawingLayerPairs=False|PlotUsedDrillGuideLayerPairs=False|PlusApertureTolerance=50|PlusApertureTolerance=50|Record=GerberView|SoftwareArcs=False|Sorted=False|Sorted=False
52 | OutputType2=NC Drill
53 | OutputName2=NC Drill Files
54 | OutputCategory2=Fabrication
55 | OutputDocumentPath2=CarettaCellModule.PcbDoc
56 | OutputVariantName2=
57 | OutputEnabled2=1
58 | OutputEnabled2_OutputMedium1=0
59 | OutputEnabled2_OutputMedium2=0
60 | OutputEnabled2_OutputMedium3=2
61 | OutputEnabled2_OutputMedium4=0
62 | OutputEnabled2_OutputMedium5=0
63 | OutputDefault2=0
64 | Configuration2_Name1=OutputConfigurationParameter1
65 | Configuration2_Item1=BoardEdgeRoutToolDia=2000000|GenerateBoardEdgeRout=False|GenerateDrilledSlotsG85=False|GenerateEIADrillFile=False|GenerateSeparatePlatedNonPlatedFiles=False|NumberOfDecimals=5|NumberOfUnits=2|OptimizeChangeLocationCommands=True|OriginPosition=Relative|Record=DrillView|Units=Imperial|ZeroesMode=SuppressTrailingZeroes
66 |
67 | [PublishSettings]
68 | OutputFilePath2=C:\Users\pc\Downloads\Caretta OpenBms\PCB\CellModulev07\Project Outputs for CarettaBMS\CarettaCellModule_shema.pdf
69 | ReleaseManaged2=1
70 | OutputBasePath2=Project Outputs for CarettaBMS
71 | OutputPathMedia2=
72 | OutputPathMediaValue2=
73 | OutputPathOutputer2=[Output Type]
74 | OutputPathOutputerPrefix2=
75 | OutputPathOutputerValue2=
76 | OutputFileName2=CarettaCellModule_shema.pdf
77 | OutputFileNameMulti2=
78 | UseOutputNameForMulti2=1
79 | OutputFileNameSpecial2=
80 | OpenOutput2=1
81 | PromptOverwrite2=1
82 | PublishMethod2=0
83 | ZoomLevel2=50
84 | FitSCHPrintSizeToDoc2=0
85 | FitPCBPrintSizeToDoc2=0
86 | GenerateNetsInfo2=1
87 | MarkPins2=1
88 | MarkNetLabels2=1
89 | MarkPortsId2=1
90 | GenerateTOC2=1
91 | ShowComponentParameters2=1
92 | GlobalBookmarks2=0
93 | PDFACompliance2=Disabled
94 | PDFVersion2=Default
95 | OutputFilePath3=F:\Users\Luka\Documents\Projekti\Caretta OpenBms\PCB\CellModulev08\Gerber\
96 | ReleaseManaged3=0
97 | OutputBasePath3=Gerber\
98 | OutputPathMedia3=
99 | OutputPathMediaValue3=Gerber
100 | OutputPathOutputer3=
101 | OutputPathOutputerPrefix3=
102 | OutputPathOutputerValue3=
103 | OutputFileName3=
104 | OutputFileNameMulti3=
105 | UseOutputNameForMulti3=1
106 | OutputFileNameSpecial3=
107 | OpenOutput3=0
108 | OutputFilePath4=
109 | ReleaseManaged4=1
110 | OutputBasePath4=Project Outputs for CarettaBMS
111 | OutputPathMedia4=
112 | OutputPathMediaValue4=
113 | OutputPathOutputer4=[Output Type]
114 | OutputPathOutputerPrefix4=
115 | OutputPathOutputerValue4=
116 | OutputFileName4=
117 | OutputFileNameMulti4=
118 | UseOutputNameForMulti4=1
119 | OutputFileNameSpecial4=
120 | OpenOutput4=1
121 | PromptOverwrite4=1
122 | PublishMethod4=5
123 | ZoomLevel4=50
124 | FitSCHPrintSizeToDoc4=1
125 | FitPCBPrintSizeToDoc4=1
126 | GenerateNetsInfo4=1
127 | MarkPins4=1
128 | MarkNetLabels4=1
129 | MarkPortsId4=1
130 | MediaFormat4=Windows Media file (*.wmv,*.wma,*.asf)
131 | FixedDimensions4=1
132 | Width4=352
133 | Height4=288
134 | MultiFile4=0
135 | FramesPerSecond4=25
136 | FramesPerSecondDenom4=1
137 | AviPixelFormat4=7
138 | AviCompression4=MP42 MS-MPEG4 V2
139 | AviQuality4=100
140 | FFmpegVideoCodecId4=13
141 | FFmpegPixelFormat4=0
142 | FFmpegQuality4=80
143 | WmvVideoCodecName4=Windows Media Video V7
144 | WmvQuality4=80
145 | OutputFilePath5=C:\Users\pc\Downloads\Caretta OpenBms\PCB\CellModulev07\Project Outputs for CarettaBMS\
146 | ReleaseManaged5=1
147 | OutputBasePath5=Project Outputs for CarettaBMS
148 | OutputPathMedia5=
149 | OutputPathMediaValue5=
150 | OutputPathOutputer5=[Output Type]
151 | OutputPathOutputerPrefix5=
152 | OutputPathOutputerValue5=
153 | OutputFileName5=
154 | OutputFileNameMulti5=
155 | UseOutputNameForMulti5=1
156 | OutputFileNameSpecial5=
157 | OpenOutput5=1
158 |
159 | [GeneratedFilesSettings]
160 | RelativeOutputPath2=C:\Users\pc\Downloads\Caretta OpenBms\PCB\CellModulev07\Project Outputs for CarettaBMS\CarettaCellModule_shema.pdf
161 | OpenOutputs2=1
162 | RelativeOutputPath3=F:\Users\Luka\Documents\Projekti\Caretta OpenBms\PCB\CellModulev08\Gerber\
163 | OpenOutputs3=0
164 | AddToProject3=1
165 | TimestampFolder3=0
166 | UseOutputName3=0
167 | OpenODBOutput3=0
168 | OpenGerberOutput3=0
169 | OpenNCDrillOutput3=0
170 | OpenIPCOutput3=0
171 | EnableReload3=0
172 | RelativeOutputPath4=
173 | OpenOutputs4=1
174 | RelativeOutputPath5=C:\Users\pc\Downloads\Caretta OpenBms\PCB\CellModulev07\Project Outputs for CarettaBMS\
175 | OpenOutputs5=1
176 | AddToProject5=1
177 | TimestampFolder5=0
178 | UseOutputName5=0
179 | OpenODBOutput5=0
180 | OpenGerberOutput5=0
181 | OpenNCDrillOutput5=0
182 | OpenIPCOutput5=0
183 | EnableReload5=0
184 |
185 |
--------------------------------------------------------------------------------
/CellModule/CarettaBMS/CarettaBMS_CMD.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************************
2 | * _____ _ _ ____ __ __ _____
3 | * / ____| | | | | | _ \ | \/ | / ____|
4 | * | | __ _ _ __ ___ | |_ | |_ __ _ | |_) | | \ / | | (___
5 | * | | / _` | | '__| / _ \ | __| | __| / _` | | _ < | |\/| | \___ \
6 | * | |____ | (_| | | | | __/ | |_ | |_ | (_| | | |_) | | | | | ____) |
7 | * \_____| \__,_| |_| \___| \__| \__| \__,_| |____/ |_| |_| |_____/
8 | *
9 | ***************************************************************************************/
10 |
11 | /************************************************************************************//**
12 | * \file CarettaBMS_CMD.c
13 | * \brief CarettaBMS commands defines
14 | * \internal
15 | *----------------------------------------------------------------------------------------
16 | * L I C E N S E
17 | *----------------------------------------------------------------------------------------
18 | * This file is part of CarettaBMS. CarettaBMS is free software: you can redistribute it
19 | * and/or modify it under the terms of the GNU General Public License version 3 as
20 | * published by the Free Software Foundation.
21 | *
22 | * CarettaBMS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
23 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
24 | * PURPOSE. See the GNU General Public License for more details.
25 | *
26 | * You have received a copy of the GNU General Public License along with CarettaBMS. It
27 | * should be located in ".\Doc\license.md". If not, check on gitHub repository to obtain
28 | * a copy.
29 | *
30 | * \endinternal
31 | ****************************************************************************************/
32 |
33 | /****************************************************************************************
34 | * Command definitions
35 | ****************************************************************************************/
36 | #define CMD_000 (uint8_t)(0x01)
37 | #define CMD_001 (uint8_t)(0x02)
38 | #define CMD_002 (uint8_t)(0x04)
39 | #define CMD_003 (uint8_t)(0x07)
40 | #define CMD_004 (uint8_t)(0x08)
41 | #define CMD_005 (uint8_t)(0x0B)
42 | #define CMD_006 (uint8_t)(0x0D)
43 | #define CMD_007 (uint8_t)(0x0E)
44 | #define CMD_008 (uint8_t)(0x10)
45 | #define CMD_009 (uint8_t)(0x13)
46 | #define CMD_010 (uint8_t)(0x15)
47 | #define CMD_011 (uint8_t)(0x16)
48 | #define CMD_012 (uint8_t)(0x19)
49 | #define CMD_013 (uint8_t)(0x1A)
50 | #define CMD_014 (uint8_t)(0x1C)
51 | #define CMD_015 (uint8_t)(0x1F)
52 | /* START OF ASCII CMDs from 0x20 to 0x7E */
53 | #define CMD_016 (uint8_t)(' ')
54 | #define CMD_017 (uint8_t)('#')
55 | #define CMD_018 (uint8_t)('%')
56 | #define CMD_019 (uint8_t)('&')
57 | #define CMD_020 (uint8_t)(')')
58 | #define CMD_021 (uint8_t)('*')
59 | #define CMD_022 (uint8_t)(',')
60 | #define CMD_023 (uint8_t)('/')
61 | #define CMD_024 (uint8_t)('1')
62 | #define CMD_025 (uint8_t)('2')
63 | #define CMD_026 (uint8_t)('4')
64 | #define CMD_027 (uint8_t)('7')
65 | #define CMD_028 (uint8_t)('8')
66 | #define CMD_029 (uint8_t)(';')
67 | #define CMD_030 (uint8_t)('=')
68 | #define CMD_031 (uint8_t)('>')
69 | #define CMD_GOTO_SLEEP (uint8_t)('@') /* 0x40 */
70 | #define CMD_ALARM_CODES (uint8_t)('a') /* 0x61 */
71 | #define CMD_GOTO_BOOTLOADER (uint8_t)('b') /* 0x62 */
72 | #define CMD_VOLTAGE_CAL (uint8_t)('C') /* 0x43 */
73 | #define CMD_BALANCE_CURRENT (uint8_t)('d') /* 0x64 */
74 | #define CMD_EXT_INPUTS (uint8_t)('E') /* 0x45 */
75 | #define CMD_MAX_TEMP_BMS (uint8_t)('F') /* 0x46 */
76 | #define CMD_MAX_TEMP_RECOVER (uint8_t)('g') /* 0x67 */
77 | #define CMD_HIGH_VOLT_LIMIT (uint8_t)('h') /* 0x68 */
78 | #define CMD_HIGH_VOLT_RECOVER (uint8_t)('I') /* 0x49 */
79 | #define CMD_LOW_VOLT_RECOVER (uint8_t)('J') /* 0x4A */
80 | #define CMD_LOW_VOLT_LIMIT (uint8_t)('L') /* 0x4C */
81 | #define CMD_CHARGED_RECOVER (uint8_t)('k') /* 0x6B */
82 | #define CMD_MEASURE_INTERVAL (uint8_t)('m') /* 0x6D */
83 | #define CMD_NMBR_OF_MODULES (uint8_t)('n') /* 0x6E */
84 | #define CMD_BALANCE_START (uint8_t)('O') /* 0x4F */
85 | #define CMD_BALANCE_STOP (uint8_t)('p') /* 0x70 */
86 | #define CMD_BALANCE_HYSTERESIS (uint8_t)('Q') /* 0x51 */
87 | #define CMD_RESET_SETTINGS (uint8_t)('R') /* 0x52 */
88 | #define CMD_SAVE_SETTINGS (uint8_t)('s') /* 0x73 */
89 | #define CMD_INT_TEMPERATURE (uint8_t)('T') /* 0x54 */
90 | #define CMD_TARGET_VOLTAGE (uint8_t)('u') /* 0x75 */
91 | #define CMD_CELL_VOLTAGE (uint8_t)('v') /* 0x76 */
92 | #define CMD_WAKE_UP_SYNC (uint8_t)('W') /* 0x57 */
93 | #define CMD_EMPTY_VOLTAGE (uint8_t)('X') /* 0x58 */
94 | #define CMD_EMPTY_RECOVER (uint8_t)('y') /* 0x79 */
95 | #define CMD_CHARGED_VOLTAGE (uint8_t)('z') /* 0x7A */
96 | #define CMD_TOP_MODULE (uint8_t)('[') /* 0x5B */
97 | #define CMD_NOT_TOP_MODULE (uint8_t)(']') /* 0x5D */
98 | #define CMD_061 (uint8_t)('^')
99 | #define CMD_062 (uint8_t)('|')
100 | /* END OF ASCII CMDs */
101 | #define CMD_TWI_INIT (uint8_t)(0x7F)
102 | #define CMD_TWI_STATUS (uint8_t)(0x80)
103 | #define CMD_TWI_START (uint8_t)(0x83)
104 | #define CMD_TWI_STOP (uint8_t)(0x85)
105 | #define CMD_TWI_WRITE (uint8_t)(0x86)
106 | #define CMD_TWI_READ (uint8_t)(0x89)
107 | #define CMD_069 (uint8_t)(0x8A)
108 | #define CMD_070 (uint8_t)(0x8C)
109 | #define CMD_071 (uint8_t)(0x8F)
110 | #define CMD_072 (uint8_t)(0x91)
111 | #define CMD_073 (uint8_t)(0x92)
112 | #define CMD_074 (uint8_t)(0x94)
113 | #define CMD_075 (uint8_t)(0x97)
114 | #define CMD_076 (uint8_t)(0x98)
115 | #define CMD_077 (uint8_t)(0x9B)
116 | #define CMD_078 (uint8_t)(0x9D)
117 | #define CMD_079 (uint8_t)(0x9E)
118 | #define CMD_080 (uint8_t)(0xA1)
119 | #define CMD_081 (uint8_t)(0xA2)
120 | #define CMD_082 (uint8_t)(0xA4)
121 | #define CMD_083 (uint8_t)(0xA7)
122 | #define CMD_084 (uint8_t)(0xA8)
123 | #define CMD_085 (uint8_t)(0xAB)
124 | #define CMD_086 (uint8_t)(0xAD)
125 | #define CMD_087 (uint8_t)(0xAE)
126 | #define CMD_088 (uint8_t)(0xB0)
127 | #define CMD_089 (uint8_t)(0xB3)
128 | #define CMD_090 (uint8_t)(0xB5)
129 | #define CMD_091 (uint8_t)(0xB6)
130 | #define CMD_092 (uint8_t)(0xB9)
131 | #define CMD_093 (uint8_t)(0xBA)
132 | #define CMD_094 (uint8_t)(0xBC)
133 | #define CMD_095 (uint8_t)(0xBF)
134 | #define CMD_096 (uint8_t)(0xC1)
135 | #define CMD_097 (uint8_t)(0xC2)
136 | #define CMD_098 (uint8_t)(0xC4)
137 | #define CMD_099 (uint8_t)(0xC7)
138 | #define CMD_100 (uint8_t)(0xC8)
139 | #define CMD_101 (uint8_t)(0xCB)
140 | #define CMD_102 (uint8_t)(0xCD)
141 | #define CMD_103 (uint8_t)(0xCE)
142 | #define CMD_104 (uint8_t)(0xD0)
143 | #define CMD_105 (uint8_t)(0xD3)
144 | #define CMD_106 (uint8_t)(0xD5)
145 | #define CMD_107 (uint8_t)(0xD6)
146 | #define CMD_108 (uint8_t)(0xD9)
147 | #define CMD_109 (uint8_t)(0xDA)
148 | #define CMD_110 (uint8_t)(0xDC)
149 | #define CMD_111 (uint8_t)(0xDF)
150 | #define CMD_112 (uint8_t)(0xE0)
151 | #define CMD_113 (uint8_t)(0xE3)
152 | #define CMD_114 (uint8_t)(0xE5)
153 | #define CMD_115 (uint8_t)(0xE6)
154 | #define CMD_116 (uint8_t)(0xE9)
155 | #define CMD_117 (uint8_t)(0xEA)
156 | #define CMD_118 (uint8_t)(0xEC)
157 | #define CMD_119 (uint8_t)(0xEF)
158 | #define CMD_120 (uint8_t)(0xF1)
159 | #define CMD_121 (uint8_t)(0xF2)
160 | #define CMD_122 (uint8_t)(0xF4)
161 | #define CMD_123 (uint8_t)(0xF7)
162 | #define CMD_124 (uint8_t)(0xF8)
163 | #define CMD_125 (uint8_t)(0xFB)
164 | #define CMD_126 (uint8_t)(0xFD)
165 | #define CMD_127 (uint8_t)(0xFE)
166 |
167 | /******************************* end of CarettaBMS_CMD.c *******************************/
--------------------------------------------------------------------------------
/CellModule/CarettaBMS/CarettaBMS.cproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 2.0
5 | 7.0
6 | com.Atmel.AVRGCC8.C
7 | dce6c7e3-ee26-4d79-826b-08594b9ad897
8 | ATtiny402
9 | none
10 | Executable
11 | C
12 | $(MSBuildProjectName)
13 | .elf
14 | $(MSBuildProjectDirectory)\$(Configuration)
15 | CarettaBMS
16 | CarettaBMS
17 | CarettaBMS
18 | Native
19 | true
20 | false
21 | true
22 | true
23 | 0x20000000
24 |
25 | true
26 | exception_table
27 | 2
28 | 0
29 | 0
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | com.atmel.avrdbg.tool.atmelice
44 | J42700000107
45 | 0x1E9227
46 | UPDI
47 |
48 |
49 |
50 | 500000
51 |
52 | UPDI
53 |
54 | com.atmel.avrdbg.tool.atmelice
55 | J42700000107
56 | Atmel-ICE
57 |
58 | 500000
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 | com.atmel.avrdbg.tool.simulator
67 |
68 |
69 | Simulator
70 |
71 |
72 |
73 |
74 |
75 | -mmcu=attiny402 -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.3.229\gcc\dev\attiny402"
76 | True
77 | True
78 | True
79 | True
80 | False
81 | True
82 | True
83 |
84 |
85 | NDEBUG
86 |
87 |
88 |
89 |
90 | %24(PackRepoDir)\atmel\ATtiny_DFP\1.3.229\include
91 |
92 |
93 | Optimize for size (-Os)
94 | True
95 | True
96 | True
97 |
98 |
99 | libm
100 |
101 |
102 |
103 |
104 | %24(PackRepoDir)\atmel\ATtiny_DFP\1.3.229\include
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 | -mmcu=attiny402 -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.3.229\gcc\dev\attiny402"
114 | True
115 | True
116 | True
117 | True
118 | False
119 | True
120 | True
121 |
122 |
123 | DEBUG
124 |
125 |
126 |
127 |
128 | %24(PackRepoDir)\atmel\ATtiny_DFP\1.3.229\include
129 |
130 |
131 | Optimize for size (-Os)
132 | True
133 | True
134 | Default (-g2)
135 | True
136 |
137 |
138 | libm
139 |
140 |
141 |
142 |
143 | .text=0x0100
144 |
145 |
146 |
147 |
148 | %24(PackRepoDir)\atmel\ATtiny_DFP\1.3.229\include
149 |
150 |
151 | Default (-Wa,-g)
152 |
153 |
154 | srec_cat "$(OutputDirectory)\$(OutputFileName).hex" -intel -crop 0x200 0xFFE -fill 0xFF 0x200 0xFFE -CRC16_Big_Endian 0xFFE -xmodem -o "$(OutputFileName)_crc.hex" -intel -line-length=44
155 |
156 |
157 |
158 | compile
159 |
160 |
161 | compile
162 |
163 |
164 | compile
165 |
166 |
167 | compile
168 |
169 |
170 | compile
171 |
172 |
173 |
174 |
--------------------------------------------------------------------------------
/Doc/UARTcom.md:
--------------------------------------------------------------------------------
1 | ---
2 | filename: 07_UARTcom
3 | title: UART
4 | layout: main
5 | filename: UARTcom.md
6 | ---
7 | # Non-isolated UART communication
8 |
9 | The UART communication interface was selected as the primary communication interface. UART is a good choice mainly due to its widespread use. Communication is asynchronous, where we do not need a clock signal, so only one wire is needed between the modules. The advantage of one wire is that it is cheaper than two and also more practical in the installation of the system. The cheapest possible components and also the minimum number of components are being used to make the communication possible. The biggest problems during the design of the communication interface were caused by the protection diodes on the processor pins, but in the end we were able to exploited their purpose in some way.
10 |
11 | ## The Problem
12 |
13 | The problem with cell modules is that processors are not powered from the same voltage source, but still have to communicate with each other. They are even powered with an offset voltages. Two neighboring processors have connected Vcc and GND pins. The model of this connection is shown in the figure below:
14 |
15 | 
16 |
17 | Lower processor (processor 2) can receive 2 different voltage levels from upper processors. The first level is at the output of logic 0 from upper processor. Upper processor reads this state as 0V, but for lower processor this is its own supply voltage or logic 1. No problems so far, we only get the reverse logic and all voltages are still in the operating range of both processors. At the second level output, logic 1 from the upper processor some problems occur. For the lower processor this level means its supply voltage plus the supply voltage of the upper processor. Now this level is no longer allowed. The voltage is just too high for lower processor. The challenge was how to adjust these two voltage levels to the lower processor so that it can easily receive the signal from the upper processor.
18 |
19 | There are many solutions that could work, but they are not in line with the requirements. The problem is that all solutions have at least one semiconductor element. A single semiconductor element would quickly raise the cost of the required components. However with a clever use of processors peripherals, it is possible to achieve a successful communication and only with the use of two external resistors. The resistors serve as a voltage divider and limit the current through the protection diodes.
20 |
21 | ## The solution
22 |
23 | 
24 |
25 | An build-in analog comparator (AC) is used to distinguished the signal level. The processor voltage supply is connected to the non-inverting input of the AC and 80% of the UART signal from the upper processor to the positive input. Resistors with large values were chosen for the voltage divider and for two reasons. A first, 80% of the signals voltage level is still too much for the lower processor. The current flowing through the protection diodes is limited by the use of larger resistors. Small current does not damage the diodes. The purpose of the diodes is to only keep the voltage within acceptable limits. The second reason is that we wanted to have as low static power consumption as possible, because the module is powered by a battery.
26 |
27 | A more detailed explanation is needed to fully understand how communication works. The AC output indicates whether the UART signal voltage is less than or greater than the processor supply voltage. This is a very important piece of information that we need to get to the processor's UART receiver. The processor allows us to connect the AC output to the physical output pin of the processor. This output pin can then be easily connected to the input pin of the processor on which the UART receiver is located. However, to be able to do that, we need both one free output pin and one free input pint. Selected processor has very few pins and we don't have enough remaining free pins to make this solution feasible. A closer inspection of the "PORT" unit revealed that we only need a single processor input pin, for both signals, the rest can be solved with a single if statement in software by changing the invert enable signal of the processors input pin.
28 |
29 | A very similar method with the AC is used to detect zero cross of mains supply. But the described use of AC on a cell module is a bit more demanding. We didn't see anyone using an AC to trigger the UART receiver. This area of the system needed a bit more research. The solution raises two questions, "Will the communication work over the entire BMS operating voltage range from 1.8V and up to 5.0V?" and "How will communication be resistant to interference?".
30 |
31 | ## Resistor divider
32 |
33 | Of great importance is the resistor divider division factor, which will ensure that the communication will operate in the entire voltage range of the BMS. At first, this seems like a simple problem, but like so many others, it quickly turned out to be a little more difficult. We previously mentioned that the UART signal levels from the upper module are compared to the cell voltage, which is not quite true. If that would be possible, it would be much easier. Once again it turns our we don't have enough free pins available. To overcome this problem we utilize built-in voltage reference to approximate the supply voltage. On the positive AC input is connected UART signal and on the negative input the voltage reference of 4.3V. The selected reference is the highest available in the processor. The highest reference will be the closest to supply voltage in the entire voltage range of the processor (1.8V - 5V). We don't use the reference for its true purpose, but only to give us an approximation of the supply voltage. The reference is only valid when powered by 4.8V or more. With a cell module, this will never happen. The voltage reference will always be in its "linear" range. Normally the reference is always used in the "saturated" state. In its linear range, the reference voltage output will be a few percent below the supply voltage all the time. This is very useful because the voltage reference is going to give us a sufficient approximation of the supply voltage and we do not need an additional processor input. Due to a bit different use of the voltage reference, we do not have enough data, because such use is not documented in the processors datasheet. We needed a snapshot of the reference output in the entire voltage range of the processor. The recorded characteristic is shown in the figure below.
34 |
35 | 
36 |
37 | The characteristic was recorded with a built-in ADC and by changing the processor supply voltage. From the characteristic, a simplified reference model was created, which is shown by the equations.
38 |
39 |
41 |
42 |
50 |
51 | To identify a low signal level, the output from the voltage divider must be lower than the reference voltage and to detect a high level, it must be higher. These situations are described to us by inequalities:
52 |
53 |
55 |
56 |
58 |
59 | From both inequalities we can express the divisible relation r and form one single inequality.
60 |
61 |
63 |
64 |
65 |
66 | We can now insert real numbers into the inequality. We need to insert the voltages at which we get the smallest range of the voltage divider ratio. By solving these two inequalities, we have obtained only the range in which the division ratio must be. Due to the nonlinear characteristic of the voltage reference, the resistance tolerances and other nonlinearities of the system, this is not enough to determent the perfect dividing ratio. The use of resistors with low tolerances is also not desirable because these resistors will increase the price of the components. We even have to look at the voltage range of the system for all possible deviations of the voltage divider ratio due to resistance tolerances. For that purpose, we need equations that describe the voltage differences between the signal levels and the voltage reference. The difference between logic output 1 from the upper processor and the reference voltage of the lower processor must always be positive and vice versa for logic output 0, where the difference must always be negative. This is nicely described by the equations below:
67 |
68 |
70 |
71 |
73 |
74 | Because the cell module uses an AC and UART receiver on the same processor input, it is important that this input always has the same and defined state. We want the processors input to always have a logical state of 1. This criterion must also be considered and is given to us by the equation:
75 |
76 |
78 |
79 | In all three above equations we have a division ratio. Due to the resistance tolerances, the division ratio is not an exact value, but is located on the certain interval. The next equation below gives us a division ratio error due to the influence of resistance tolerances, where e1 is the tolerance for R1 in percent and e2 for the resistance R2
80 |
81 |
84 |
85 | With this division ratio error factor, we can extend previous inequalities. The graph in the figure below tells us all possible solutions of the inequalities. The most critical points are those closest to the X axis of the graph. The points can be identified very quickly. The critical points in the low and high signal curves must both be equidistant from the axis of the graph.
86 |
87 | 
88 |
89 | If we combine all the conditions and insert all the parameters, we finally get a division ratio of 0.79. The division ratio can be realized using resistors from the E6 scale with 20% tolerances.
90 |
91 | ## AC output status bit as UART signal
92 |
93 | The main problem was programmatically creating a connection between the AC status register and the UART receiver. The AC output status is written in one of the bits of the AC status register and the state of this bit needs to be transferred to the UART receiver. After analyzing the "PORT" peripheral unit, we found that the "Invert Enable" signal can be used to programmatically trigger the UART receiver.
94 |
95 | 
96 |
97 | We need to ensure that the signal changes quickly. This was achieved by using interrupts. Each time the AC output is changed, it triggers an interrupt. In the interrupt routine, the "Invert Enable" signal is then quickly set to the correct value. The interrupt routine used is presented in the code section below:
98 |
99 | ```C
100 | ISR(AC0_AC_vect)
101 | {
102 | /* Clear int. flag */
103 | AC0_STATUS = AC_CMP_bm;
104 | /* Invert pin input */
105 | if(!(AC0_STATUS & AC_STATE_bm)) PORTA_PIN7CTRL = PORT_INVEN_bm;
106 | else PORTA_PIN7CTRL = 0x00;
107 | }
108 | ```
109 |
110 | This part of the program proved that the an idea of an non-isolated UART communication works. Later on, other tests have shown that the method is also reliable.
111 |
--------------------------------------------------------------------------------
/Doc/license.md:
--------------------------------------------------------------------------------
1 | ### GNU GENERAL PUBLIC LICENSE
2 |
3 | Version 3, 29 June 2007
4 |
5 | Copyright (C) 2007 Free Software Foundation, Inc.
6 |
7 |
8 | Everyone is permitted to copy and distribute verbatim copies of this
9 | license document, but changing it is not allowed.
10 |
11 | ### Preamble
12 |
13 | The GNU General Public License is a free, copyleft license for
14 | software and other kinds of works.
15 |
16 | The licenses for most software and other practical works are designed
17 | to take away your freedom to share and change the works. By contrast,
18 | the GNU General Public License is intended to guarantee your freedom
19 | to share and change all versions of a program--to make sure it remains
20 | free software for all its users. We, the Free Software Foundation, use
21 | the GNU General Public License for most of our software; it applies
22 | also to any other work released this way by its authors. You can apply
23 | it to your programs, too.
24 |
25 | When we speak of free software, we are referring to freedom, not
26 | price. Our General Public Licenses are designed to make sure that you
27 | have the freedom to distribute copies of free software (and charge for
28 | them if you wish), that you receive source code or can get it if you
29 | want it, that you can change the software or use pieces of it in new
30 | free programs, and that you know you can do these things.
31 |
32 | To protect your rights, we need to prevent others from denying you
33 | these rights or asking you to surrender the rights. Therefore, you
34 | have certain responsibilities if you distribute copies of the
35 | software, or if you modify it: responsibilities to respect the freedom
36 | of others.
37 |
38 | For example, if you distribute copies of such a program, whether
39 | gratis or for a fee, you must pass on to the recipients the same
40 | freedoms that you received. You must make sure that they, too, receive
41 | or can get the source code. And you must show them these terms so they
42 | know their rights.
43 |
44 | Developers that use the GNU GPL protect your rights with two steps:
45 | (1) assert copyright on the software, and (2) offer you this License
46 | giving you legal permission to copy, distribute and/or modify it.
47 |
48 | For the developers' and authors' protection, the GPL clearly explains
49 | that there is no warranty for this free software. For both users' and
50 | authors' sake, the GPL requires that modified versions be marked as
51 | changed, so that their problems will not be attributed erroneously to
52 | authors of previous versions.
53 |
54 | Some devices are designed to deny users access to install or run
55 | modified versions of the software inside them, although the
56 | manufacturer can do so. This is fundamentally incompatible with the
57 | aim of protecting users' freedom to change the software. The
58 | systematic pattern of such abuse occurs in the area of products for
59 | individuals to use, which is precisely where it is most unacceptable.
60 | Therefore, we have designed this version of the GPL to prohibit the
61 | practice for those products. If such problems arise substantially in
62 | other domains, we stand ready to extend this provision to those
63 | domains in future versions of the GPL, as needed to protect the
64 | freedom of users.
65 |
66 | Finally, every program is threatened constantly by software patents.
67 | States should not allow patents to restrict development and use of
68 | software on general-purpose computers, but in those that do, we wish
69 | to avoid the special danger that patents applied to a free program
70 | could make it effectively proprietary. To prevent this, the GPL
71 | assures that patents cannot be used to render the program non-free.
72 |
73 | The precise terms and conditions for copying, distribution and
74 | modification follow.
75 |
76 | ### TERMS AND CONDITIONS
77 |
78 | #### 0. Definitions.
79 |
80 | "This License" refers to version 3 of the GNU General Public License.
81 |
82 | "Copyright" also means copyright-like laws that apply to other kinds
83 | of works, such as semiconductor masks.
84 |
85 | "The Program" refers to any copyrightable work licensed under this
86 | License. Each licensee is addressed as "you". "Licensees" and
87 | "recipients" may be individuals or organizations.
88 |
89 | To "modify" a work means to copy from or adapt all or part of the work
90 | in a fashion requiring copyright permission, other than the making of
91 | an exact copy. The resulting work is called a "modified version" of
92 | the earlier work or a work "based on" the earlier work.
93 |
94 | A "covered work" means either the unmodified Program or a work based
95 | on the Program.
96 |
97 | To "propagate" a work means to do anything with it that, without
98 | permission, would make you directly or secondarily liable for
99 | infringement under applicable copyright law, except executing it on a
100 | computer or modifying a private copy. Propagation includes copying,
101 | distribution (with or without modification), making available to the
102 | public, and in some countries other activities as well.
103 |
104 | To "convey" a work means any kind of propagation that enables other
105 | parties to make or receive copies. Mere interaction with a user
106 | through a computer network, with no transfer of a copy, is not
107 | conveying.
108 |
109 | An interactive user interface displays "Appropriate Legal Notices" to
110 | the extent that it includes a convenient and prominently visible
111 | feature that (1) displays an appropriate copyright notice, and (2)
112 | tells the user that there is no warranty for the work (except to the
113 | extent that warranties are provided), that licensees may convey the
114 | work under this License, and how to view a copy of this License. If
115 | the interface presents a list of user commands or options, such as a
116 | menu, a prominent item in the list meets this criterion.
117 |
118 | #### 1. Source Code.
119 |
120 | The "source code" for a work means the preferred form of the work for
121 | making modifications to it. "Object code" means any non-source form of
122 | a work.
123 |
124 | A "Standard Interface" means an interface that either is an official
125 | standard defined by a recognized standards body, or, in the case of
126 | interfaces specified for a particular programming language, one that
127 | is widely used among developers working in that language.
128 |
129 | The "System Libraries" of an executable work include anything, other
130 | than the work as a whole, that (a) is included in the normal form of
131 | packaging a Major Component, but which is not part of that Major
132 | Component, and (b) serves only to enable use of the work with that
133 | Major Component, or to implement a Standard Interface for which an
134 | implementation is available to the public in source code form. A
135 | "Major Component", in this context, means a major essential component
136 | (kernel, window system, and so on) of the specific operating system
137 | (if any) on which the executable work runs, or a compiler used to
138 | produce the work, or an object code interpreter used to run it.
139 |
140 | The "Corresponding Source" for a work in object code form means all
141 | the source code needed to generate, install, and (for an executable
142 | work) run the object code and to modify the work, including scripts to
143 | control those activities. However, it does not include the work's
144 | System Libraries, or general-purpose tools or generally available free
145 | programs which are used unmodified in performing those activities but
146 | which are not part of the work. For example, Corresponding Source
147 | includes interface definition files associated with source files for
148 | the work, and the source code for shared libraries and dynamically
149 | linked subprograms that the work is specifically designed to require,
150 | such as by intimate data communication or control flow between those
151 | subprograms and other parts of the work.
152 |
153 | The Corresponding Source need not include anything that users can
154 | regenerate automatically from other parts of the Corresponding Source.
155 |
156 | The Corresponding Source for a work in source code form is that same
157 | work.
158 |
159 | #### 2. Basic Permissions.
160 |
161 | All rights granted under this License are granted for the term of
162 | copyright on the Program, and are irrevocable provided the stated
163 | conditions are met. This License explicitly affirms your unlimited
164 | permission to run the unmodified Program. The output from running a
165 | covered work is covered by this License only if the output, given its
166 | content, constitutes a covered work. This License acknowledges your
167 | rights of fair use or other equivalent, as provided by copyright law.
168 |
169 | You may make, run and propagate covered works that you do not convey,
170 | without conditions so long as your license otherwise remains in force.
171 | You may convey covered works to others for the sole purpose of having
172 | them make modifications exclusively for you, or provide you with
173 | facilities for running those works, provided that you comply with the
174 | terms of this License in conveying all material for which you do not
175 | control copyright. Those thus making or running the covered works for
176 | you must do so exclusively on your behalf, under your direction and
177 | control, on terms that prohibit them from making any copies of your
178 | copyrighted material outside their relationship with you.
179 |
180 | Conveying under any other circumstances is permitted solely under the
181 | conditions stated below. Sublicensing is not allowed; section 10 makes
182 | it unnecessary.
183 |
184 | #### 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
185 |
186 | No covered work shall be deemed part of an effective technological
187 | measure under any applicable law fulfilling obligations under article
188 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
189 | similar laws prohibiting or restricting circumvention of such
190 | measures.
191 |
192 | When you convey a covered work, you waive any legal power to forbid
193 | circumvention of technological measures to the extent such
194 | circumvention is effected by exercising rights under this License with
195 | respect to the covered work, and you disclaim any intention to limit
196 | operation or modification of the work as a means of enforcing, against
197 | the work's users, your or third parties' legal rights to forbid
198 | circumvention of technological measures.
199 |
200 | #### 4. Conveying Verbatim Copies.
201 |
202 | You may convey verbatim copies of the Program's source code as you
203 | receive it, in any medium, provided that you conspicuously and
204 | appropriately publish on each copy an appropriate copyright notice;
205 | keep intact all notices stating that this License and any
206 | non-permissive terms added in accord with section 7 apply to the code;
207 | keep intact all notices of the absence of any warranty; and give all
208 | recipients a copy of this License along with the Program.
209 |
210 | You may charge any price or no price for each copy that you convey,
211 | and you may offer support or warranty protection for a fee.
212 |
213 | #### 5. Conveying Modified Source Versions.
214 |
215 | You may convey a work based on the Program, or the modifications to
216 | produce it from the Program, in the form of source code under the
217 | terms of section 4, provided that you also meet all of these
218 | conditions:
219 |
220 | - a) The work must carry prominent notices stating that you modified
221 | it, and giving a relevant date.
222 | - b) The work must carry prominent notices stating that it is
223 | released under this License and any conditions added under
224 | section 7. This requirement modifies the requirement in section 4
225 | to "keep intact all notices".
226 | - c) You must license the entire work, as a whole, under this
227 | License to anyone who comes into possession of a copy. This
228 | License will therefore apply, along with any applicable section 7
229 | additional terms, to the whole of the work, and all its parts,
230 | regardless of how they are packaged. This License gives no
231 | permission to license the work in any other way, but it does not
232 | invalidate such permission if you have separately received it.
233 | - d) If the work has interactive user interfaces, each must display
234 | Appropriate Legal Notices; however, if the Program has interactive
235 | interfaces that do not display Appropriate Legal Notices, your
236 | work need not make them do so.
237 |
238 | A compilation of a covered work with other separate and independent
239 | works, which are not by their nature extensions of the covered work,
240 | and which are not combined with it such as to form a larger program,
241 | in or on a volume of a storage or distribution medium, is called an
242 | "aggregate" if the compilation and its resulting copyright are not
243 | used to limit the access or legal rights of the compilation's users
244 | beyond what the individual works permit. Inclusion of a covered work
245 | in an aggregate does not cause this License to apply to the other
246 | parts of the aggregate.
247 |
248 | #### 6. Conveying Non-Source Forms.
249 |
250 | You may convey a covered work in object code form under the terms of
251 | sections 4 and 5, provided that you also convey the machine-readable
252 | Corresponding Source under the terms of this License, in one of these
253 | ways:
254 |
255 | - a) Convey the object code in, or embodied in, a physical product
256 | (including a physical distribution medium), accompanied by the
257 | Corresponding Source fixed on a durable physical medium
258 | customarily used for software interchange.
259 | - b) Convey the object code in, or embodied in, a physical product
260 | (including a physical distribution medium), accompanied by a
261 | written offer, valid for at least three years and valid for as
262 | long as you offer spare parts or customer support for that product
263 | model, to give anyone who possesses the object code either (1) a
264 | copy of the Corresponding Source for all the software in the
265 | product that is covered by this License, on a durable physical
266 | medium customarily used for software interchange, for a price no
267 | more than your reasonable cost of physically performing this
268 | conveying of source, or (2) access to copy the Corresponding
269 | Source from a network server at no charge.
270 | - c) Convey individual copies of the object code with a copy of the
271 | written offer to provide the Corresponding Source. This
272 | alternative is allowed only occasionally and noncommercially, and
273 | only if you received the object code with such an offer, in accord
274 | with subsection 6b.
275 | - d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 | - e) Convey the object code using peer-to-peer transmission,
288 | provided you inform other peers where the object code and
289 | Corresponding Source of the work are being offered to the general
290 | public at no charge under subsection 6d.
291 |
292 | A separable portion of the object code, whose source code is excluded
293 | from the Corresponding Source as a System Library, need not be
294 | included in conveying the object code work.
295 |
296 | A "User Product" is either (1) a "consumer product", which means any
297 | tangible personal property which is normally used for personal,
298 | family, or household purposes, or (2) anything designed or sold for
299 | incorporation into a dwelling. In determining whether a product is a
300 | consumer product, doubtful cases shall be resolved in favor of
301 | coverage. For a particular product received by a particular user,
302 | "normally used" refers to a typical or common use of that class of
303 | product, regardless of the status of the particular user or of the way
304 | in which the particular user actually uses, or expects or is expected
305 | to use, the product. A product is a consumer product regardless of
306 | whether the product has substantial commercial, industrial or
307 | non-consumer uses, unless such uses represent the only significant
308 | mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to
312 | install and execute modified versions of a covered work in that User
313 | Product from a modified version of its Corresponding Source. The
314 | information must suffice to ensure that the continued functioning of
315 | the modified object code is in no case prevented or interfered with
316 | solely because modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or
331 | updates for a work that has been modified or installed by the
332 | recipient, or for the User Product in which it has been modified or
333 | installed. Access to a network may be denied when the modification
334 | itself materially and adversely affects the operation of the network
335 | or violates the rules and protocols for communication across the
336 | network.
337 |
338 | Corresponding Source conveyed, and Installation Information provided,
339 | in accord with this section must be in a format that is publicly
340 | documented (and with an implementation available to the public in
341 | source code form), and must require no special password or key for
342 | unpacking, reading or copying.
343 |
344 | #### 7. Additional Terms.
345 |
346 | "Additional permissions" are terms that supplement the terms of this
347 | License by making exceptions from one or more of its conditions.
348 | Additional permissions that are applicable to the entire Program shall
349 | be treated as though they were included in this License, to the extent
350 | that they are valid under applicable law. If additional permissions
351 | apply only to part of the Program, that part may be used separately
352 | under those permissions, but the entire Program remains governed by
353 | this License without regard to the additional permissions.
354 |
355 | When you convey a copy of a covered work, you may at your option
356 | remove any additional permissions from that copy, or from any part of
357 | it. (Additional permissions may be written to require their own
358 | removal in certain cases when you modify the work.) You may place
359 | additional permissions on material, added by you to a covered work,
360 | for which you have or can give appropriate copyright permission.
361 |
362 | Notwithstanding any other provision of this License, for material you
363 | add to a covered work, you may (if authorized by the copyright holders
364 | of that material) supplement the terms of this License with terms:
365 |
366 | - a) Disclaiming warranty or limiting liability differently from the
367 | terms of sections 15 and 16 of this License; or
368 | - b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 | - c) Prohibiting misrepresentation of the origin of that material,
372 | or requiring that modified versions of such material be marked in
373 | reasonable ways as different from the original version; or
374 | - d) Limiting the use for publicity purposes of names of licensors
375 | or authors of the material; or
376 | - e) Declining to grant rights under trademark law for use of some
377 | trade names, trademarks, or service marks; or
378 | - f) Requiring indemnification of licensors and authors of that
379 | material by anyone who conveys the material (or modified versions
380 | of it) with contractual assumptions of liability to the recipient,
381 | for any liability that these contractual assumptions directly
382 | impose on those licensors and authors.
383 |
384 | All other non-permissive additional terms are considered "further
385 | restrictions" within the meaning of section 10. If the Program as you
386 | received it, or any part of it, contains a notice stating that it is
387 | governed by this License along with a term that is a further
388 | restriction, you may remove that term. If a license document contains
389 | a further restriction but permits relicensing or conveying under this
390 | License, you may add to a covered work material governed by the terms
391 | of that license document, provided that the further restriction does
392 | not survive such relicensing or conveying.
393 |
394 | If you add terms to a covered work in accord with this section, you
395 | must place, in the relevant source files, a statement of the
396 | additional terms that apply to those files, or a notice indicating
397 | where to find the applicable terms.
398 |
399 | Additional terms, permissive or non-permissive, may be stated in the
400 | form of a separately written license, or stated as exceptions; the
401 | above requirements apply either way.
402 |
403 | #### 8. Termination.
404 |
405 | You may not propagate or modify a covered work except as expressly
406 | provided under this License. Any attempt otherwise to propagate or
407 | modify it is void, and will automatically terminate your rights under
408 | this License (including any patent licenses granted under the third
409 | paragraph of section 11).
410 |
411 | However, if you cease all violation of this License, then your license
412 | from a particular copyright holder is reinstated (a) provisionally,
413 | unless and until the copyright holder explicitly and finally
414 | terminates your license, and (b) permanently, if the copyright holder
415 | fails to notify you of the violation by some reasonable means prior to
416 | 60 days after the cessation.
417 |
418 | Moreover, your license from a particular copyright holder is
419 | reinstated permanently if the copyright holder notifies you of the
420 | violation by some reasonable means, this is the first time you have
421 | received notice of violation of this License (for any work) from that
422 | copyright holder, and you cure the violation prior to 30 days after
423 | your receipt of the notice.
424 |
425 | Termination of your rights under this section does not terminate the
426 | licenses of parties who have received copies or rights from you under
427 | this License. If your rights have been terminated and not permanently
428 | reinstated, you do not qualify to receive new licenses for the same
429 | material under section 10.
430 |
431 | #### 9. Acceptance Not Required for Having Copies.
432 |
433 | You are not required to accept this License in order to receive or run
434 | a copy of the Program. Ancillary propagation of a covered work
435 | occurring solely as a consequence of using peer-to-peer transmission
436 | to receive a copy likewise does not require acceptance. However,
437 | nothing other than this License grants you permission to propagate or
438 | modify any covered work. These actions infringe copyright if you do
439 | not accept this License. Therefore, by modifying or propagating a
440 | covered work, you indicate your acceptance of this License to do so.
441 |
442 | #### 10. Automatic Licensing of Downstream Recipients.
443 |
444 | Each time you convey a covered work, the recipient automatically
445 | receives a license from the original licensors, to run, modify and
446 | propagate that work, subject to this License. You are not responsible
447 | for enforcing compliance by third parties with this License.
448 |
449 | An "entity transaction" is a transaction transferring control of an
450 | organization, or substantially all assets of one, or subdividing an
451 | organization, or merging organizations. If propagation of a covered
452 | work results from an entity transaction, each party to that
453 | transaction who receives a copy of the work also receives whatever
454 | licenses to the work the party's predecessor in interest had or could
455 | give under the previous paragraph, plus a right to possession of the
456 | Corresponding Source of the work from the predecessor in interest, if
457 | the predecessor has it or can get it with reasonable efforts.
458 |
459 | You may not impose any further restrictions on the exercise of the
460 | rights granted or affirmed under this License. For example, you may
461 | not impose a license fee, royalty, or other charge for exercise of
462 | rights granted under this License, and you may not initiate litigation
463 | (including a cross-claim or counterclaim in a lawsuit) alleging that
464 | any patent claim is infringed by making, using, selling, offering for
465 | sale, or importing the Program or any portion of it.
466 |
467 | #### 11. Patents.
468 |
469 | A "contributor" is a copyright holder who authorizes use under this
470 | License of the Program or a work on which the Program is based. The
471 | work thus licensed is called the contributor's "contributor version".
472 |
473 | A contributor's "essential patent claims" are all patent claims owned
474 | or controlled by the contributor, whether already acquired or
475 | hereafter acquired, that would be infringed by some manner, permitted
476 | by this License, of making, using, or selling its contributor version,
477 | but do not include claims that would be infringed only as a
478 | consequence of further modification of the contributor version. For
479 | purposes of this definition, "control" includes the right to grant
480 | patent sublicenses in a manner consistent with the requirements of
481 | this License.
482 |
483 | Each contributor grants you a non-exclusive, worldwide, royalty-free
484 | patent license under the contributor's essential patent claims, to
485 | make, use, sell, offer for sale, import and otherwise run, modify and
486 | propagate the contents of its contributor version.
487 |
488 | In the following three paragraphs, a "patent license" is any express
489 | agreement or commitment, however denominated, not to enforce a patent
490 | (such as an express permission to practice a patent or covenant not to
491 | sue for patent infringement). To "grant" such a patent license to a
492 | party means to make such an agreement or commitment not to enforce a
493 | patent against the party.
494 |
495 | If you convey a covered work, knowingly relying on a patent license,
496 | and the Corresponding Source of the work is not available for anyone
497 | to copy, free of charge and under the terms of this License, through a
498 | publicly available network server or other readily accessible means,
499 | then you must either (1) cause the Corresponding Source to be so
500 | available, or (2) arrange to deprive yourself of the benefit of the
501 | patent license for this particular work, or (3) arrange, in a manner
502 | consistent with the requirements of this License, to extend the patent
503 | license to downstream recipients. "Knowingly relying" means you have
504 | actual knowledge that, but for the patent license, your conveying the
505 | covered work in a country, or your recipient's use of the covered work
506 | in a country, would infringe one or more identifiable patents in that
507 | country that you have reason to believe are valid.
508 |
509 | If, pursuant to or in connection with a single transaction or
510 | arrangement, you convey, or propagate by procuring conveyance of, a
511 | covered work, and grant a patent license to some of the parties
512 | receiving the covered work authorizing them to use, propagate, modify
513 | or convey a specific copy of the covered work, then the patent license
514 | you grant is automatically extended to all recipients of the covered
515 | work and works based on it.
516 |
517 | A patent license is "discriminatory" if it does not include within the
518 | scope of its coverage, prohibits the exercise of, or is conditioned on
519 | the non-exercise of one or more of the rights that are specifically
520 | granted under this License. You may not convey a covered work if you
521 | are a party to an arrangement with a third party that is in the
522 | business of distributing software, under which you make payment to the
523 | third party based on the extent of your activity of conveying the
524 | work, and under which the third party grants, to any of the parties
525 | who would receive the covered work from you, a discriminatory patent
526 | license (a) in connection with copies of the covered work conveyed by
527 | you (or copies made from those copies), or (b) primarily for and in
528 | connection with specific products or compilations that contain the
529 | covered work, unless you entered into that arrangement, or that patent
530 | license was granted, prior to 28 March 2007.
531 |
532 | Nothing in this License shall be construed as excluding or limiting
533 | any implied license or other defenses to infringement that may
534 | otherwise be available to you under applicable patent law.
535 |
536 | #### 12. No Surrender of Others' Freedom.
537 |
538 | If conditions are imposed on you (whether by court order, agreement or
539 | otherwise) that contradict the conditions of this License, they do not
540 | excuse you from the conditions of this License. If you cannot convey a
541 | covered work so as to satisfy simultaneously your obligations under
542 | this License and any other pertinent obligations, then as a
543 | consequence you may not convey it at all. For example, if you agree to
544 | terms that obligate you to collect a royalty for further conveying
545 | from those to whom you convey the Program, the only way you could
546 | satisfy both those terms and this License would be to refrain entirely
547 | from conveying the Program.
548 |
549 | #### 13. Use with the GNU Affero General Public License.
550 |
551 | Notwithstanding any other provision of this License, you have
552 | permission to link or combine any covered work with a work licensed
553 | under version 3 of the GNU Affero General Public License into a single
554 | combined work, and to convey the resulting work. The terms of this
555 | License will continue to apply to the part which is the covered work,
556 | but the special requirements of the GNU Affero General Public License,
557 | section 13, concerning interaction through a network will apply to the
558 | combination as such.
559 |
560 | #### 14. Revised Versions of this License.
561 |
562 | The Free Software Foundation may publish revised and/or new versions
563 | of the GNU General Public License from time to time. Such new versions
564 | will be similar in spirit to the present version, but may differ in
565 | detail to address new problems or concerns.
566 |
567 | Each version is given a distinguishing version number. If the Program
568 | specifies that a certain numbered version of the GNU General Public
569 | License "or any later version" applies to it, you have the option of
570 | following the terms and conditions either of that numbered version or
571 | of any later version published by the Free Software Foundation. If the
572 | Program does not specify a version number of the GNU General Public
573 | License, you may choose any version ever published by the Free
574 | Software Foundation.
575 |
576 | If the Program specifies that a proxy can decide which future versions
577 | of the GNU General Public License can be used, that proxy's public
578 | statement of acceptance of a version permanently authorizes you to
579 | choose that version for the Program.
580 |
581 | Later license versions may give you additional or different
582 | permissions. However, no additional obligations are imposed on any
583 | author or copyright holder as a result of your choosing to follow a
584 | later version.
585 |
586 | #### 15. Disclaimer of Warranty.
587 |
588 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
589 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
590 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
591 | WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
592 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
593 | A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
594 | PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
595 | DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
596 | CORRECTION.
597 |
598 | #### 16. Limitation of Liability.
599 |
600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR
602 | CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
603 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
604 | ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
605 | NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR
606 | LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM
607 | TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
608 | PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
609 |
610 | #### 17. Interpretation of Sections 15 and 16.
611 |
612 | If the disclaimer of warranty and limitation of liability provided
613 | above cannot be given local legal effect according to their terms,
614 | reviewing courts shall apply local law that most closely approximates
615 | an absolute waiver of all civil liability in connection with the
616 | Program, unless a warranty or assumption of liability accompanies a
617 | copy of the Program in return for a fee.
618 |
619 | END OF TERMS AND CONDITIONS
620 |
621 | ### How to Apply These Terms to Your New Programs
622 |
623 | If you develop a new program, and you want it to be of the greatest
624 | possible use to the public, the best way to achieve this is to make it
625 | free software which everyone can redistribute and change under these
626 | terms.
627 |
628 | To do so, attach the following notices to the program. It is safest to
629 | attach them to the start of each source file to most effectively state
630 | the exclusion of warranty; and each file should have at least the
631 | "copyright" line and a pointer to where the full notice is found.
632 |
633 |
634 | Copyright (C)
635 |
636 | This program is free software: you can redistribute it and/or modify
637 | it under the terms of the GNU General Public License as published by
638 | the Free Software Foundation, either version 3 of the License, or
639 | (at your option) any later version.
640 |
641 | This program is distributed in the hope that it will be useful,
642 | but WITHOUT ANY WARRANTY; without even the implied warranty of
643 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
644 | GNU General Public License for more details.
645 |
646 | You should have received a copy of the GNU General Public License
647 | along with this program. If not, see .
648 |
649 | Also add information on how to contact you by electronic and paper
650 | mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands \`show w' and \`show c' should show the
661 | appropriate parts of the General Public License. Of course, your
662 | program's commands might be different; for a GUI interface, you would
663 | use an "about box".
664 |
665 | You should also get your employer (if you work as a programmer) or
666 | school, if any, to sign a "copyright disclaimer" for the program, if
667 | necessary. For more information on this, and how to apply and follow
668 | the GNU GPL, see .
669 |
670 | The GNU General Public License does not permit incorporating your
671 | program into proprietary programs. If your program is a subroutine
672 | library, you may consider it more useful to permit linking proprietary
673 | applications with the library. If this is what you want to do, use the
674 | GNU Lesser General Public License instead of this License. But first,
675 | please read .
--------------------------------------------------------------------------------
/CellModule/CarettaBMS/main.c:
--------------------------------------------------------------------------------
1 | /****************************************************************************************
2 | * _____ _ _ ____ __ __ _____
3 | * / ____| | | | | | _ \ | \/ | / ____|
4 | * | | __ _ _ __ ___ | |_ | |_ __ _ | |_) | | \ / | | (___
5 | * | | / _` | | '__| / _ \ | __| | __| / _` | | _ < | |\/| | \___ \
6 | * | |____ | (_| | | | | __/ | |_ | |_ | (_| | | |_) | | | | | ____) |
7 | * \_____| \__,_| |_| \___| \__| \__| \__,_| |____/ |_| |_| |_____/
8 | *
9 | ***************************************************************************************/
10 |
11 | /************************************************************************************//**
12 | * \file main.c
13 | * \brief CarettaBMS, Open source BMS
14 | * \internal
15 | *----------------------------------------------------------------------------------------
16 | * L I C E N S E
17 | *----------------------------------------------------------------------------------------
18 | * This file is part of CarettaBMS. CarettaBMS is free software: you can redistribute it
19 | * and/or modify it under the terms of the GNU General Public License version 3 as
20 | * published by the Free Software Foundation.
21 | *
22 | * CarettaBMS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
23 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
24 | * PURPOSE. See the GNU General Public License for more details.
25 | *
26 | * You have received a copy of the GNU General Public License along with CarettaBMS. It
27 | * should be located in ".\Doc\license.md". If not, check on gitHub repository to obtain
28 | * a copy.
29 | *
30 | * \endinternal
31 | ****************************************************************************************/
32 |
33 |
34 | /****************************************************************************************
35 | * Include files
36 | ****************************************************************************************/
37 | #include
38 | #include
39 | #include
40 | #include "CarettaBMS_CMD.h"
41 | #include "command.h"
42 | #include "FIFO.h"
43 |
44 |
45 | /****************************************************************************************
46 | * Macro definitions
47 | ****************************************************************************************/
48 | #define F_CPU (3333333333)
49 |
50 | #define RX_BUFFER_SIZE 16
51 | #define TX_BUFFER_SIZE 16
52 |
53 | #define ALARM_BUFFER_SIZE 8
54 |
55 | #define readUserRow(x) (*x)
56 |
57 | #define UR_BOOTLOADER_CONDITION_ADDR ((volatile uint8_t *)(&USERROW_USERROW0 + 31))
58 | #define UR_MODULE_NUMBER_ADDR ((volatile uint8_t *)(&USERROW_USERROW0 + 30))
59 |
60 | #define RESP_OK (uint8_t)(0x0F)
61 |
62 | #define ERROR_UNKNOWN_COMMAND (uint8_t)(0xEA)
63 | #define ERROR_SEQUENCE (uint8_t)(0xEA)
64 |
65 | #define ALARM_OVER_TEMP (uint8_t)(0xA0)
66 | #define ALARM_CPU_OUTATIME (uint8_t)(0xA1)
67 | #define ALARM_RTC_OVERFLOW (uint8_t)(0xA2)
68 | #define ALARM_OVERVOLTAGE (uint8_t)(0xA3)
69 | #define ALARM_CELL_CHARGED (uint8_t)(0xA4)
70 | #define ALARM_CELL_EMPTY (uint8_t)(0xA5)
71 | #define ALARM_UNDERVOLTAGE (uint8_t)(0xA6)
72 | #define ALARM_FRAME_PARITY (uint8_t)(0xA7)
73 |
74 | #define USE_I2C
75 |
76 |
77 | /****************************************************************************************
78 | * Type definitions
79 | ****************************************************************************************/
80 | typedef struct
81 | {
82 | /* Parameters */
83 | volatile uint16_t vrefCalibrated;
84 | volatile uint16_t balanceCurrent;
85 | volatile uint16_t maxTempBMS;
86 | volatile uint16_t maxTempBMSRecover;
87 | volatile uint16_t voltLimitHigh;
88 | volatile uint16_t voltLimitHighRecover;
89 | volatile uint16_t voltageCharged;
90 | volatile uint16_t voltageChargedRecover;
91 | volatile uint16_t voltageEmpty;
92 | volatile uint16_t voltageEmptyRecover;
93 | volatile uint16_t voltLimitLow;
94 | volatile uint16_t voltLimitLowRecover;
95 | volatile uint16_t measureInterval;
96 | volatile uint16_t voltBalanceStart;
97 | volatile uint16_t voltBalanceStop;
98 | volatile uint16_t balanceHysteresis;
99 | volatile uint8_t sleepRequested;
100 | /* program global variables */
101 | volatile uint8_t moduleNum;
102 | volatile uint8_t topModule;
103 | volatile uint16_t targetVoltage;
104 | volatile uint32_t cellVoltage;
105 | volatile uint16_t intTemp;
106 | volatile uint16_t ADCextInput[2];
107 | }tSettings;
108 |
109 |
110 | /****************************************************************************************
111 | * Function prototypes
112 | ****************************************************************************************/
113 | //void task(void);
114 | void syncResponse(void);
115 | void setBalancingCurrent(uint8_t current);
116 | void watchdogConfig(uint8_t x);
117 | void goToBootloader(void);
118 | void goToSleep(uint8_t mode);
119 | void calcVoltageReading(void);
120 | uint16_t takeADCreading(void);
121 | uint8_t readWait(void);
122 | void respondIfBot(uint8_t ch);
123 | void respondIfNotBot(uint8_t ch);
124 | void respond(uint8_t data);
125 | void respondTwoBytes(uint16_t data);
126 | void forwardBufferIfNotBot(void);
127 | void forward(uint8_t data);
128 | uint8_t readSave(void);
129 | void resetProcessor(void);
130 | void twoByteParameter(volatile uint16_t *parameter);
131 | void writeUserRow1byte(volatile uint8_t *addr, uint8_t val);
132 | void emptyAlarmQ(void);
133 | void createAlarm(uint8_t code);
134 | void respondOK(uint8_t respSize);
135 | void respondOKnoPayload(void);
136 | void emptyOutgoingBuffer(void);
137 | void setMeasureInterval(uint16_t interval);
138 | void task(tSettings *p);
139 | void ADCset1V5refMuxIntRef(void);
140 | void ADCtriggers(uint8_t state);
141 |
142 |
143 | /****************************************************************************************
144 | * Local data declaration
145 | ****************************************************************************************/
146 | FIFO_t RXfifo;
147 | uint8_t RXbuffer[RX_BUFFER_SIZE];
148 |
149 | FIFO_t TXfifo;
150 | uint8_t TXbuffer[TX_BUFFER_SIZE];
151 |
152 | FIFO_t alarmQ;
153 | uint8_t alarmBuffer[ALARM_BUFFER_SIZE];
154 |
155 | tSettings EEMEM defaultSettings = {
156 | 1500, //vrefCalibrated
157 | 10, //balanceCurrent
158 | 60, //maxTempBMS
159 | 5, //maxTempBMSRecover
160 | 4300, //voltLimitHigh
161 | 4200, //voltLimitHighRecover
162 | 4200, //voltageCharged
163 | 4150, //voltageChargedRecover
164 | 3200, //voltageEmpty
165 | 3300, //voltageEmptyRecover
166 | 2500, //voltLimitLow
167 | 2600, //voltLimitLowRecover
168 | 1000, //measureInterval
169 | 3600, //voltBalanceStart
170 | 4300, //voltBalanceStop
171 | 50, //balanceHysteresis
172 | 0, //sleepRequested
173 | 0, //moduleNum
174 | 0, //topModule
175 | 5000, //targetVoltage
176 | 0, //cellVoltage
177 | 0, //intTemp
178 | {0, 0} //ADCextInput[2]
179 | };
180 |
181 | tSettings EEMEM storedSettings = {
182 | 1500, //vrefCalibrated
183 | 10, //balanceCurrent
184 | 60, //maxTempBMS
185 | 5, //maxTempBMSRecover
186 | 4300, //voltLimitHigh
187 | 4200, //voltLimitHighRecover
188 | 4200, //voltageCharged
189 | 4150, //voltageChargedRecover
190 | 3200, //voltageEmpty
191 | 3300, //voltageEmptyRecover
192 | 2500, //voltLimitLow
193 | 2600, //voltLimitLowRecover
194 | 1000, //measureInterval
195 | 3600, //voltBalanceStart
196 | 4300, //voltBalanceStop
197 | 50, //balanceHysteresis
198 | 0, //sleepRequested
199 | 0, //moduleNum
200 | 0, //topModule
201 | 5000, //targetVoltage
202 | 0, //cellVoltage
203 | 0, //intTemp
204 | {0, 0} //ADCextInput[2]
205 | };
206 |
207 | tSettings settings;
208 |
209 |
210 | /************************************************************************************//**
211 | ** \brief This is main program entry point
212 | **
213 | ****************************************************************************************/
214 | int main(void)
215 | {
216 | cli();
217 |
218 | /* CPUINT init */
219 | CPUINT_LVL1VEC = AC0_AC_vect_num;
220 |
221 | /* PORT init */
222 | /* PA3 -> PWM, PA6 -> TxD */
223 | PORTA_DIRSET = PIN3_bm | PIN6_bm;
224 | PORTA_PIN6CTRL = PORT_INVEN_bm;
225 |
226 | /* VREF init */
227 | /* Moved to ADCset1V5refMuxIntRef() */
228 | //VREF_CTRLA = VREF_ADC0REFSEL_1V5_gc | VREF_DAC0REFSEL_4V34_gc;
229 |
230 | /* ADC init */
231 | ADCset1V5refMuxIntRef();
232 | ADCtriggers(1);
233 | ADC0_CTRLB = 0x04; //ACC16
234 | ADC0_CTRLD = ADC_INITDLY_DLY32_gc | ADC_ASDV_ASVON_gc | 0x02;
235 | ADC0_CTRLA = ADC_ENABLE_bm;
236 |
237 | /* AC init */
238 | AC0_MUXCTRLA = AC_MUXNEG_VREF_gc | AC_INVERT_bm;
239 | AC0_CTRLA = AC_RUNSTDBY_bm | AC_HYSMODE_50mV_gc | AC_ENABLE_bm;
240 | AC0_INTCTRL = AC_CMP_bm;
241 |
242 | /* USART init */
243 | USART0_CTRLA = USART_RXCIE_bm;
244 | USART0_CTRLB = USART_RXEN_bm | USART_TXEN_bm;
245 | USART0_CTRLC |= USART_PMODE_ODD_gc | USART_CHSIZE_9BITL_gc;
246 | USART0_BAUD = 1389;
247 |
248 | /* TCA init */
249 | TCA0_SINGLE_CTRLB = TCA_SINGLE_WGMODE_SINGLESLOPE_gc | TCA_SINGLE_CMP0EN_bm;
250 | TCA0_SINGLE_PER = 102;
251 | TCA0_SINGLE_CMP0 = 0;
252 | TCA0_SINGLE_CTRLA = TCA_SINGLE_CLKSEL_DIV256_gc | TCA_SINGLE_ENABLE_bm;
253 |
254 | /* EVSYS init */
255 | EVSYS_SYNCCH0 = EVSYS_SYNCCH0_TCA0_CMP0_gc;
256 | EVSYS_ASYNCUSER1 = EVSYS_ASYNCUSER1_SYNCCH0_gc;
257 |
258 | /* Load settings */
259 | eeprom_read_block(&settings, &storedSettings, sizeof(tSettings));
260 |
261 | /* Read user row */
262 | settings.moduleNum = readUserRow(UR_MODULE_NUMBER_ADDR);
263 |
264 | /* Init. global variables. */
265 | settings.targetVoltage = 5000;
266 |
267 | /* RTC init */
268 | RTC_CLKSEL = RTC_CLKSEL_INT1K_gc;
269 | RTC_INTCTRL = RTC_OVF_bm;
270 | RTC_PITINTCTRL = RTC_PI_bm;
271 | while(RTC_PITSTATUS & RTC_CTRLBUSY_bm);
272 | RTC_PITCTRLA = RTC_PERIOD_CYC32768_gc | RTC_PITEN_bm;
273 | /* 25ms in required for the ADC to take 2 measurement, before running task for the first time. */
274 | setMeasureInterval(settings.measureInterval);
275 | while(RTC_STATUS & RTC_CTRLABUSY_bm);
276 | RTC_CTRLA = RTC_RUNSTDBY_bm | RTC_RTCEN_bm;
277 |
278 | /* FIFO init */
279 | FIFOinit(&RXfifo, RXbuffer, RX_BUFFER_SIZE);
280 | FIFOinit(&TXfifo, TXbuffer, TX_BUFFER_SIZE);
281 | FIFOinit(&alarmQ, alarmBuffer, ALARM_BUFFER_SIZE);
282 |
283 | /* Update bootloader flag */
284 | writeUserRow1byte(UR_BOOTLOADER_CONDITION_ADDR, 0xEA);
285 |
286 | /* WDT init */
287 | watchdogConfig(WDT_PERIOD_4KCLK_gc);
288 |
289 | sei();
290 |
291 | for(;;)
292 | {
293 | uint8_t ch = readSave();
294 |
295 | /* Reads all the alarm codes from one of the module, TODO: handle alarm codes */
296 | if(ch == CMD_ALARM_CODES)
297 | {
298 | /* read alarm source module number */
299 | uint8_t sourceModule = readSave();
300 | /* read the number of alarm codes send */
301 | uint8_t len = readSave();
302 | /* read all the codes */
303 | do readSave();
304 | while(--len);
305 | /* Forward alarm,
306 | * except if the circle was completed and you were the source of the alarm.
307 | */
308 | if(sourceModule == settings.moduleNum)
309 | {
310 | emptyOutgoingBuffer();
311 | }
312 | else
313 | {
314 | do
315 | {
316 | forward(FIFOread(&TXfifo));
317 | }
318 | while(FIFOavailable(&TXfifo));
319 | }
320 | }
321 |
322 | /* Command to go to the bootloader */
323 | else if(ch == CMD_GOTO_BOOTLOADER)
324 | {
325 | writeUserRow1byte(UR_BOOTLOADER_CONDITION_ADDR, 0xEB);
326 | if(!settings.moduleNum) respond(0xEB);
327 | forwardBufferIfNotBot();
328 | resetProcessor();
329 | }
330 |
331 | /* New voltage reference calibration value */
332 | else if(ch == CMD_VOLTAGE_CAL)
333 | {
334 | if(settings.moduleNum == readSave())
335 | {
336 | twoByteParameter(&settings.vrefCalibrated);
337 | emptyOutgoingBuffer();
338 | }
339 | else
340 | {
341 | readSave();
342 | readSave();
343 | }
344 | }
345 |
346 | /* New balance current limit value */
347 | else if(ch == CMD_BALANCE_CURRENT)
348 | {
349 | twoByteParameter(&settings.balanceCurrent);
350 | }
351 |
352 | /* Respond with all the external temperatures. */
353 | else if(ch == CMD_EXT_INPUTS)
354 | {
355 | respondOK(0x04);
356 | for(uint8_t i; i < 2; i++)
357 | {
358 | respond((uint8_t)settings.ADCextInput[i]);
359 | respond((uint8_t)(settings.ADCextInput[i] >> 8));
360 | }
361 | }
362 |
363 | /* */
364 | else if(ch == CMD_MAX_TEMP_BMS)
365 | {
366 | twoByteParameter(&settings.maxTempBMS);
367 | }
368 |
369 | /* */
370 | else if(ch == CMD_MAX_TEMP_RECOVER)
371 | {
372 | twoByteParameter(&settings.maxTempBMSRecover);
373 | }
374 |
375 | /* */
376 | else if(ch == CMD_HIGH_VOLT_LIMIT)
377 | {
378 | twoByteParameter(&settings.voltLimitHigh);
379 | }
380 |
381 | /* */
382 | else if(ch == CMD_HIGH_VOLT_RECOVER)
383 | {
384 | twoByteParameter(&settings.voltLimitHighRecover);
385 | }
386 |
387 | /* */
388 | else if(ch == CMD_CHARGED_VOLTAGE)
389 | {
390 | twoByteParameter(&settings.voltageCharged);
391 | }
392 |
393 | /* */
394 | else if(ch == CMD_CHARGED_RECOVER)
395 | {
396 | twoByteParameter(&settings.voltageChargedRecover);
397 | }
398 |
399 | /* */
400 | else if(ch == CMD_EMPTY_VOLTAGE)
401 | {
402 | twoByteParameter(&settings.voltageEmpty);
403 | }
404 |
405 | /* */
406 | else if(ch == CMD_EMPTY_RECOVER)
407 | {
408 | twoByteParameter(&settings.voltageEmptyRecover);
409 | }
410 |
411 | /* */
412 | else if(ch == CMD_LOW_VOLT_LIMIT)
413 | {
414 | twoByteParameter(&settings.voltLimitLow);
415 | }
416 |
417 | /* */
418 | else if(ch == CMD_LOW_VOLT_RECOVER)
419 | {
420 | twoByteParameter(&settings.voltLimitLowRecover);
421 | }
422 |
423 | /* */
424 | else if(ch == CMD_GOTO_SLEEP)
425 | {
426 | settings.sleepRequested = 0x01;
427 | respondOKnoPayload();
428 | }
429 |
430 | /* */
431 | else if(ch == CMD_TOP_MODULE)
432 | {
433 | settings.topModule = 0x01;
434 | respondOKnoPayload();
435 | emptyOutgoingBuffer();
436 | forward(CMD_NOT_TOP_MODULE);
437 | }
438 |
439 | /* */
440 | else if(ch == CMD_NOT_TOP_MODULE)
441 | {
442 | settings.topModule = 0x00;
443 | respondOKnoPayload();
444 | }
445 |
446 | /* */
447 | else if(ch == CMD_MEASURE_INTERVAL)
448 | {
449 | twoByteParameter(&settings.measureInterval);
450 | setMeasureInterval(settings.measureInterval);
451 | }
452 |
453 | /* Set the new module number */
454 | else if(ch == CMD_NMBR_OF_MODULES)
455 | {
456 | settings.moduleNum = readWait() - 1;
457 | writeUserRow1byte(UR_MODULE_NUMBER_ADDR, settings.moduleNum);
458 | FIFOaddToBuffer(&TXfifo, settings.moduleNum);
459 | respondOKnoPayload();
460 | }
461 |
462 | /* */
463 | else if(ch == CMD_BALANCE_START)
464 | {
465 | twoByteParameter(&settings.voltBalanceStart);
466 | }
467 |
468 | /* */
469 | else if(ch == CMD_BALANCE_STOP)
470 | {
471 | twoByteParameter(&settings.voltBalanceStop);
472 | }
473 |
474 | /* */
475 | else if(ch == CMD_BALANCE_HYSTERESIS)
476 | {
477 | twoByteParameter(&settings.balanceHysteresis);
478 | }
479 |
480 | /* */
481 | else if(ch == CMD_RESET_SETTINGS)
482 | {
483 | eeprom_read_block(&settings, &defaultSettings, sizeof(tSettings));
484 | settings.moduleNum = readUserRow(UR_MODULE_NUMBER_ADDR);
485 | eeprom_write_block(&settings, &storedSettings, sizeof(tSettings));
486 | setMeasureInterval(settings.measureInterval);
487 | respondOKnoPayload();
488 | }
489 |
490 | /* Take module to sleep */
491 | else if(ch == CMD_SAVE_SETTINGS)
492 | {
493 | eeprom_write_block(&settings, &storedSettings, sizeof(tSettings));
494 | respondOKnoPayload();
495 | }
496 |
497 | /* Respond with temperature reading of processors internal sensor. */
498 | else if(ch == CMD_INT_TEMPERATURE)
499 | {
500 | //respondOK(0x02);
501 | respondTwoBytes(settings.intTemp);
502 | }
503 |
504 | /* */
505 | else if(ch == CMD_TARGET_VOLTAGE)
506 | {
507 | twoByteParameter(&settings.targetVoltage);
508 | }
509 |
510 | /* Respond with the cell voltage */
511 | else if(ch == CMD_CELL_VOLTAGE)
512 | {
513 | while(!settings.cellVoltage);
514 | //respondOK(0x02);
515 | respondTwoBytes(settings.cellVoltage);
516 | }
517 |
518 | /* Do nothing, just sync for all the modules to wake up. */
519 | else if(ch == CMD_WAKE_UP_SYNC)
520 | {
521 | settings.sleepRequested = 0x00;
522 | respondOKnoPayload();
523 | }
524 |
525 | #ifdef USE_I2C
526 |
527 | /* */
528 | else if(ch == CMD_TWI_INIT)
529 | {
530 | if(settings.moduleNum == readSave())
531 | {
532 | respondOKnoPayload();
533 | /* 100kHz @ 3.33MHz per. clk. */
534 | TWI0_MBAUD = 10;
535 | /* Enable TWI as master without any interrupts. */
536 | TWI0_MCTRLA = TWI_ENABLE_bm;
537 | /* Writing 0x1 to the BUSSTATE bits forces the bus state logic into its Idle state. */
538 | TWI0_MSTATUS = TWI_BUSSTATE_IDLE_gc;
539 | emptyOutgoingBuffer();
540 | }
541 | }
542 |
543 | /* */
544 | else if(ch == CMD_TWI_STATUS)
545 | {
546 | if(settings.moduleNum == readSave())
547 | {
548 | respondOK(0x01);
549 | respond(TWI0_MSTATUS);
550 | emptyOutgoingBuffer();
551 | }
552 | }
553 |
554 | /* */
555 | else if(ch == CMD_TWI_START)
556 | {
557 | if(settings.moduleNum == readSave())
558 | {
559 | uint8_t address = readSave();
560 | uint8_t rdWr = readSave();
561 | if(rdWr > 0x01) respond(ERROR_SEQUENCE);
562 | else
563 | {
564 | respondOK(0x01);
565 | /* Send START condition */
566 | TWI0_MADDR = (uint8_t)(address << 1) | (rdWr & 0x01);
567 | /* Wait for write or read interrupt flag */
568 | while(!(TWI0_MSTATUS & (TWI_WIF_bm | TWI_RIF_bm)));
569 | /* Error on bus, return 0x00. */
570 | if(TWI0_MSTATUS & TWI_ARBLOST_bm) respond(0x00);
571 | /* Return true if slave gave an ACK */
572 | respond(!(TWI0_MSTATUS & TWI_RXACK_bm));
573 | }
574 | emptyOutgoingBuffer();
575 | }
576 | else
577 | {
578 | readSave();
579 | readSave();
580 | }
581 | }
582 |
583 | /* */
584 | else if(ch == CMD_TWI_STOP)
585 | {
586 | if(settings.moduleNum == readSave())
587 | {
588 | respondOKnoPayload();
589 | /* Send STOP */
590 | TWI0_MCTRLB = TWI_ACKACT_bm | TWI_MCMD_STOP_gc;
591 | emptyOutgoingBuffer();
592 | }
593 | }
594 |
595 | /* */
596 | else if(ch == CMD_TWI_WRITE)
597 | {
598 | if(settings.moduleNum == readSave())
599 | {
600 | uint8_t data = readSave();
601 | respondOK(0x01);
602 | /* Wait for write complete interrupt flag */
603 | while(!(TWI0_MSTATUS & TWI_WIF_bm));
604 | /* Copy data to master data register. */
605 | TWI0_MDATA = data;
606 | /* Transmit Data */
607 | TWI0_MCTRLB = TWI_MCMD_RECVTRANS_gc;
608 | /* Return true if slave gave an ACK */
609 | respond(!(TWI0_MSTATUS & TWI_RXACK_bm));
610 | emptyOutgoingBuffer();
611 | }
612 | else
613 | {
614 | readSave();
615 | }
616 | }
617 |
618 | /* */
619 | else if(ch == CMD_TWI_READ)
620 | {
621 | if(settings.moduleNum == readSave())
622 | {
623 | uint8_t nack = readSave();
624 | if(nack > 0x01) respond(ERROR_SEQUENCE);
625 | else
626 | {
627 | respondOK(0x01);
628 | /* Wait for read complete interrupt flag */
629 | while(!(TWI0_MSTATUS & TWI_RIF_bm));
630 | /* Copy data from master data register. */
631 | uint8_t data = TWI0_MDATA;
632 | /* Last byte to be read, send NACK. */
633 | //if(!ack) TWI0_MCTRLB = TWI_ACKACT_bm | TWI_MCMD_RECVTRANS_gc;
634 | /* Execute Acknowledge Action succeeded by a byte read operation. */
635 | //else TWI0_MCTRLB = TWI_MCMD_RECVTRANS_gc;
636 | TWI0_MCTRLB = (nack << TWI_ACKACT_bp) | TWI_MCMD_RECVTRANS_gc;
637 | /* Return received data byte */
638 | respond(data);
639 | }
640 | emptyOutgoingBuffer();
641 | }
642 | else
643 | {
644 | readSave();
645 | }
646 | }
647 |
648 | #endif // USE_I2C
649 |
650 | /* Unknown command, respond with error code. */
651 | else
652 | {
653 | respond(ERROR_UNKNOWN_COMMAND);
654 | emptyOutgoingBuffer();
655 | }
656 |
657 | forwardBufferIfNotBot();
658 | }
659 | } /*** end of main ***/
660 |
661 |
662 | void respondOK(uint8_t respSize)
663 | {
664 | respond(RESP_OK);
665 | respond(respSize);
666 | }
667 |
668 |
669 | void respondOKnoPayload(void)
670 | {
671 | respond(RESP_OK);
672 | respond(0x00);
673 | }
674 |
675 |
676 | void emptyOutgoingBuffer(void)
677 | {
678 | FIFOflush(&TXfifo);
679 | }
680 |
681 |
682 | void setMeasureInterval(uint16_t interval)
683 | {
684 | /* Reset counter in case new interval is shorter than the last one. */
685 | RTC_CNT = 0x0000;
686 | RTC_CMP = interval;
687 | /* Interval should be limited to 60.000 (1min), to ensure RTC_PER doesn't overflows. */
688 | RTC_PER = interval + 100;
689 | }
690 |
691 |
692 | void createAlarm(uint8_t code)
693 | {
694 | FIFOaddToBuffer(&alarmQ, code);
695 | }
696 |
697 |
698 | void emptyAlarmQ(void)
699 | {
700 | if(FIFOavailable(&alarmQ))
701 | {
702 | forward(CMD_ALARM_CODES);
703 | forward(settings.moduleNum);
704 | forward(FIFOavailable(&alarmQ));
705 | do
706 | {
707 | forward(FIFOread(&alarmQ));
708 | }
709 | while(FIFOavailable(&alarmQ));
710 | }
711 | }
712 |
713 |
714 | void ADCset1V5refMuxIntRef(void)
715 | {
716 | VREF_CTRLA = VREF_ADC0REFSEL_1V5_gc | VREF_DAC0REFSEL_4V34_gc;
717 | ADC0_CTRLC = ADC_SAMPCAP_bm | ADC_REFSEL_VDDREF_gc | ADC_PRESC_DIV2_gc;
718 | ADC0_MUXPOS = ADC_MUXPOS_INTREF_gc;
719 | }
720 |
721 |
722 | void ADCtriggers(uint8_t state)
723 | {
724 | if(!state)
725 | {
726 | /* Disable triggers. */
727 | ADC0_INTCTRL = 0x00;
728 | ADC0_EVCTRL = 0x00;
729 | }
730 | else
731 | {
732 | /* Enable triggers. */
733 | ADC0_EVCTRL = ADC_STARTEI_bm;
734 | ADC0_INTCTRL = ADC_RESRDY_bm;
735 | }
736 | }
737 |
738 |
739 | /************************************************************************************//**
740 | ** \brief Periodic task
741 | **
742 | ****************************************************************************************/
743 | void task(tSettings *p)
744 | {
745 | static uint8_t overvoltageCondition = 0x00;
746 | static uint8_t chargedCondition = 0x00;
747 | static uint8_t emptyCondition = 0x00;
748 | static uint8_t undervoltageCondition = 0x00;
749 | static uint8_t overTempCondition = 0x00;
750 | static uint8_t balancingCondition = 0x00;
751 |
752 | /* Disable triggers. */
753 | ADCtriggers(0);
754 |
755 | /* Sample two external inputs. */
756 | /* Select external input number 1. */
757 | ADC0_MUXPOS = ADC_MUXPOS_AIN1_gc;
758 | /* wait for things to settle down */
759 | takeADCreading();
760 | /* Take a reading */
761 | p->ADCextInput[0] = ((uint32_t)(takeADCreading() >> 2) * p->cellVoltage) / 4096;
762 |
763 | /* Select external input number 2. */
764 | ADC0_MUXPOS = ADC_MUXPOS_AIN2_gc;
765 | /* wait for things to settle down */
766 | takeADCreading();
767 | /* Take a reading */
768 | p->ADCextInput[1] = ((uint32_t)(takeADCreading() >> 2) * p->cellVoltage) / 4096;
769 |
770 | /* Sample internal temperature sensor. */
771 | /* Switch to 1.1V reference */
772 | VREF_CTRLA = VREF_ADC0REFSEL_1V1_gc | VREF_DAC0REFSEL_4V34_gc;
773 | /* Switch to internal reference. */
774 | ADC0_CTRLC = ADC_SAMPCAP_bm | ADC_REFSEL_INTREF_gc | ADC_PRESC_DIV2_gc;
775 | /* Select internal temperature sensor input. */
776 | ADC0_MUXPOS = ADC_MUXPOS_TEMPSENSE_gc;
777 | /* wait for things to settle down */
778 | takeADCreading();
779 | /* ADC conversion result with 1.1 V internal reference */
780 | /* SIGROW_TEMPSENSE1 = sigrow_offset */
781 | uint32_t temp = (takeADCreading() >> 4) - SIGROW_TEMPSENSE1;
782 | /* Result might overflow 16 bit variable (10bit+8bit) */
783 | /* SIGROW_TEMPSENSE0 = sigrow_gain */
784 | temp *= SIGROW_TEMPSENSE0;
785 | /* Add 1/2 to get correct rounding on division below */
786 | temp += 0x80;
787 | /* Divide result to get Kelvin */
788 | temp >>= 8;
789 | /* Copy result, temperature is in kelvins! */
790 | p->intTemp = temp;
791 |
792 | /* ADC init */
793 | ADCset1V5refMuxIntRef();
794 | takeADCreading();
795 | /* Enable triggers. */
796 | ADCtriggers(1);
797 |
798 |
799 | if((p->cellVoltage > p->voltLimitHigh) || overvoltageCondition)
800 | {
801 | if(!overvoltageCondition) createAlarm(ALARM_OVERVOLTAGE);
802 | overvoltageCondition = (p->cellVoltage > p->voltLimitHighRecover);
803 | }
804 |
805 | if((p->cellVoltage > p->voltageCharged) || chargedCondition)
806 | {
807 | if(!chargedCondition) createAlarm(ALARM_CELL_CHARGED);
808 | chargedCondition = (p->cellVoltage > p->voltageChargedRecover);
809 | }
810 |
811 | if((p->cellVoltage < p->voltageEmpty) || emptyCondition)
812 | {
813 | if(!emptyCondition) createAlarm(ALARM_CELL_EMPTY);
814 | emptyCondition = (p->cellVoltage < p->voltageEmptyRecover);
815 | }
816 |
817 | if((p->cellVoltage < p->voltLimitLow) || undervoltageCondition)
818 | {
819 | if(!undervoltageCondition) createAlarm(ALARM_UNDERVOLTAGE);
820 | undervoltageCondition = (p->cellVoltage < p->voltLimitLowRecover);
821 | }
822 |
823 | if((p->intTemp > p->maxTempBMS) || overTempCondition)
824 | {
825 | if(!overTempCondition) createAlarm(ALARM_OVER_TEMP);
826 | overTempCondition = (p->intTemp > p->maxTempBMSRecover);
827 | }
828 |
829 | if((p->cellVoltage > p->voltBalanceStart) && (p->cellVoltage < p->voltBalanceStop))
830 | {
831 | if((p->cellVoltage > (p->targetVoltage + p->balanceHysteresis)) || balancingCondition)
832 | {
833 | balancingCondition = (p->cellVoltage > p->targetVoltage);
834 |
835 | if(!overTempCondition && !p->sleepRequested)
836 | //if(!p->sleepRequested)
837 | {
838 | TCA0_SINGLE_CMP0 = p->balanceCurrent;
839 | }
840 | else
841 | {
842 | TCA0_SINGLE_CMP0 = 0x00;
843 | }
844 | }
845 | else
846 | {
847 | balancingCondition = 0x00;
848 | TCA0_SINGLE_CMP0 = 0x00;
849 | }
850 | }
851 | else
852 | {
853 | balancingCondition = 0x00;
854 | TCA0_SINGLE_CMP0 = 0x00;
855 | }
856 |
857 | /* Send all the alarms and hope new module is not waiting for parameters. */
858 | emptyAlarmQ();
859 |
860 |
861 | if(undervoltageCondition)
862 | {
863 | goToSleep(SLEEP_MODE_PWR_DOWN);
864 | }
865 | else if(emptyCondition || p->sleepRequested)
866 | {
867 | goToSleep(SLEEP_MODE_STANDBY);
868 | /* This is in case CMD_CELL_VOLTAGE woke-up the processor.
869 | * Response wont be given until cell voltage is measured.
870 | */
871 | p->cellVoltage = 0x00;
872 | }
873 |
874 | asm("wdr");
875 |
876 | } /*** end of task ***/
877 |
878 |
879 | /************************************************************************************//**
880 | ** \brief Take ADC reading
881 | ** \return CRCSCAN_STATUS CRC check status
882 | **
883 | ****************************************************************************************/
884 | uint16_t takeADCreading(void)
885 | {
886 | /* Start conversion. */
887 | ADC0_COMMAND = ADC_STCONV_bm;
888 | /* Wait for it to finish. */
889 | while(!(ADC0_INTFLAGS & ADC_RESRDY_bm));
890 | /* Return reading. */
891 | return ADC0_RES;
892 | } /*** end of takeADCreading ***/
893 |
894 |
895 | /************************************************************************************//**
896 | ** \brief Read and save 2 byte parameter
897 | ** \param parameter Pointer to the local parameter variable
898 | **
899 | ****************************************************************************************/
900 | void twoByteParameter(volatile uint16_t *parameter)
901 | {
902 | uint8_t rdWr = readSave();
903 | if(rdWr == 'w')
904 | {
905 | *parameter = readSave();
906 | *parameter |= readSave() << 8;
907 | respondOKnoPayload();
908 | }
909 | else if(rdWr == 'r')
910 | {
911 | //respondOK(0x02);
912 | respondTwoBytes(*parameter);
913 | }
914 | else
915 | {
916 | emptyOutgoingBuffer();
917 | respond(ERROR_SEQUENCE);
918 | }
919 | } /*** end of twoByteParameter ***/
920 |
921 |
922 | /************************************************************************************//**
923 | ** \brief Read and save byte
924 | ** \return return read byte
925 | **
926 | ****************************************************************************************/
927 | uint8_t readSave(void)
928 | {
929 | uint8_t ch = readWait();
930 | FIFOaddToBuffer(&TXfifo, ch);
931 | return ch;
932 | } /*** end of readSave ***/
933 |
934 |
935 | /************************************************************************************//**
936 | ** \brief Wait for an incoming byte
937 | ** \return return read byte
938 | **
939 | ****************************************************************************************/
940 | uint8_t readWait(void)
941 | {
942 | do
943 | {
944 | if((RTC_INTFLAGS & RTC_CMP_bm))
945 | {
946 | /* Reset counter and set interval */
947 | setMeasureInterval(settings.measureInterval);
948 | /* Clear the int. flag. */
949 | RTC_INTFLAGS = RTC_CMP_bm;
950 | /* Do the work */
951 | task(&settings);
952 | }
953 | }
954 | while(!FIFOavailable(&RXfifo));
955 | /* Reset counter and set interval */
956 | setMeasureInterval(settings.measureInterval);
957 | /* Now return the received byte. */
958 | return FIFOread(&RXfifo);
959 | } /*** end of readSave ***/
960 |
961 |
962 | /************************************************************************************//**
963 | ** \brief Put processor to sleep
964 | **
965 | ****************************************************************************************/
966 | void goToSleep(uint8_t mode)
967 | {
968 | setMeasureInterval(25);
969 | while(!(USART0_STATUS & USART_TXCIF_bm));
970 | /* go to sleep */
971 | PORTA_PIN3CTRL = 0x01;
972 | SLPCTRL_CTRLA = mode | SLPCTRL_SEN_bm;
973 | AC0_CTRLA |= AC_OUTEN_bm;
974 | asm("sleep");
975 | /* Clear the int. flag. */
976 | RTC_INTFLAGS = RTC_CMP_bm;
977 | } /*** end of goToSleep ***/
978 |
979 |
980 | /************************************************************************************//**
981 | ** \brief Only forward buffer if it's not the bottom module
982 | **
983 | ****************************************************************************************/
984 | void forwardBufferIfNotBot(void)
985 | {
986 | if(!settings.moduleNum)
987 | {
988 | emptyOutgoingBuffer();
989 | }
990 | else
991 | {
992 | while(FIFOavailable(&TXfifo))
993 | {
994 | forward(FIFOread(&TXfifo));
995 | }
996 | }
997 | } /*** end of forwardBufferIfNotBot ***/
998 |
999 |
1000 | /************************************************************************************//**
1001 | ** \brief Write 1 byte to user row
1002 | ** \param addr Pointer to the user row position
1003 | ** \param val Value to save
1004 | **
1005 | ****************************************************************************************/
1006 | void writeUserRow1byte(volatile uint8_t *addr, uint8_t val)
1007 | {
1008 | *addr = val;
1009 | _PROTECTED_WRITE_SPM(NVMCTRL_CTRLA, NVMCTRL_CMD_PAGEERASEWRITE_gc);
1010 | while(NVMCTRL_STATUS & NVMCTRL_EEBUSY_bm);
1011 | } /*** end of writeUserRow1byte ***/
1012 |
1013 |
1014 | /************************************************************************************//**
1015 | ** \brief Configure watchdog timer
1016 | ** \param x Watchdog control register A setting
1017 | **
1018 | ****************************************************************************************/
1019 | void watchdogConfig(uint8_t x)
1020 | {
1021 | while(WDT_STATUS & WDT_SYNCBUSY_bm);
1022 | _PROTECTED_WRITE(WDT_CTRLA, x);
1023 | } /*** end of watchdogConfig ***/
1024 |
1025 |
1026 | /************************************************************************************//**
1027 | ** \brief Reset processor for sequence error
1028 | **
1029 | ****************************************************************************************/
1030 | void resetProcessor(void)
1031 | {
1032 | while(!(USART0_STATUS & USART_TXCIF_bm));
1033 | watchdogConfig(WDT_PERIOD_8CLK_gc);
1034 | for(;;);
1035 | } /*** end of resetProcessor ***/
1036 |
1037 |
1038 | /************************************************************************************//**
1039 | ** \brief Respond with single byte
1040 | ** \param data Byte to respond with
1041 | **
1042 | ****************************************************************************************/
1043 | void respond(uint8_t data)
1044 | {
1045 | volatile uint8_t parityBit;
1046 |
1047 | if(!settings.moduleNum)
1048 | {
1049 | //parityBit = __builtin_parity(data);
1050 | parityBit = data;
1051 | parityBit ^= parityBit >> 4;
1052 | parityBit ^= parityBit >> 2;
1053 | parityBit ^= parityBit >> 1;
1054 | }
1055 |
1056 | while(!(USART0_STATUS & USART_DREIF_bm));
1057 |
1058 | if(!settings.moduleNum) USART0_TXDATAH = parityBit;
1059 | else USART0_TXDATAH = 0x00;
1060 |
1061 | USART0_TXDATAL = data;
1062 | } /*** end of respond ***/
1063 |
1064 |
1065 | /************************************************************************************//**
1066 | ** \brief Respond with two bytes
1067 | ** \param data Data to respond with
1068 | **
1069 | ****************************************************************************************/
1070 | void respondTwoBytes(uint16_t data)
1071 | {
1072 | respondOK(0x02);
1073 | respond((uint8_t)data);
1074 | respond((uint8_t)(data >> 8));
1075 | } /*** end of respond ***/
1076 |
1077 |
1078 | /************************************************************************************//**
1079 | ** \brief Forward single byte
1080 | ** \param data Byte to forward
1081 | **
1082 | ****************************************************************************************/
1083 | void forward(uint8_t data)
1084 | {
1085 | while(!(USART0_STATUS & USART_DREIF_bm));
1086 | USART0_TXDATAH = 0x01;
1087 | USART0_TXDATAL = data;
1088 | } /*** end of forward ***/
1089 |
1090 |
1091 | /************************************************************************************//**
1092 | ** \brief Interrupt service routine for Analog Comparator
1093 | **
1094 | ****************************************************************************************/
1095 | ISR(AC0_AC_vect)
1096 | {
1097 | /* Clear int. flag */
1098 | AC0_STATUS = AC_CMP_bm;
1099 | /* Invert pin input */
1100 | if(!(AC0_STATUS & AC_STATE_bm)) PORTA_PIN7CTRL = PORT_INVEN_bm;
1101 | else PORTA_PIN7CTRL = 0x00;
1102 | } /*** end of ISR ***/
1103 |
1104 |
1105 | /************************************************************************************//**
1106 | ** \brief Interrupt service routine for UART receive
1107 | **
1108 | ****************************************************************************************/
1109 | ISR(USART0_RXC_vect)
1110 | {
1111 | volatile uint8_t status = USART0_RXDATAH;
1112 | volatile uint8_t data = USART0_RXDATAL;
1113 |
1114 | if(status & (USART_FERR_bm | USART_PERR_bm))
1115 | {
1116 | createAlarm(ALARM_FRAME_PARITY);
1117 | /* Send all the alarms and hope new module is not waiting for parameters. */
1118 | emptyAlarmQ();
1119 | /* Something went wrong, reset itself. */
1120 | resetProcessor();
1121 | }
1122 | else if(status & USART_RXCIF_bm)
1123 | {
1124 | if((status & 0x01) | settings.topModule)
1125 | {
1126 | FIFOaddToBuffer(&RXfifo, data);
1127 | }
1128 | else
1129 | {
1130 | respond(data);
1131 | }
1132 | }
1133 | } /*** end of ISR ***/
1134 |
1135 |
1136 | /************************************************************************************//**
1137 | ** \brief Interrupt service routine for ADC result ready
1138 | **
1139 | ****************************************************************************************/
1140 | ISR(ADC0_RESRDY_vect)
1141 | {
1142 | settings.cellVoltage = ((uint32_t)settings.vrefCalibrated * 4096) / (ADC0_RES >> 2);
1143 | } /*** end of ISR ***/
1144 |
1145 |
1146 | /************************************************************************************//**
1147 | ** \brief Interrupt service routine for PORT
1148 | **
1149 | ****************************************************************************************/
1150 | ISR(PORTA_PORT_vect)
1151 | {
1152 | AC0_CTRLA &= ~AC_OUTEN_bm;
1153 | PORTA_PIN3CTRL = 0x00;
1154 | PORTA_INTFLAGS = PORT_INT3_bm;
1155 | } /*** end of ISR ***/
1156 |
1157 |
1158 | /************************************************************************************//**
1159 | ** \brief Interrupt service routine for Real Time Counter CNT
1160 | **
1161 | ****************************************************************************************/
1162 | ISR(RTC_CNT_vect)
1163 | {
1164 | /* Clear the int. flag. */
1165 | RTC_INTFLAGS = RTC_OVF_bm;
1166 | /* If sleep was not requested an error has occurred. */
1167 | if(!settings.sleepRequested) createAlarm(ALARM_RTC_OVERFLOW);
1168 | /* Send all the alarms and hope we did not interrupt command transfer, because this
1169 | * bytes will be threated as parameters for interrupted command.
1170 | */
1171 | emptyAlarmQ();
1172 | /* Something went wrong, reset itself. */
1173 | resetProcessor();
1174 | } /*** end of ISR ***/
1175 |
1176 |
1177 | /************************************************************************************//**
1178 | ** \brief Interrupt service routine for Real Time Counter PIT
1179 | **
1180 | ****************************************************************************************/
1181 | ISR(RTC_PIT_vect)
1182 | {
1183 | AC0_CTRLA &= ~AC_OUTEN_bm;
1184 | PORTA_PIN3CTRL = 0x00;
1185 | RTC_PITINTFLAGS = RTC_PI_bm;
1186 | } /*** end of ISR ***/
1187 |
1188 |
1189 | /************************************ end of main.c ************************************/
--------------------------------------------------------------------------------
/CellModule/Hardware/AltiumProject/CarettaBMS.PrjPCB:
--------------------------------------------------------------------------------
1 | [Design]
2 | Version=1.0
3 | HierarchyMode=0
4 | ChannelRoomNamingStyle=0
5 | ReleasesFolder=
6 | ChannelDesignatorFormatString=$Component_$RoomName
7 | ChannelRoomLevelSeperator=_
8 | OpenOutputs=1
9 | ArchiveProject=0
10 | TimestampOutput=0
11 | SeparateFolders=0
12 | TemplateLocationPath=
13 | PinSwapBy_Netlabel=1
14 | PinSwapBy_Pin=1
15 | AllowPortNetNames=0
16 | AllowSheetEntryNetNames=1
17 | AppendSheetNumberToLocalNets=0
18 | NetlistSinglePinNets=0
19 | DefaultConfiguration=Sources
20 | UserID=0xFFFFFFFF
21 | DefaultPcbProtel=1
22 | DefaultPcbPcad=0
23 | ReorderDocumentsOnCompile=1
24 | NameNetsHierarchically=0
25 | PowerPortNamesTakePriority=0
26 | PushECOToAnnotationFile=1
27 | DItemRevisionGUID=
28 | ReportSuppressedErrorsInMessages=0
29 | FSMCodingStyle=eFMSDropDownList_OneProcess
30 | FSMEncodingStyle=eFMSDropDownList_OneHot
31 | OutputPath=
32 | LogFolderPath=
33 | ManagedProjectGUID=
34 | IncludeDesignInRelease=0
35 | VaultGUID=
36 | ReleaseVaultName=
37 | ItemGUID=
38 |
39 | [Preferences]
40 | PrefsVaultGUID=
41 | PrefsRevisionGUID=
42 |
43 | [Document1]
44 | DocumentPath=CarettaCellModule.SchDoc
45 | AnnotationEnabled=1
46 | AnnotateStartValue=1
47 | AnnotationIndexControlEnabled=0
48 | AnnotateSuffix=
49 | AnnotateScope=All
50 | AnnotateOrder=0
51 | DoLibraryUpdate=1
52 | DoDatabaseUpdate=1
53 | ClassGenCCAutoEnabled=1
54 | ClassGenCCAutoRoomEnabled=1
55 | ClassGenNCAutoScope=None
56 | DItemRevisionGUID=
57 | GenerateClassCluster=0
58 | DocumentUniqueId=GGKOODVS
59 |
60 | [Document2]
61 | DocumentPath=CarettaCellModule.PcbDoc
62 | AnnotationEnabled=1
63 | AnnotateStartValue=1
64 | AnnotationIndexControlEnabled=0
65 | AnnotateSuffix=
66 | AnnotateScope=All
67 | AnnotateOrder=-1
68 | DoLibraryUpdate=1
69 | DoDatabaseUpdate=1
70 | ClassGenCCAutoEnabled=1
71 | ClassGenCCAutoRoomEnabled=1
72 | ClassGenNCAutoScope=None
73 | DItemRevisionGUID=
74 | GenerateClassCluster=0
75 | DocumentUniqueId=LMGTJYTP
76 |
77 | [Document3]
78 | DocumentPath=Gerber.OutJob
79 | AnnotationEnabled=1
80 | AnnotateStartValue=1
81 | AnnotationIndexControlEnabled=0
82 | AnnotateSuffix=
83 | AnnotateScope=All
84 | AnnotateOrder=-1
85 | DoLibraryUpdate=1
86 | DoDatabaseUpdate=1
87 | ClassGenCCAutoEnabled=1
88 | ClassGenCCAutoRoomEnabled=1
89 | ClassGenNCAutoScope=None
90 | DItemRevisionGUID=
91 | GenerateClassCluster=0
92 | DocumentUniqueId=
93 |
94 | [ProjectVariant1]
95 | UniqueID=1B798D9D-9588-4EEA-9D6D-E6BB87BCC978
96 | Description=Production
97 | AllowFabrication=0
98 | ParameterCount=0
99 | VariationCount=2
100 | Variation1=Designator=K1|UniqueId=\CIWCSSRY|Kind=1|AlternatePart=
101 | Variation2=Designator=K2|UniqueId=\TRQHPNKC|Kind=1|AlternatePart=
102 | ParamVariationCount=0
103 |
104 | [GeneratedDocument1]
105 | DocumentPath=Gerber\CarettaCellModule.DRR
106 | DItemRevisionGUID=
107 |
108 | [GeneratedDocument2]
109 | DocumentPath=Gerber\CarettaCellModule.EXTREP
110 | DItemRevisionGUID=
111 |
112 | [GeneratedDocument3]
113 | DocumentPath=Gerber\CarettaCellModule.GBL
114 | DItemRevisionGUID=
115 |
116 | [GeneratedDocument4]
117 | DocumentPath=Gerber\CarettaCellModule.GBO
118 | DItemRevisionGUID=
119 |
120 | [GeneratedDocument5]
121 | DocumentPath=Gerber\CarettaCellModule.GBP
122 | DItemRevisionGUID=
123 |
124 | [GeneratedDocument6]
125 | DocumentPath=Gerber\CarettaCellModule.GBS
126 | DItemRevisionGUID=
127 |
128 | [GeneratedDocument7]
129 | DocumentPath=Gerber\CarettaCellModule.GM3
130 | DItemRevisionGUID=
131 |
132 | [GeneratedDocument8]
133 | DocumentPath=Gerber\CarettaCellModule.GTL
134 | DItemRevisionGUID=
135 |
136 | [GeneratedDocument9]
137 | DocumentPath=Gerber\CarettaCellModule.GTO
138 | DItemRevisionGUID=
139 |
140 | [GeneratedDocument10]
141 | DocumentPath=Gerber\CarettaCellModule.GTP
142 | DItemRevisionGUID=
143 |
144 | [GeneratedDocument11]
145 | DocumentPath=Gerber\CarettaCellModule.GTS
146 | DItemRevisionGUID=
147 |
148 | [GeneratedDocument12]
149 | DocumentPath=Gerber\CarettaCellModule.LDP
150 | DItemRevisionGUID=
151 |
152 | [GeneratedDocument13]
153 | DocumentPath=Gerber\CarettaCellModule.REP
154 | DItemRevisionGUID=
155 |
156 | [GeneratedDocument14]
157 | DocumentPath=Gerber\CarettaCellModule.RUL
158 | DItemRevisionGUID=
159 |
160 | [GeneratedDocument15]
161 | DocumentPath=Gerber\CarettaCellModule.TXT
162 | DItemRevisionGUID=
163 |
164 | [GeneratedDocument16]
165 | DocumentPath=Project Outputs for CarettaBMS\Design Rule Check - CarettaCellModule.html
166 | DItemRevisionGUID=
167 |
168 | [Configuration1]
169 | Name=Sources
170 | ParameterCount=0
171 | ConstraintFileCount=0
172 | ReleaseItemId=
173 | Variant=[No Variations]
174 | OutputJobsCount=0
175 | ContentTypeGUID=CB6F2064-E317-11DF-B822-12313F0024A2
176 | ConfigurationType=Source
177 |
178 | [Generic_SmartPDF]
179 | AutoOpenFile=-1
180 | AutoOpenOutJob=-1
181 |
182 | [Generic_SmartPDFSettings]
183 | ProjectMode=0
184 | ZoomPrecision=50
185 | AddNetsInformation=-1
186 | AddNetPins=-1
187 | AddNetNetLabels=-1
188 | AddNetPorts=-1
189 | ShowComponentParameters=-1
190 | GlobalBookmarks=0
191 | ExportBOM=0
192 | TemplateFilename=
193 | TemplateStoreRelative=-1
194 | PCB_PrintColor=1
195 | SCH_PrintColor=0
196 | PrintQuality=-3
197 | SCH_ShowNoErc=-1
198 | SCH_ShowParameter=-1
199 | SCH_ShowProbes=-1
200 | SCH_ShowBlankets=-1
201 | SCH_NoERCSymbolsToShow="Thin Cross","Thick Cross","Small Cross",Checkbox,Triangle
202 | SCH_ShowNote=-1
203 | SCH_ShowNoteCollapsed=-1
204 | SCH_ExpandLogicalToPhysical=0
205 | SCH_VariantName=[No Variations]
206 | SCH_ExpandComponentDesignators=-1
207 | SCH_ExpandNetlabels=0
208 | SCH_ExpandPorts=0
209 | SCH_ExpandSheetNumber=0
210 | SCH_ExpandDocumentNumber=0
211 | SCH_HasExpandLogicalToPhysicalSheets=-1
212 | SaveSettingsToOutJob=-1
213 |
214 | [Generic_EDE]
215 | OutputDir=
216 |
217 | [OutputGroup1]
218 | Name=Netlist Outputs
219 | Description=
220 | TargetPrinter=NPIB8638C (HP LaserJet 100 colorMFP M175nw)
221 | PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1
222 | OutputType1=CadnetixNetlist
223 | OutputName1=Cadnetix Netlist
224 | OutputDocumentPath1=
225 | OutputVariantName1=
226 | OutputDefault1=0
227 | OutputType2=CalayNetlist
228 | OutputName2=Calay Netlist
229 | OutputDocumentPath2=
230 | OutputVariantName2=
231 | OutputDefault2=0
232 | OutputType3=EDIF
233 | OutputName3=EDIF for PCB
234 | OutputDocumentPath3=
235 | OutputVariantName3=
236 | OutputDefault3=0
237 | OutputType4=EESofNetlist
238 | OutputName4=EESof Netlist
239 | OutputDocumentPath4=
240 | OutputVariantName4=
241 | OutputDefault4=0
242 | OutputType5=IntergraphNetlist
243 | OutputName5=Intergraph Netlist
244 | OutputDocumentPath5=
245 | OutputVariantName5=
246 | OutputDefault5=0
247 | OutputType6=MentorBoardStationNetlist
248 | OutputName6=Mentor BoardStation Netlist
249 | OutputDocumentPath6=
250 | OutputVariantName6=
251 | OutputDefault6=0
252 | OutputType7=MultiWire
253 | OutputName7=MultiWire
254 | OutputDocumentPath7=
255 | OutputVariantName7=
256 | OutputDefault7=0
257 | OutputType8=OrCadPCB2Netlist
258 | OutputName8=Orcad/PCB2 Netlist
259 | OutputDocumentPath8=
260 | OutputVariantName8=
261 | OutputDefault8=0
262 | OutputType9=PADSNetlist
263 | OutputName9=PADS ASCII Netlist
264 | OutputDocumentPath9=
265 | OutputVariantName9=
266 | OutputDefault9=0
267 | OutputType10=Pcad
268 | OutputName10=Pcad for PCB
269 | OutputDocumentPath10=
270 | OutputVariantName10=
271 | OutputDefault10=0
272 | OutputType11=PCADNetlist
273 | OutputName11=PCAD Netlist
274 | OutputDocumentPath11=
275 | OutputVariantName11=
276 | OutputDefault11=0
277 | OutputType12=PCADnltNetlist
278 | OutputName12=PCADnlt Netlist
279 | OutputDocumentPath12=
280 | OutputVariantName12=
281 | OutputDefault12=0
282 | OutputType13=Protel2Netlist
283 | OutputName13=Protel2 Netlist
284 | OutputDocumentPath13=
285 | OutputVariantName13=
286 | OutputDefault13=0
287 | OutputType14=ProtelNetlist
288 | OutputName14=Protel
289 | OutputDocumentPath14=
290 | OutputVariantName14=
291 | OutputDefault14=0
292 | OutputType15=RacalNetlist
293 | OutputName15=Racal Netlist
294 | OutputDocumentPath15=
295 | OutputVariantName15=
296 | OutputDefault15=0
297 | OutputType16=RINFNetlist
298 | OutputName16=RINF Netlist
299 | OutputDocumentPath16=
300 | OutputVariantName16=
301 | OutputDefault16=0
302 | OutputType17=SciCardsNetlist
303 | OutputName17=SciCards Netlist
304 | OutputDocumentPath17=
305 | OutputVariantName17=
306 | OutputDefault17=0
307 | OutputType18=TangoNetlist
308 | OutputName18=Tango Netlist
309 | OutputDocumentPath18=
310 | OutputVariantName18=
311 | OutputDefault18=0
312 | OutputType19=TelesisNetlist
313 | OutputName19=Telesis Netlist
314 | OutputDocumentPath19=
315 | OutputVariantName19=
316 | OutputDefault19=0
317 | OutputType20=WireListNetlist
318 | OutputName20=WireList Netlist
319 | OutputDocumentPath20=
320 | OutputVariantName20=
321 | OutputDefault20=0
322 |
323 | [OutputGroup2]
324 | Name=Simulator Outputs
325 | Description=
326 | TargetPrinter=NPIB8638C (HP LaserJet 100 colorMFP M175nw)
327 | PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1
328 |
329 | [OutputGroup3]
330 | Name=Documentation Outputs
331 | Description=
332 | TargetPrinter=Virtual Printer
333 | PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1
334 | OutputType1=Composite
335 | OutputName1=Composite Drawing
336 | OutputDocumentPath1=
337 | OutputVariantName1=
338 | OutputDefault1=0
339 | PageOptions1=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=0|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=0|PaperKind=A4|PaperIndex=9
340 | Configuration1_Name1=OutputConfigurationParameter1
341 | Configuration1_Item1=DesignatorDisplayMode=Physical|PrintArea=DesignExtent|PrintAreaLowerLeftCornerX=0|PrintAreaLowerLeftCornerY=0|PrintAreaUpperRightCornerX=0|PrintAreaUpperRightCornerY=0|Record=PcbPrintView
342 | Configuration1_Name2=OutputConfigurationParameter2
343 | Configuration1_Item2=IncludeBoardCutouts=False|IncludeBottomLayerComponents=True|IncludeMultiLayerComponents=True|IncludeTopLayerComponents=True|IncludeViewports=True|Index=0|Mirror=False|Name=Multilayer Composite Print|PadNumberFontSize=14|Record=PcbPrintOut|ShowHoles=False|ShowPadNets=False|ShowPadNumbers=False|SubstituteFonts=False
344 | Configuration1_Name3=OutputConfigurationParameter3
345 | Configuration1_Item3=CArc=Full|CFill=Full|Comment=Full|Coordinate=Full|CPad=Full|CRegion=Full|CText=Full|CTrack=Full|CVia=Full|Designator=Full|Dimension=Full|DLayer1=TopLayer|DLayer2=BottomLayer|DrillType=Regular|FArc=Full|FFill=Full|FPad=Full|FRegion=Full|FText=Full|FTrack=Full|FVia=Full|Layer=TopOverlay|Polygon=Full|PrintOutIndex=0|Record=PcbPrintLayer
346 | Configuration1_Name4=OutputConfigurationParameter4
347 | Configuration1_Item4=CArc=Full|CFill=Full|Comment=Full|Coordinate=Full|CPad=Full|CRegion=Full|CText=Full|CTrack=Full|CVia=Full|Designator=Full|Dimension=Full|DLayer1=TopLayer|DLayer2=BottomLayer|DrillType=Regular|FArc=Full|FFill=Full|FPad=Full|FRegion=Full|FText=Full|FTrack=Full|FVia=Full|Layer=TopLayer|Polygon=Full|PrintOutIndex=0|Record=PcbPrintLayer
348 | Configuration1_Name5=OutputConfigurationParameter5
349 | Configuration1_Item5=CArc=Full|CFill=Full|Comment=Full|Coordinate=Full|CPad=Full|CRegion=Full|CText=Full|CTrack=Full|CVia=Full|Designator=Full|Dimension=Full|DLayer1=TopLayer|DLayer2=BottomLayer|DrillType=Regular|FArc=Full|FFill=Full|FPad=Full|FRegion=Full|FText=Full|FTrack=Full|FVia=Full|Layer=BottomLayer|Polygon=Full|PrintOutIndex=0|Record=PcbPrintLayer
350 | Configuration1_Name6=OutputConfigurationParameter6
351 | Configuration1_Item6=CArc=Full|CFill=Full|Comment=Full|Coordinate=Full|CPad=Full|CRegion=Full|CText=Full|CTrack=Full|CVia=Full|Designator=Full|Dimension=Full|DLayer1=TopLayer|DLayer2=BottomLayer|DrillType=Regular|FArc=Full|FFill=Full|FPad=Full|FRegion=Full|FText=Full|FTrack=Full|FVia=Full|Layer=MultiLayer|Polygon=Full|PrintOutIndex=0|Record=PcbPrintLayer
352 | Configuration1_Name7=OutputConfigurationParameter7
353 | Configuration1_Item7=CArc=Full|CFill=Full|Comment=Full|Coordinate=Full|CPad=Full|CRegion=Full|CText=Full|CTrack=Full|CVia=Full|Designator=Full|Dimension=Full|DLayer1=TopLayer|DLayer2=BottomLayer|DrillType=Regular|FArc=Full|FFill=Full|FPad=Full|FRegion=Full|FText=Full|FTrack=Full|FVia=Full|Layer=BottomOverlay|Polygon=Full|PrintOutIndex=0|Record=PcbPrintLayer
354 | Configuration1_Name8=OutputConfigurationParameter8
355 | Configuration1_Item8=CArc=Full|CFill=Full|Comment=Full|Coordinate=Full|CPad=Full|CRegion=Full|CText=Full|CTrack=Full|CVia=Full|Designator=Full|Dimension=Full|DLayer1=TopLayer|DLayer2=BottomLayer|DrillType=Regular|FArc=Full|FFill=Full|FPad=Full|FRegion=Full|FText=Full|FTrack=Full|FVia=Full|Layer=Mechanical1|Polygon=Full|PrintOutIndex=0|Record=PcbPrintLayer
356 | Configuration1_Name9=OutputConfigurationParameter9
357 | Configuration1_Item9=CArc=Full|CFill=Full|Comment=Full|Coordinate=Full|CPad=Full|CRegion=Full|CText=Full|CTrack=Full|CVia=Full|Designator=Full|Dimension=Full|DLayer1=TopLayer|DLayer2=BottomLayer|DrillType=Regular|FArc=Full|FFill=Full|FPad=Full|FRegion=Full|FText=Full|FTrack=Full|FVia=Full|Layer=Mechanical3|Polygon=Full|PrintOutIndex=0|Record=PcbPrintLayer
358 | Configuration1_Name10=OutputConfigurationParameter10
359 | Configuration1_Item10=CArc=Full|CFill=Full|Comment=Full|Coordinate=Full|CPad=Full|CRegion=Full|CText=Full|CTrack=Full|CVia=Full|Designator=Full|Dimension=Full|DLayer1=TopLayer|DLayer2=BottomLayer|DrillType=Regular|FArc=Full|FFill=Full|FPad=Full|FRegion=Full|FText=Full|FTrack=Full|FVia=Full|Layer=Mechanical11|Polygon=Full|PrintOutIndex=0|Record=PcbPrintLayer
360 | Configuration1_Name11=OutputConfigurationParameter11
361 | Configuration1_Item11=CArc=Full|CFill=Full|Comment=Full|Coordinate=Full|CPad=Full|CRegion=Full|CText=Full|CTrack=Full|CVia=Full|Designator=Full|Dimension=Full|DLayer1=TopLayer|DLayer2=BottomLayer|DrillType=Regular|FArc=Full|FFill=Full|FPad=Full|FRegion=Full|FText=Full|FTrack=Full|FVia=Full|Layer=Mechanical12|Polygon=Full|PrintOutIndex=0|Record=PcbPrintLayer
362 | Configuration1_Name12=OutputConfigurationParameter12
363 | Configuration1_Item12=CArc=Full|CFill=Full|Comment=Full|Coordinate=Full|CPad=Full|CRegion=Full|CText=Full|CTrack=Full|CVia=Full|Designator=Full|Dimension=Full|DLayer1=TopLayer|DLayer2=BottomLayer|DrillType=Regular|FArc=Full|FFill=Full|FPad=Full|FRegion=Full|FText=Full|FTrack=Full|FVia=Full|Layer=Mechanical13|Polygon=Full|PrintOutIndex=0|Record=PcbPrintLayer
364 | Configuration1_Name13=OutputConfigurationParameter13
365 | Configuration1_Item13=CArc=Full|CFill=Full|Comment=Full|Coordinate=Full|CPad=Full|CRegion=Full|CText=Full|CTrack=Full|CVia=Full|Designator=Full|Dimension=Full|DLayer1=TopLayer|DLayer2=BottomLayer|DrillType=Regular|FArc=Full|FFill=Full|FPad=Full|FRegion=Full|FText=Full|FTrack=Full|FVia=Full|Layer=Mechanical15|Polygon=Full|PrintOutIndex=0|Record=PcbPrintLayer
366 | Configuration1_Name14=OutputConfigurationParameter14
367 | Configuration1_Item14=CArc=Full|CFill=Full|Comment=Full|Coordinate=Full|CPad=Full|CRegion=Full|CText=Full|CTrack=Full|CVia=Full|Designator=Full|Dimension=Full|DLayer1=TopLayer|DLayer2=BottomLayer|DrillType=Regular|FArc=Full|FFill=Full|FPad=Full|FRegion=Full|FText=Full|FTrack=Full|FVia=Full|Layer=Mechanical17|Polygon=Full|PrintOutIndex=0|Record=PcbPrintLayer
368 | Configuration1_Name15=OutputConfigurationParameter15
369 | Configuration1_Item15=CArc=Full|CFill=Full|Comment=Full|Coordinate=Full|CPad=Full|CRegion=Full|CText=Full|CTrack=Full|CVia=Full|Designator=Full|Dimension=Full|DLayer1=TopLayer|DLayer2=BottomLayer|DrillType=Regular|FArc=Full|FFill=Full|FPad=Full|FRegion=Full|FText=Full|FTrack=Full|FVia=Full|Layer=Mechanical19|Polygon=Full|PrintOutIndex=0|Record=PcbPrintLayer
370 | Configuration1_Name16=OutputConfigurationParameter16
371 | Configuration1_Item16=CArc=Full|CFill=Full|Comment=Full|Coordinate=Full|CPad=Full|CRegion=Full|CText=Full|CTrack=Full|CVia=Full|Designator=Full|Dimension=Full|DLayer1=TopLayer|DLayer2=BottomLayer|DrillType=Regular|FArc=Full|FFill=Full|FPad=Full|FRegion=Full|FText=Full|FTrack=Full|FVia=Full|Layer=Mechanical21|Polygon=Full|PrintOutIndex=0|Record=PcbPrintLayer
372 | OutputType2=PCB 3D Print
373 | OutputName2=PCB 3D Print
374 | OutputDocumentPath2=
375 | OutputVariantName2=[No Variations]
376 | OutputDefault2=0
377 | PageOptions2=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=Letter|PaperIndex=1
378 | OutputType3=PCB 3D Video
379 | OutputName3=PCB 3D Video
380 | OutputDocumentPath3=
381 | OutputVariantName3=[No Variations]
382 | OutputDefault3=0
383 | PageOptions3=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=Letter|PaperIndex=1
384 | OutputType4=PCB Print
385 | OutputName4=PCB Prints
386 | OutputDocumentPath4=
387 | OutputVariantName4=
388 | OutputDefault4=0
389 | PageOptions4=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=Letter|PaperIndex=1
390 | OutputType5=PCBDrawing
391 | OutputName5=Draftsman
392 | OutputDocumentPath5=
393 | OutputVariantName5=[No Variations]
394 | OutputDefault5=0
395 | PageOptions5=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=Letter|PaperIndex=1
396 | OutputType6=PCBLIB Print
397 | OutputName6=PCBLIB Prints
398 | OutputDocumentPath6=
399 | OutputVariantName6=
400 | OutputDefault6=0
401 | PageOptions6=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=Letter|PaperIndex=1
402 | OutputType7=PDF3D
403 | OutputName7=PDF3D
404 | OutputDocumentPath7=
405 | OutputVariantName7=[No Variations]
406 | OutputDefault7=0
407 | PageOptions7=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=Letter|PaperIndex=1
408 | OutputType8=Report Print
409 | OutputName8=Report Prints
410 | OutputDocumentPath8=
411 | OutputVariantName8=
412 | OutputDefault8=0
413 | PageOptions8=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=Letter|PaperIndex=1
414 | OutputType9=Schematic Print
415 | OutputName9=Schematic Prints
416 | OutputDocumentPath9=
417 | OutputVariantName9=
418 | OutputDefault9=0
419 | PageOptions9=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=Letter|PaperIndex=1
420 | OutputType10=SimView Print
421 | OutputName10=SimView Prints
422 | OutputDocumentPath10=
423 | OutputVariantName10=
424 | OutputDefault10=0
425 | PageOptions10=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=Letter|PaperIndex=1
426 |
427 | [OutputGroup4]
428 | Name=Assembly Outputs
429 | Description=
430 | TargetPrinter=NPIB8638C (HP LaserJet 100 colorMFP M175nw)
431 | PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1
432 | OutputType1=Assembly
433 | OutputName1=Assembly Drawings
434 | OutputDocumentPath1=
435 | OutputVariantName1=[No Variations]
436 | OutputDefault1=0
437 | PageOptions1=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=Letter|PaperIndex=1
438 | OutputType2=Pick Place
439 | OutputName2=Generates pick and place files
440 | OutputDocumentPath2=
441 | OutputVariantName2=[No Variations]
442 | OutputDefault2=0
443 | OutputType3=Test Points For Assembly
444 | OutputName3=Test Point Report
445 | OutputDocumentPath3=
446 | OutputVariantName3=[No Variations]
447 | OutputDefault3=0
448 |
449 | [OutputGroup5]
450 | Name=Fabrication Outputs
451 | Description=
452 | TargetPrinter=NPIB8638C (HP LaserJet 100 colorMFP M175nw)
453 | PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1
454 | OutputType1=Board Stack Report
455 | OutputName1=Report Board Stack
456 | OutputDocumentPath1=
457 | OutputVariantName1=
458 | OutputDefault1=0
459 | PageOptions1=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=Letter|PaperIndex=1
460 | OutputType2=CompositeDrill
461 | OutputName2=Composite Drill Drawing
462 | OutputDocumentPath2=
463 | OutputVariantName2=
464 | OutputDefault2=0
465 | PageOptions2=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=Letter|PaperIndex=1
466 | OutputType3=Drill
467 | OutputName3=Drill Drawing/Guides
468 | OutputDocumentPath3=
469 | OutputVariantName3=
470 | OutputDefault3=0
471 | PageOptions3=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=Letter|PaperIndex=1
472 | OutputType4=Final
473 | OutputName4=Final Artwork Prints
474 | OutputDocumentPath4=
475 | OutputVariantName4=[No Variations]
476 | OutputDefault4=0
477 | PageOptions4=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=Letter|PaperIndex=1
478 | OutputType5=Gerber
479 | OutputName5=Gerber Files
480 | OutputDocumentPath5=
481 | OutputVariantName5=[No Variations]
482 | OutputDefault5=0
483 | OutputType6=Gerber X2
484 | OutputName6=Gerber X2 Files
485 | OutputDocumentPath6=
486 | OutputVariantName6=
487 | OutputDefault6=0
488 | OutputType7=IPC2581
489 | OutputName7=IPC-2581 Files
490 | OutputDocumentPath7=
491 | OutputVariantName7=
492 | OutputDefault7=0
493 | OutputType8=Mask
494 | OutputName8=Solder/Paste Mask Prints
495 | OutputDocumentPath8=
496 | OutputVariantName8=
497 | OutputDefault8=0
498 | PageOptions8=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=Letter|PaperIndex=1
499 | OutputType9=NC Drill
500 | OutputName9=NC Drill Files
501 | OutputDocumentPath9=
502 | OutputVariantName9=
503 | OutputDefault9=0
504 | OutputType10=ODB
505 | OutputName10=ODB++ Files
506 | OutputDocumentPath10=
507 | OutputVariantName10=[No Variations]
508 | OutputDefault10=0
509 | OutputType11=Plane
510 | OutputName11=Power-Plane Prints
511 | OutputDocumentPath11=
512 | OutputVariantName11=
513 | OutputDefault11=0
514 | PageOptions11=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=Letter|PaperIndex=1
515 | OutputType12=Test Points
516 | OutputName12=Test Point Report
517 | OutputDocumentPath12=
518 | OutputVariantName12=
519 | OutputDefault12=0
520 |
521 | [OutputGroup6]
522 | Name=Report Outputs
523 | Description=
524 | TargetPrinter=NPIB8638C (HP LaserJet 100 colorMFP M175nw)
525 | PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1
526 | OutputType1=BOM_PartType
527 | OutputName1=Bill of Materials
528 | OutputDocumentPath1=
529 | OutputVariantName1=[No Variations]
530 | OutputDefault1=0
531 | PageOptions1=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=Letter|PaperIndex=1
532 | OutputType2=ComponentCrossReference
533 | OutputName2=Component Cross Reference Report
534 | OutputDocumentPath2=
535 | OutputVariantName2=[No Variations]
536 | OutputDefault2=0
537 | OutputType3=ReportHierarchy
538 | OutputName3=Report Project Hierarchy
539 | OutputDocumentPath3=
540 | OutputVariantName3=[No Variations]
541 | OutputDefault3=0
542 | OutputType4=Script
543 | OutputName4=Script Output
544 | OutputDocumentPath4=
545 | OutputVariantName4=[No Variations]
546 | OutputDefault4=0
547 | OutputType5=SimpleBOM
548 | OutputName5=Simple BOM
549 | OutputDocumentPath5=
550 | OutputVariantName5=[No Variations]
551 | OutputDefault5=0
552 | OutputType6=SinglePinNetReporter
553 | OutputName6=Report Single Pin Nets
554 | OutputDocumentPath6=
555 | OutputVariantName6=[No Variations]
556 | OutputDefault6=0
557 |
558 | [OutputGroup7]
559 | Name=Other Outputs
560 | Description=
561 | TargetPrinter=NPIB8638C (HP LaserJet 100 colorMFP M175nw)
562 | PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1
563 | OutputType1=Text Print
564 | OutputName1=Text Print
565 | OutputDocumentPath1=
566 | OutputVariantName1=
567 | OutputDefault1=0
568 | PageOptions1=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=Letter|PaperIndex=1
569 | OutputType2=Text Print
570 | OutputName2=Text Print
571 | OutputDocumentPath2=
572 | OutputVariantName2=
573 | OutputDefault2=0
574 | PageOptions2=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9
575 | OutputType3=Text Print
576 | OutputName3=Text Print
577 | OutputDocumentPath3=
578 | OutputVariantName3=
579 | OutputDefault3=0
580 | PageOptions3=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9
581 | OutputType4=Text Print
582 | OutputName4=Text Print
583 | OutputDocumentPath4=
584 | OutputVariantName4=
585 | OutputDefault4=0
586 | PageOptions4=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9
587 | OutputType5=Text Print
588 | OutputName5=Text Print
589 | OutputDocumentPath5=
590 | OutputVariantName5=
591 | OutputDefault5=0
592 | PageOptions5=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9
593 | OutputType6=Text Print
594 | OutputName6=Text Print
595 | OutputDocumentPath6=
596 | OutputVariantName6=
597 | OutputDefault6=0
598 | PageOptions6=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9
599 | OutputType7=Text Print
600 | OutputName7=Text Print
601 | OutputDocumentPath7=
602 | OutputVariantName7=
603 | OutputDefault7=0
604 | PageOptions7=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9
605 | OutputType8=Text Print
606 | OutputName8=Text Print
607 | OutputDocumentPath8=
608 | OutputVariantName8=
609 | OutputDefault8=0
610 | PageOptions8=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9
611 | OutputType9=Text Print
612 | OutputName9=Text Print
613 | OutputDocumentPath9=
614 | OutputVariantName9=
615 | OutputDefault9=0
616 | PageOptions9=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9
617 | OutputType10=Text Print
618 | OutputName10=Text Print
619 | OutputDocumentPath10=
620 | OutputVariantName10=
621 | OutputDefault10=0
622 | PageOptions10=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9
623 | OutputType11=Text Print
624 | OutputName11=Text Print
625 | OutputDocumentPath11=
626 | OutputVariantName11=
627 | OutputDefault11=0
628 | PageOptions11=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9
629 | OutputType12=Text Print
630 | OutputName12=Text Print
631 | OutputDocumentPath12=
632 | OutputVariantName12=
633 | OutputDefault12=0
634 | PageOptions12=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9
635 | OutputType13=Text Print
636 | OutputName13=Text Print
637 | OutputDocumentPath13=
638 | OutputVariantName13=
639 | OutputDefault13=0
640 | PageOptions13=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9
641 | OutputType14=Text Print
642 | OutputName14=Text Print
643 | OutputDocumentPath14=
644 | OutputVariantName14=
645 | OutputDefault14=0
646 | PageOptions14=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9
647 | OutputType15=Text Print
648 | OutputName15=Text Print
649 | OutputDocumentPath15=
650 | OutputVariantName15=
651 | OutputDefault15=0
652 | PageOptions15=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9
653 | OutputType16=Text Print
654 | OutputName16=Text Print
655 | OutputDocumentPath16=
656 | OutputVariantName16=
657 | OutputDefault16=0
658 | PageOptions16=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9
659 | OutputType17=Text Print
660 | OutputName17=Text Print
661 | OutputDocumentPath17=
662 | OutputVariantName17=
663 | OutputDefault17=0
664 | PageOptions17=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9
665 | OutputType18=Text Print
666 | OutputName18=Text Print
667 | OutputDocumentPath18=
668 | OutputVariantName18=
669 | OutputDefault18=0
670 | PageOptions18=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9
671 | OutputType19=Text Print
672 | OutputName19=Text Print
673 | OutputDocumentPath19=
674 | OutputVariantName19=
675 | OutputDefault19=0
676 | PageOptions19=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9
677 | OutputType20=Text Print
678 | OutputName20=Text Print
679 | OutputDocumentPath20=
680 | OutputVariantName20=
681 | OutputDefault20=0
682 | PageOptions20=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9
683 | OutputType21=Text Print
684 | OutputName21=Text Print
685 | OutputDocumentPath21=
686 | OutputVariantName21=
687 | OutputDefault21=0
688 | PageOptions21=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9
689 | OutputType22=Text Print
690 | OutputName22=Text Print
691 | OutputDocumentPath22=
692 | OutputVariantName22=
693 | OutputDefault22=0
694 | PageOptions22=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9
695 | OutputType23=Text Print
696 | OutputName23=Text Print
697 | OutputDocumentPath23=
698 | OutputVariantName23=
699 | OutputDefault23=0
700 | PageOptions23=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9
701 | OutputType24=Text Print
702 | OutputName24=Text Print
703 | OutputDocumentPath24=
704 | OutputVariantName24=
705 | OutputDefault24=0
706 | PageOptions24=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9
707 | OutputType25=Text Print
708 | OutputName25=Text Print
709 | OutputDocumentPath25=
710 | OutputVariantName25=
711 | OutputDefault25=0
712 | PageOptions25=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9
713 | OutputType26=Text Print
714 | OutputName26=Text Print
715 | OutputDocumentPath26=
716 | OutputVariantName26=
717 | OutputDefault26=0
718 | PageOptions26=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9
719 | OutputType27=Text Print
720 | OutputName27=Text Print
721 | OutputDocumentPath27=
722 | OutputVariantName27=
723 | OutputDefault27=0
724 | PageOptions27=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9
725 | OutputType28=Text Print
726 | OutputName28=Text Print
727 | OutputDocumentPath28=
728 | OutputVariantName28=
729 | OutputDefault28=0
730 | PageOptions28=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9
731 | OutputType29=Text Print
732 | OutputName29=Text Print
733 | OutputDocumentPath29=
734 | OutputVariantName29=
735 | OutputDefault29=0
736 | PageOptions29=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9
737 |
738 | [OutputGroup8]
739 | Name=Validation Outputs
740 | Description=
741 | TargetPrinter=NPIB8638C (HP LaserJet 100 colorMFP M175nw)
742 | PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1
743 | OutputType1=Component states check
744 | OutputName1=Server's components states check
745 | OutputDocumentPath1=
746 | OutputVariantName1=
747 | OutputDefault1=0
748 | OutputType2=Configuration compliance
749 | OutputName2=Environment configuration compliance check
750 | OutputDocumentPath2=
751 | OutputVariantName2=
752 | OutputDefault2=0
753 | OutputType3=Design Rules Check
754 | OutputName3=Design Rules Check
755 | OutputDocumentPath3=
756 | OutputVariantName3=
757 | OutputDefault3=0
758 | PageOptions3=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=Letter|PaperIndex=1
759 | OutputType4=Differences Report
760 | OutputName4=Differences Report
761 | OutputDocumentPath4=
762 | OutputVariantName4=
763 | OutputDefault4=0
764 | PageOptions4=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=Letter|PaperIndex=1
765 | OutputType5=Electrical Rules Check
766 | OutputName5=Electrical Rules Check
767 | OutputDocumentPath5=
768 | OutputVariantName5=
769 | OutputDefault5=0
770 | PageOptions5=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=Letter|PaperIndex=1
771 | OutputType6=Footprint Comparison Report
772 | OutputName6=Footprint Comparison Report
773 | OutputDocumentPath6=
774 | OutputVariantName6=
775 | OutputDefault6=0
776 | OutputType7=BOM_Violations
777 | OutputName7=BOM Checks Report
778 | OutputDocumentPath7=
779 | OutputVariantName7=
780 | OutputDefault7=0
781 |
782 | [OutputGroup9]
783 | Name=Export Outputs
784 | Description=
785 | TargetPrinter=NPIB8638C (HP LaserJet 100 colorMFP M175nw)
786 | PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1
787 | OutputType1=AutoCAD dwg/dxf PCB
788 | OutputName1=AutoCAD dwg/dxf File PCB
789 | OutputDocumentPath1=
790 | OutputVariantName1=
791 | OutputDefault1=0
792 | OutputType2=AutoCAD dwg/dxf Schematic
793 | OutputName2=AutoCAD dwg/dxf File Schematic
794 | OutputDocumentPath2=
795 | OutputVariantName2=
796 | OutputDefault2=0
797 | OutputType3=ExportIDF
798 | OutputName3=Export IDF
799 | OutputDocumentPath3=
800 | OutputVariantName3=
801 | OutputDefault3=0
802 | OutputType4=ExportPARASOLID
803 | OutputName4=Export PARASOLID
804 | OutputDocumentPath4=
805 | OutputVariantName4=[No Variations]
806 | OutputDefault4=0
807 | OutputType5=ExportSTEP
808 | OutputName5=Export STEP
809 | OutputDocumentPath5=
810 | OutputVariantName5=[No Variations]
811 | OutputDefault5=0
812 | OutputType6=ExportVRML
813 | OutputName6=Export VRML
814 | OutputDocumentPath6=
815 | OutputVariantName6=[No Variations]
816 | OutputDefault6=0
817 | OutputType7=Save As/Export PCB
818 | OutputName7=Save As/Export PCB
819 | OutputDocumentPath7=
820 | OutputVariantName7=
821 | OutputDefault7=0
822 | OutputType8=Save As/Export Schematic
823 | OutputName8=Save As/Export Schematic
824 | OutputDocumentPath8=
825 | OutputVariantName8=
826 | OutputDefault8=0
827 | OutputType9=Specctra Design PCB
828 | OutputName9=Specctra Design PCB
829 | OutputDocumentPath9=
830 | OutputVariantName9=
831 | OutputDefault9=0
832 | OutputType10=MBAExportPARASOLID
833 | OutputName10=Export PARASOLID
834 | OutputDocumentPath10=
835 | OutputVariantName10=
836 | OutputDefault10=0
837 | OutputType11=MBAExportSTEP
838 | OutputName11=Export STEP
839 | OutputDocumentPath11=
840 | OutputVariantName11=
841 | OutputDefault11=0
842 |
843 | [OutputGroup10]
844 | Name=PostProcess Outputs
845 | Description=
846 | TargetPrinter=NPIB8638C (HP LaserJet 100 colorMFP M175nw)
847 | PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1
848 | OutputType1=Copy Files
849 | OutputName1=Copy Files
850 | OutputDocumentPath1=
851 | OutputVariantName1=
852 | OutputDefault1=0
853 |
854 | [Modification Levels]
855 | Type1=1
856 | Type2=1
857 | Type3=1
858 | Type4=1
859 | Type5=1
860 | Type6=1
861 | Type7=1
862 | Type8=1
863 | Type9=1
864 | Type10=1
865 | Type11=1
866 | Type12=1
867 | Type13=1
868 | Type14=1
869 | Type15=1
870 | Type16=1
871 | Type17=1
872 | Type18=1
873 | Type19=1
874 | Type20=1
875 | Type21=1
876 | Type22=1
877 | Type23=1
878 | Type24=1
879 | Type25=1
880 | Type26=1
881 | Type27=1
882 | Type28=1
883 | Type29=1
884 | Type30=1
885 | Type31=1
886 | Type32=1
887 | Type33=1
888 | Type34=1
889 | Type35=1
890 | Type36=1
891 | Type37=1
892 | Type38=1
893 | Type39=1
894 | Type40=1
895 | Type41=1
896 | Type42=1
897 | Type43=1
898 | Type44=1
899 | Type45=1
900 | Type46=1
901 | Type47=1
902 | Type48=1
903 | Type49=1
904 | Type50=1
905 | Type51=1
906 | Type52=1
907 | Type53=1
908 | Type54=1
909 | Type55=1
910 | Type56=1
911 | Type57=1
912 | Type58=1
913 | Type59=1
914 | Type60=1
915 | Type61=1
916 | Type62=1
917 | Type63=1
918 | Type64=1
919 | Type65=1
920 | Type66=1
921 | Type67=1
922 | Type68=1
923 | Type69=1
924 | Type70=1
925 | Type71=1
926 | Type72=1
927 | Type73=1
928 | Type74=1
929 | Type75=1
930 | Type76=1
931 | Type77=1
932 | Type78=1
933 | Type79=1
934 | Type80=1
935 | Type81=1
936 | Type82=1
937 | Type83=1
938 | Type84=1
939 | Type85=1
940 | Type86=1
941 | Type87=1
942 | Type88=1
943 | Type89=1
944 | Type90=1
945 | Type91=1
946 | Type92=1
947 | Type93=1
948 | Type94=1
949 | Type95=1
950 | Type96=1
951 | Type97=1
952 | Type98=1
953 | Type99=1
954 | Type100=1
955 | Type101=1
956 | Type102=1
957 | Type103=1
958 | Type104=1
959 | Type105=1
960 | Type106=1
961 | Type107=1
962 | Type108=1
963 | Type109=1
964 | Type110=1
965 | Type111=1
966 | Type112=1
967 | Type113=1
968 | Type114=1
969 | Type115=1
970 | Type116=1
971 | Type117=1
972 |
973 | [Difference Levels]
974 | Type1=1
975 | Type2=1
976 | Type3=1
977 | Type4=1
978 | Type5=1
979 | Type6=1
980 | Type7=1
981 | Type8=1
982 | Type9=1
983 | Type10=1
984 | Type11=1
985 | Type12=1
986 | Type13=1
987 | Type14=1
988 | Type15=1
989 | Type16=1
990 | Type17=1
991 | Type18=1
992 | Type19=1
993 | Type20=1
994 | Type21=1
995 | Type22=1
996 | Type23=1
997 | Type24=1
998 | Type25=1
999 | Type26=1
1000 | Type27=1
1001 | Type28=1
1002 | Type29=1
1003 | Type30=1
1004 | Type31=1
1005 | Type32=1
1006 | Type33=1
1007 | Type34=1
1008 | Type35=1
1009 | Type36=1
1010 | Type37=1
1011 | Type38=1
1012 | Type39=1
1013 | Type40=1
1014 | Type41=1
1015 | Type42=1
1016 | Type43=1
1017 | Type44=1
1018 | Type45=1
1019 | Type46=1
1020 | Type47=1
1021 | Type48=1
1022 | Type49=1
1023 | Type50=1
1024 | Type51=1
1025 | Type52=1
1026 | Type53=1
1027 | Type54=1
1028 | Type55=1
1029 | Type56=1
1030 | Type57=1
1031 | Type58=1
1032 | Type59=1
1033 | Type60=1
1034 | Type61=1
1035 | Type62=1
1036 | Type63=1
1037 | Type64=1
1038 | Type65=1
1039 | Type66=1
1040 |
1041 | [Electrical Rules Check]
1042 | Type1=1
1043 | Type2=1
1044 | Type3=2
1045 | Type4=1
1046 | Type5=2
1047 | Type6=2
1048 | Type7=1
1049 | Type8=1
1050 | Type9=1
1051 | Type10=1
1052 | Type11=2
1053 | Type12=2
1054 | Type13=2
1055 | Type14=1
1056 | Type15=1
1057 | Type16=1
1058 | Type17=1
1059 | Type18=1
1060 | Type19=1
1061 | Type20=1
1062 | Type21=1
1063 | Type22=1
1064 | Type23=1
1065 | Type24=1
1066 | Type25=2
1067 | Type26=2
1068 | Type27=2
1069 | Type28=1
1070 | Type29=1
1071 | Type30=1
1072 | Type31=1
1073 | Type32=2
1074 | Type33=2
1075 | Type34=2
1076 | Type35=1
1077 | Type36=2
1078 | Type37=1
1079 | Type38=2
1080 | Type39=2
1081 | Type40=2
1082 | Type41=0
1083 | Type42=2
1084 | Type43=1
1085 | Type44=1
1086 | Type45=2
1087 | Type46=1
1088 | Type47=2
1089 | Type48=2
1090 | Type49=1
1091 | Type50=2
1092 | Type51=1
1093 | Type52=1
1094 | Type53=1
1095 | Type54=1
1096 | Type55=1
1097 | Type56=2
1098 | Type57=1
1099 | Type58=1
1100 | Type59=2
1101 | Type60=1
1102 | Type61=2
1103 | Type62=2
1104 | Type63=1
1105 | Type64=0
1106 | Type65=2
1107 | Type66=3
1108 | Type67=2
1109 | Type68=2
1110 | Type69=2
1111 | Type70=2
1112 | Type71=2
1113 | Type72=2
1114 | Type73=2
1115 | Type74=1
1116 | Type75=2
1117 | Type76=1
1118 | Type77=1
1119 | Type78=1
1120 | Type79=1
1121 | Type80=2
1122 | Type81=3
1123 | Type82=3
1124 | Type83=3
1125 | Type84=3
1126 | Type85=3
1127 | Type86=2
1128 | Type87=2
1129 | Type88=2
1130 | Type89=1
1131 | Type90=1
1132 | Type91=3
1133 | Type92=3
1134 | Type93=2
1135 | Type94=2
1136 | Type95=2
1137 | Type96=2
1138 | Type97=2
1139 | Type98=0
1140 | Type99=1
1141 | Type100=2
1142 | Type101=1
1143 | Type102=2
1144 | Type103=2
1145 | Type104=1
1146 | Type105=2
1147 | Type106=2
1148 | Type107=2
1149 | Type108=2
1150 | Type109=1
1151 | Type110=1
1152 | Type111=1
1153 | Type112=1
1154 | Type113=1
1155 | Type114=2
1156 | Type115=2
1157 | Type116=2
1158 | Type117=3
1159 | Type118=3
1160 | Type119=3
1161 | MultiChannelAlternate=2
1162 | AlternateItemFail=3
1163 | Type122=2
1164 |
1165 | [ERC Connection Matrix]
1166 | L1=NNNNNNNNNNNWNNNWW
1167 | L2=NNWNNNNWWWNWNWNWN
1168 | L3=NWEENEEEENEWNEEWN
1169 | L4=NNENNNWEENNWNENWN
1170 | L5=NNNNNNNNNNNNNNNNN
1171 | L6=NNENNNNEENNWNENWN
1172 | L7=NNEWNNWEENNWNENWN
1173 | L8=NWEENEENEEENNEENN
1174 | L9=NWEENEEEENEWNEEWW
1175 | L10=NWNNNNNENNEWNNEWN
1176 | L11=NNENNNNEEENWNENWN
1177 | L12=WWWWNWWNWWWNWWWNN
1178 | L13=NNNNNNNNNNNWNNNWW
1179 | L14=NWEENEEEENEWNEEWW
1180 | L15=NNENNNNEEENWNENWW
1181 | L16=WWWWNWWNWWWNWWWNW
1182 | L17=WNNNNNNNWNNNWWWWN
1183 |
1184 | [Annotate]
1185 | SortOrder=3
1186 | SortLocation=0
1187 | MatchParameter1=Comment
1188 | MatchStrictly1=1
1189 | MatchParameter2=Library Reference
1190 | MatchStrictly2=1
1191 | PhysicalNamingFormat=$Component_$RoomName
1192 | GlobalIndexSortOrder=3
1193 | GlobalIndexSortLocation=0
1194 |
1195 | [PrjClassGen]
1196 | CompClassManualEnabled=0
1197 | CompClassManualRoomEnabled=0
1198 | NetClassAutoBusEnabled=1
1199 | NetClassAutoCompEnabled=0
1200 | NetClassAutoNamedHarnessEnabled=0
1201 | NetClassManualEnabled=1
1202 | NetClassSeparateForBusSections=0
1203 |
1204 | [LibraryUpdateOptions]
1205 | SelectedOnly=0
1206 | UpdateVariants=1
1207 | PartTypes=0
1208 | ComponentLibIdentifierKind0=Library Name And Type
1209 | ComponentLibraryIdentifier0=CarretaOpenBMS.IntLib
1210 | ComponentDesignItemID0=2N7002
1211 | ComponentSymbolReference0=2N7002
1212 | ComponentUpdate0=0
1213 | ComponentIsDeviceSheet0=0
1214 | ComponentLibIdentifierKind1=Library Name And Type
1215 | ComponentLibraryIdentifier1=CarretaOpenBMS.IntLib
1216 | ComponentDesignItemID1=ATtiny402
1217 | ComponentSymbolReference1=ATtiny402
1218 | ComponentUpdate1=0
1219 | ComponentIsDeviceSheet1=0
1220 | ComponentLibIdentifierKind2=Library Name And Type
1221 | ComponentLibraryIdentifier2=CarretaOpenBMS.IntLib
1222 | ComponentDesignItemID2=BSP603S2L
1223 | ComponentSymbolReference2=BSP603S2L
1224 | ComponentUpdate2=0
1225 | ComponentIsDeviceSheet2=0
1226 | ComponentLibIdentifierKind3=Library Name And Type
1227 | ComponentLibraryIdentifier3=CarretaOpenBMS.IntLib
1228 | ComponentDesignItemID3=C
1229 | ComponentSymbolReference3=C
1230 | ComponentUpdate3=0
1231 | ComponentIsDeviceSheet3=0
1232 | ComponentLibIdentifierKind4=Library Name And Type
1233 | ComponentLibraryIdentifier4=CarretaOpenBMS.IntLib
1234 | ComponentDesignItemID4=H1x3
1235 | ComponentSymbolReference4=H1x3
1236 | ComponentUpdate4=0
1237 | ComponentIsDeviceSheet4=0
1238 | ComponentLibIdentifierKind5=Library Name And Type
1239 | ComponentLibraryIdentifier5=CarretaOpenBMS.IntLib
1240 | ComponentDesignItemID5=H1x4
1241 | ComponentSymbolReference5=H1x4
1242 | ComponentUpdate5=0
1243 | ComponentIsDeviceSheet5=0
1244 | ComponentLibIdentifierKind6=Library Name And Type
1245 | ComponentLibraryIdentifier6=CarretaOpenBMS.IntLib
1246 | ComponentDesignItemID6=LED
1247 | ComponentSymbolReference6=LED
1248 | ComponentUpdate6=0
1249 | ComponentIsDeviceSheet6=0
1250 | ComponentLibIdentifierKind7=Library Name And Type
1251 | ComponentLibraryIdentifier7=CarretaOpenBMS.IntLib
1252 | ComponentDesignItemID7=PAD
1253 | ComponentSymbolReference7=PAD
1254 | ComponentUpdate7=1
1255 | ComponentIsDeviceSheet7=0
1256 | ComponentLibIdentifierKind8=Library Name And Type
1257 | ComponentLibraryIdentifier8=CarretaOpenBMS.IntLib
1258 | ComponentDesignItemID8=R
1259 | ComponentSymbolReference8=R
1260 | ComponentUpdate8=0
1261 | ComponentIsDeviceSheet8=0
1262 | FullReplace=1
1263 | UpdateDesignatorLock=0
1264 | UpdatePartIDLock=0
1265 | PreserveParameterLocations=1
1266 | PreserveParameterVisibility=1
1267 | DoGraphics=1
1268 | DoParameters=1
1269 | DoModels=1
1270 | AddParameters=0
1271 | RemoveParameters=0
1272 | AddModels=1
1273 | RemoveModels=1
1274 | UpdateCurrentModels=1
1275 | ParameterName0=Comment
1276 | ParameterUpdate0=1
1277 | ParameterName1=Component Kind
1278 | ParameterUpdate1=1
1279 | ParameterName2=Description
1280 | ParameterUpdate2=1
1281 | ParameterName3=Library Reference
1282 | ParameterUpdate3=1
1283 | ParameterName4=Value
1284 | ParameterUpdate4=1
1285 | ModelTypeGroup0=PCBLIB
1286 | ModelTypeUpdate0=1
1287 | ModelType0=PCBLIB
1288 | ModelName0=ATtiny402-SSFR
1289 | ModelUpdate0=1
1290 | ModelType1=PCBLIB
1291 | ModelName1=C1608_0603I_N
1292 | ModelUpdate1=1
1293 | ModelType2=PCBLIB
1294 | ModelName2=C2012_0805I_N
1295 | ModelUpdate2=1
1296 | ModelType3=PCBLIB
1297 | ModelName3=H1x3
1298 | ModelUpdate3=1
1299 | ModelType4=PCBLIB
1300 | ModelName4=H1x4
1301 | ModelUpdate4=1
1302 | ModelType5=PCBLIB
1303 | ModelName5=LED1608_0603I_N
1304 | ModelUpdate5=1
1305 | ModelType6=PCBLIB
1306 | ModelName6=PAD
1307 | ModelUpdate6=1
1308 | ModelType7=PCBLIB
1309 | ModelName7=PAD_CIRC
1310 | ModelUpdate7=1
1311 | ModelType8=PCBLIB
1312 | ModelName8=PAD_CIRC_HOLE
1313 | ModelUpdate8=1
1314 | ModelType9=PCBLIB
1315 | ModelName9=PAD_HOLE
1316 | ModelUpdate9=1
1317 | ModelType10=PCBLIB
1318 | ModelName10=R1608_0603I_N
1319 | ModelUpdate10=1
1320 | ModelType11=PCBLIB
1321 | ModelName11=R6432_2512I_L
1322 | ModelUpdate11=1
1323 | ModelType12=PCBLIB
1324 | ModelName12=R6432_2512I_M
1325 | ModelUpdate12=1
1326 | ModelType13=PCBLIB
1327 | ModelName13=R6432_2512I_N
1328 | ModelUpdate13=1
1329 | ModelType14=PCBLIB
1330 | ModelName14=SOT223_L
1331 | ModelUpdate14=1
1332 | ModelType15=PCBLIB
1333 | ModelName15=SOT223_M
1334 | ModelUpdate15=1
1335 | ModelType16=PCBLIB
1336 | ModelName16=SOT223_N
1337 | ModelUpdate16=1
1338 | ModelType17=PCBLIB
1339 | ModelName17=SOT23-3_L
1340 | ModelUpdate17=1
1341 | ModelType18=PCBLIB
1342 | ModelName18=SOT23-3_M
1343 | ModelUpdate18=1
1344 | ModelType19=PCBLIB
1345 | ModelName19=SOT23-3_N
1346 | ModelUpdate19=1
1347 |
1348 | [DatabaseUpdateOptions]
1349 | SelectedOnly=0
1350 | UpdateVariants=1
1351 | PartTypes=0
1352 |
1353 | [Comparison Options]
1354 | ComparisonOptions0=Kind=Net|MinPercent=75|MinMatch=3|ShowMatch=-1|Confirm=-1|UseName=-1|InclAllRules=0
1355 | ComparisonOptions1=Kind=Net Class|MinPercent=75|MinMatch=3|ShowMatch=-1|Confirm=-1|UseName=-1|InclAllRules=0
1356 | ComparisonOptions2=Kind=Component Class|MinPercent=75|MinMatch=3|ShowMatch=-1|Confirm=-1|UseName=-1|InclAllRules=0
1357 | ComparisonOptions3=Kind=Rule|MinPercent=75|MinMatch=3|ShowMatch=-1|Confirm=-1|UseName=-1|InclAllRules=0
1358 | ComparisonOptions4=Kind=Differential Pair|MinPercent=50|MinMatch=1|ShowMatch=0|Confirm=0|UseName=0|InclAllRules=0
1359 | ComparisonOptions5=Kind=Structure Class|MinPercent=75|MinMatch=3|ShowMatch=-1|Confirm=-1|UseName=-1|InclAllRules=0
1360 |
1361 | [SmartPDF]
1362 | PageOptions=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=Letter|PaperIndex=1
1363 |
1364 |
--------------------------------------------------------------------------------