Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: bq79606.cpp
- Revision:
- 3:4dc457ed63d5
- Parent:
- 2:03a6da61d834
- Child:
- 4:28919318b141
--- a/bq79606.cpp Wed Dec 23 21:41:03 2020 +0000 +++ b/bq79606.cpp Sat Mar 20 17:54:12 2021 +0000 @@ -15,7 +15,7 @@ extern DigitalOut bmsWakeUp; void sendUART(int length, uint8_t * data){ - pc1.printf("SENDING TO BOARD"); + pc1.printf("SENDING TO BOARD\n"); for(int i = 0; i < length; i++) { //pc1.putc(data[i]); bms.putc(data[i]); @@ -27,8 +27,16 @@ bmsWakeUp = 1; wait_ms(50); bmsWakeUp = 0; - wait_ms(10); + wait_ms(50); //bmsWakeUp = 1; + + //NMOS TRANSISTOR LOGIC + + /*bmsWakeUp = 0; + wait_ms(50); + bmsWakeUp = 1; + wait_ms(50); + bmsWakeUp = 0;*/ } void AutoAddress() @@ -277,14 +285,18 @@ WriteReg(0, UV_THRESH, 0x53, 1, FRMWRT_ALL_NR); //sets cell UV to 2.8V WriteReg(0, OV_THRESH, 0x5B, 1, FRMWRT_ALL_NR); //sets cell OV to 4.3V + WriteReg(0, GPIO_ADC_CONF, 0x3F, 1, FRMWRT_ALL_NR); //configure GPIO as AUX voltage (absolute voltage, set to 0 for ratiometric) + WriteReg(0, AUX_ADC_CONF, 0x08, 1, FRMWRT_ALL_NR); //1MHz AUX sample rate, 128 decimation ratio WriteReg(0, CELL_ADC_CONF1, 0x67, 1, FRMWRT_ALL_NR); //256 decimation ratio, 1MHz sample. 1.2 Hz LPF WriteReg(0, CELL_ADC_CONF2, 0x00, 1, FRMWRT_ALL_NR); //single conversion WriteReg(0, CONTROL2, 0x01, 1, FRMWRT_ALL_NR); //CELL_ADC_GO = 1 ///enable continuous sampling. Otherwise, single conversions with CONTROL2[CELL_ADC_GO] //WriteReg(0,CELL_ADC_CONF2, 0x0A,1,FRMWRT_ALL_NR);//continuous sampling with 5ms interval - //WriteReg(0, CONTROL2, 0x10, 1, FRMWRT_ALL_NR);// enable TSREF to give enough settling time - //wait_ms(2); // provides settling time for TSREF + WriteReg(0, CONTROL2, 0x10, 1, FRMWRT_ALL_NR);// enable TSREF to give enough settling time + wait_ms(2); // provides settling time for TSREF + + WriteReg(0, DIAG_CTRL2, 0x41, 1, FRMWRT_ALL_NR); //set AUX ADC to measure cell 1