mirror of
https://github.com/doppelhub/Honda_Insight_LiBCM.git
synced 2026-06-10 23:47:28 -04:00
Prototyped voltage-based grid disable
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1 +1 @@
|
||||
*.DS_Store
|
||||
**.DS_Store
|
||||
|
||||
BIN
Electronics/.DS_Store
vendored
BIN
Electronics/.DS_Store
vendored
Binary file not shown.
BIN
Electronics/PCB (KiCAD)/.DS_Store
vendored
BIN
Electronics/PCB (KiCAD)/.DS_Store
vendored
Binary file not shown.
BIN
Electronics/PCB (KiCAD)/RevA/.DS_Store
vendored
BIN
Electronics/PCB (KiCAD)/RevA/.DS_Store
vendored
Binary file not shown.
BIN
Electronics/PCB (KiCAD)/RevA/CARs/.DS_Store
vendored
BIN
Electronics/PCB (KiCAD)/RevA/CARs/.DS_Store
vendored
Binary file not shown.
@@ -1,3 +1,8 @@
|
||||
Add a connector for external Nextion screen. Also need to add a FET (or use debug one) to turn Nextion off when car is off.
|
||||
|
||||
Combine METSCI & BATTSCI to free up a serial port. Still requires QTY2 LTC RS-488 chips. Need to add another pin to control each chip output input impedance when key is off.
|
||||
Combine METSCI & BATTSCI to free up a serial port. Still requires QTY2 LTC RS-488 chips. Need to add another pin to control each chip output input impedance when key is off.
|
||||
|
||||
VCC
|
||||
TX (Nextion)
|
||||
RX (Nextion)
|
||||
GND
|
||||
@@ -41,3 +41,7 @@ These traces are (accidentally) routed well. Should still look at optimizing th
|
||||
Update: I removed R144 and connected a lead - with series 50 Ohm resistor - directly from the BMS connector's 24+ to R144 (net C12_B). This is a direct sense to the LTC6804 for C24... but unfortunately it only reduced the measurement error 10 mV (from 33 mV to 23 mV. Something else is wrong here.
|
||||
|
||||
Going to play around with ADC update rate, etc.
|
||||
|
||||
...
|
||||
|
||||
Solution: There was a short from highest cell on IC to Vin.
|
||||
|
||||
@@ -18,7 +18,7 @@ DLW5ATN272SQ2L
|
||||
Solutions:
|
||||
|
||||
Between Input- & output-:
|
||||
Add a ~1nF capacitance between HVDC- & 12V-. Put QTY2 22 nF in series between these negative leads for safety.
|
||||
Add capacitance between HVDC- & 12V-. Put QTY2 22 nF in series between these negative leads for safety.
|
||||
|
||||
Between HVDCDC inputs:
|
||||
Add 44 nF
|
||||
|
||||
@@ -10,4 +10,8 @@ If possible, rotate bay 3 fan's wire hole for better wire routing on back of PCB
|
||||
|
||||
Reroute HVDC so that pack voltage goes through fuse, then cap, then HVDCDC.
|
||||
|
||||
HVDC 8pin screw terminal probably blocked by aluminum shaft that bolts from PDU to IMA battery.
|
||||
HVDC 8pin screw terminal probably blocked by aluminum shaft that bolts from PDU to IMA battery.
|
||||
|
||||
Remove Redundant Neutral & GND Vias
|
||||
|
||||
Move HVDCDC inward 0.1" to prevent interference with enclosure. Same with cap and fuse.
|
||||
@@ -20,4 +20,12 @@ R265 (and related): 1.4 kOhm
|
||||
Requirement to achieve 1.0 mA: R267+R265 = 2 kOhm
|
||||
Requirement to achieve 0.5 mA: R267+R265 = 4 kOhm
|
||||
|
||||
Current should lie between these two values. Ideally close to - but not more than - 1 mA.
|
||||
Current should lie between these two values. Ideally close to - but not more than - 1 mA.
|
||||
|
||||
Solution:
|
||||
0.75 mA:
|
||||
R267 (and related): 1.00 kOhm
|
||||
R265 (and related): 1.65 kOhm (3k3 || 3k3)
|
||||
|
||||
Add ground plane under isoSPI to reduce noise
|
||||
Change R130 to (22 nF || 100 kOhm), to reduce common mode noise. Note that R130 is larger than 0805.
|
||||
@@ -0,0 +1 @@
|
||||
Make PCB thicker, so it deflects less.
|
||||
@@ -0,0 +1,2 @@
|
||||
Add 2nd temp sensor to each LTC6804.
|
||||
Move temp sensor closer to cells... they're the warmest by far.
|
||||
@@ -0,0 +1 @@
|
||||
,master,Chonker.local,19.05.2021 23:44,file:///Users/master/Library/Application%20Support/LibreOffice/4;
|
||||
Binary file not shown.
BIN
Firmware/.DS_Store
vendored
BIN
Firmware/.DS_Store
vendored
Binary file not shown.
BIN
Firmware/Prototype Building Blocks/.DS_Store
vendored
BIN
Firmware/Prototype Building Blocks/.DS_Store
vendored
Binary file not shown.
Binary file not shown.
@@ -125,24 +125,22 @@ uint16_t aux_codes[TOTAL_IC][6];
|
||||
|
||||
uint8_t tx_cfg[TOTAL_IC][6];
|
||||
/*!<
|
||||
The tx_cfg[][6] stores the LTC6804 configuration data that is going to be written
|
||||
to the LTC6804 ICs on the daisy chain. The LTC6804 configuration data that will be
|
||||
written should be stored in blocks of 6 bytes. The array should have the following format:
|
||||
tx_cfg[][6] stores the LTC6804 configuration data to be written
|
||||
to the LTC6804 ICs. The 6 byte array should have the following format:
|
||||
|
||||
| tx_cfg[0][0]| tx_cfg[0][1] | tx_cfg[0][2]| tx_cfg[0][3]| tx_cfg[0][4]| tx_cfg[0][5]| tx_cfg[1][0] | tx_cfg[1][1]| tx_cfg[1][2]| ..... |
|
||||
|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|-----------|
|
||||
|IC1 CFGR0 |IC1 CFGR1 |IC1 CFGR2 |IC1 CFGR3 |IC1 CFGR4 |IC1 CFGR5 |IC2 CFGR0 |IC2 CFGR1 | IC2 CFGR2 | ..... |
|
||||
| tx_cfg[0][0]| tx_cfg[0][1] | tx_cfg[0][2]| tx_cfg[0][3]| tx_cfg[0][4]| tx_cfg[0][5]|
|
||||
|--------------|--------------|--------------|--------------|--------------|--------------|
|
||||
|IC1 CFGR0 |IC1 CFGR1 |IC1 CFGR2 |IC1 CFGR3 |IC1 CFGR4 |IC1 CFGR5 |
|
||||
|
||||
*/
|
||||
|
||||
uint8_t rx_cfg[TOTAL_IC][8];
|
||||
/*!<
|
||||
the rx_cfg[][8] array stores the data that is read back from a LTC6804-1 daisy chain.
|
||||
The configuration data for each IC is stored in blocks of 8 bytes. Below is an table illustrating the array organization:
|
||||
the rx_cfg[][8] array stores the 8 byte configuration data read back from the LTC6804:
|
||||
|
||||
|rx_config[0][0]|rx_config[0][1]|rx_config[0][2]|rx_config[0][3]|rx_config[0][4]|rx_config[0][5]|rx_config[0][6] |rx_config[0][7] |rx_config[1][0]|rx_config[1][1]| ..... |
|
||||
|---------------|---------------|---------------|---------------|---------------|---------------|-----------------|----------------|---------------|---------------|-----------|
|
||||
|IC1 CFGR0 |IC1 CFGR1 |IC1 CFGR2 |IC1 CFGR3 |IC1 CFGR4 |IC1 CFGR5 |IC1 PEC High |IC1 PEC Low |IC2 CFGR0 |IC2 CFGR1 | ..... |
|
||||
|rx_config[0][0]|rx_config[0][1]|rx_config[0][2]|rx_config[0][3]|rx_config[0][4]|rx_config[0][5]|rx_config[0][6] |rx_config[0][7] |
|
||||
|---------------|---------------|---------------|---------------|---------------|---------------|-----------------|----------------|
|
||||
|IC1 CFGR0 |IC1 CFGR1 |IC1 CFGR2 |IC1 CFGR3 |IC1 CFGR4 |IC1 CFGR5 |IC1 PEC High |IC1 PEC Low |
|
||||
*/
|
||||
|
||||
//JTS Move to hardware IO file
|
||||
@@ -333,6 +331,26 @@ void run_command(uint8_t cmd)
|
||||
Serial.println(F("A PEC error was detected in the received data"));
|
||||
}
|
||||
print_cells();
|
||||
|
||||
//check for full cell(s)
|
||||
uint16_t cellVoltage_highest = 0;
|
||||
for (int current_ic = 0 ; current_ic < TOTAL_IC; current_ic++)
|
||||
{
|
||||
for (int i=0; i<12; i++)
|
||||
{
|
||||
if( cell_codes[current_ic][i] > cellVoltage_highest )
|
||||
{
|
||||
cellVoltage_highest = cell_codes[current_ic][i];
|
||||
}
|
||||
if( cell_codes[current_ic][i] > 36750 ) //3.7 volts
|
||||
{
|
||||
Serial.println("Cell " + String(current_ic * 12 + i + 1) + " is full." );
|
||||
turnGridCharger_Off();
|
||||
//tx_cfg[current_ic][i]
|
||||
}
|
||||
}
|
||||
}
|
||||
Serial.println("Highest cell voltage is: " + String(cellVoltage_highest , DEC) );
|
||||
delay(500);
|
||||
}
|
||||
print_menu();
|
||||
@@ -348,16 +366,13 @@ void run_command(uint8_t cmd)
|
||||
|
||||
if( gridEnabled || !(gridPowerPresent) ) //charger is enabled, or unplugged
|
||||
{
|
||||
analogWrite(GRIDPWM_PIN,255); //Set power to zero
|
||||
delay(100);
|
||||
digitalWrite(GRIDEN_PIN,LOW); //Turn charger off
|
||||
Serial.println(F("Charger turned off"));
|
||||
turnGridCharger_Off();
|
||||
}
|
||||
if( !(gridEnabled) && gridPowerPresent ) //charger off & plugged in
|
||||
{
|
||||
digitalWrite(GRIDEN_PIN,HIGH); //Turn charger on
|
||||
delay(100);
|
||||
for(int ii=255; ii>0; ii--)
|
||||
for(int ii=255; ii>=0; ii--)
|
||||
{
|
||||
analogWrite(GRIDPWM_PIN,ii);
|
||||
delay(2);
|
||||
@@ -399,16 +414,17 @@ void run_command(uint8_t cmd)
|
||||
/*!***********************************
|
||||
\brief Initializes the configuration array
|
||||
**************************************/
|
||||
//JTS2do: This doesn't need to be a 2D array. Data identical on all LTC, except DCC12:1.
|
||||
void init_cfg()
|
||||
{
|
||||
for (int i = 0; i<TOTAL_IC; i++)
|
||||
{
|
||||
tx_cfg[i][0] = 0xFE;
|
||||
tx_cfg[i][1] = 0x00 ;
|
||||
tx_cfg[i][2] = 0x00 ;
|
||||
tx_cfg[i][3] = 0x00 ;
|
||||
tx_cfg[i][4] = 0x00 ;
|
||||
tx_cfg[i][5] = 0x00 ;
|
||||
{ // BIT7 BIT6 BIT5 BIT4 BIT3 BIT2 BIT1 BIT0
|
||||
tx_cfg[i][0] = 0xF6 ; //GPIO5 GPIO4 GPIO3 GPIO2 GPIO1 REFON SWTRD ADCOPT //Enable GPIO pulldown, etc
|
||||
tx_cfg[i][1] = 0x00 ; //VUV[7] VUV[6] VUV[5] VUV[4] VUV[3] VUV[2] VUV[1] VUV[0] //Undervoltage comparison voltage
|
||||
tx_cfg[i][2] = 0x00 ; //VOV[3] VOV[2] VOV[1] VOV[0] VUV[11] VUV[10] VUV[9] VUV[8]
|
||||
tx_cfg[i][3] = 0x00 ; //VOV[11] VOV[10] VOV[9] VOV[8] VOV[7] VOV[6] VOV[5] VOV[4] //Overvoltage comparison voltage
|
||||
tx_cfg[i][4] = 0x00 ; //DCC8 DCC7 DCC6 DCC5 DCC4 DCC3 DCC2 DCC1 //Enables discharge on cells 8:1
|
||||
tx_cfg[i][5] = 0x00 ; //DCTO[3] DCTO[2] DCTO[1] DCTO[0] DCC12 DCC11 DCC10 DCC9 //Discharge timer and cells 12:9
|
||||
}
|
||||
}
|
||||
|
||||
@@ -560,3 +576,11 @@ void serial_print_hex(uint8_t data)
|
||||
else
|
||||
Serial.print((byte)data,HEX);
|
||||
}
|
||||
|
||||
void turnGridCharger_Off(void)
|
||||
{
|
||||
analogWrite(GRIDPWM_PIN,255); //Set power to zero
|
||||
delay(100);
|
||||
digitalWrite(GRIDEN_PIN,LOW); //Turn charger off
|
||||
Serial.println(F("Charger turned off"));
|
||||
}
|
||||
|
||||
@@ -95,7 +95,6 @@ uint8_t ADAX[2]; //!< GPIO conversion command.
|
||||
*/
|
||||
void LTC6804_initialize()
|
||||
{
|
||||
quikeval_SPI_connect();
|
||||
spi_enable(SPI_CLOCK_DIV64);
|
||||
set_adc(MD_NORMAL,DCP_DISABLED,CELL_CH_ALL,AUX_CH_GPIO1);
|
||||
}
|
||||
@@ -109,7 +108,7 @@ void LTC6804_initialize()
|
||||
@param[in] uint8_t CHG Determines which GPIO channels are measured during Auxiliary conversion command
|
||||
|
||||
Command Code: \n
|
||||
|command | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|
||||
|command | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|
||||
|-----------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|
|
||||
|ADCV: | 0 | 1 | MD[1] | MD[2] | 1 | 1 | DCP | 0 | CH[2] | CH[1] | CH[0] |
|
||||
|ADAX: | 1 | 0 | MD[1] | MD[2] | 1 | 1 | DCP | 0 | CHG[2]| CHG[1]| CHG[0]|
|
||||
@@ -122,8 +121,8 @@ void set_adc(uint8_t MD, //ADC Mode
|
||||
{
|
||||
uint8_t md_bits;
|
||||
|
||||
md_bits = (MD & 0x02) >> 1;
|
||||
ADCV[0] = md_bits + 0x02;
|
||||
md_bits = (MD & 0x02) >> 1; //set bit 8 (MD[1]) in ADCV[0]... MD[0] is in ADCV[1]
|
||||
ADCV[0] = md_bits + 0x02; //set bit 9 true
|
||||
md_bits = (MD & 0x01) << 7;
|
||||
ADCV[1] = md_bits + 0x60 + (DCP<<4) + CH;
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ Copyright 2013 Linear Technology Corp. (LTC)
|
||||
|
||||
|
||||
#ifndef LTC6804_CS
|
||||
#define LTC6804_CS QUIKEVAL_CS
|
||||
#define LTC6804_CS SS //Arduino Mega SPI Slave Select line
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -134,25 +134,6 @@ void spi_transfer_block(uint8_t cs_pin, uint8_t *tx, uint8_t *rx, uint8_t length
|
||||
output_high(cs_pin); //! 3) Pull CS high
|
||||
}
|
||||
|
||||
// Connect SPI pins to QuikEval connector through the Linduino MUX. This will disconnect I2C.
|
||||
void quikeval_SPI_connect()
|
||||
{
|
||||
pinMode(QUIKEVAL_CS, OUTPUT);
|
||||
output_high(QUIKEVAL_CS); //! 1) Pull Chip Select High
|
||||
|
||||
//! 2) Enable Main SPI
|
||||
pinMode(QUIKEVAL_MUX_MODE_PIN, OUTPUT);
|
||||
digitalWrite(QUIKEVAL_MUX_MODE_PIN, LOW);
|
||||
}
|
||||
|
||||
// Configure the SPI port for 4MHz SCK.
|
||||
// This function or spi_enable() must be called
|
||||
// before using the other SPI routines.
|
||||
void quikeval_SPI_init(void) // Initializes SPI
|
||||
{
|
||||
spi_enable(SPI_CLOCK_DIV16); //! 1) Configure the spi port for 4MHz SCK
|
||||
}
|
||||
|
||||
// Setup the processor for hardware SPI communication.
|
||||
// Must be called before using the other SPI routines.
|
||||
// Alternatively, call quikeval_SPI_connect(), which automatically
|
||||
|
||||
@@ -98,14 +98,6 @@ void spi_transfer_block(uint8_t cs_pin, //!< Chip select pin
|
||||
uint8_t length //!< Length of array
|
||||
);
|
||||
|
||||
//! Connect SPI pins to QuikEval connector through the Linduino MUX. This will disconnect I2C.
|
||||
void quikeval_SPI_connect();
|
||||
|
||||
//! Configure the SPI port for 4Mhz SCK.
|
||||
//! This function or spi_enable() must be called
|
||||
//! before using the other SPI routines.
|
||||
void quikeval_SPI_init();
|
||||
|
||||
//! Setup the processor for hardware SPI communication.
|
||||
//! Must be called before using the other SPI routines.
|
||||
//! Alternatively, call quikeval_SPI_connect(), which automatically
|
||||
|
||||
@@ -54,7 +54,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//! @{
|
||||
|
||||
#define QUIKEVAL_GPIO 9 //!< Linduino QuikEval GPIO pin (QuikEval connector pin 14) connects to Arduino pin 9
|
||||
#define QUIKEVAL_CS SS //!< QuikEval CS pin (SPI chip select on QuikEval connector pin 6) connects to Arduino SS pin.
|
||||
#define QUIKEVAL_MUX_MODE_PIN 8 /*!< QUIKEVAL_MUX_MODE_PIN defines the control pin for the QuikEval MUX.
|
||||
The I2C port's SCL and the SPI port's SCK signals share the same pin on the Linduino's QuikEval connector.
|
||||
Additionally, the I2C port's SDA and the SPI port's MOSI signals share the same pin on the Linduino's QuikEval connector.
|
||||
|
||||
Reference in New Issue
Block a user