Ultima versão da banca de ensaios ECU Fev2017
Fork of Can_sniffer_BMS4 by
Diff: main.cpp
- Revision:
- 29:3af76325f86a
- Parent:
- 28:2329d581e394
- Child:
- 30:1bc79ae58a42
--- a/main.cpp Mon Oct 24 21:37:48 2016 +0000 +++ b/main.cpp Tue Oct 25 08:24:50 2016 +0000 @@ -23,6 +23,7 @@ //#define BOARD1 1 // comment out this line when compiling for board #2 + //CAN devices IDs and reserved ID's----------------------------------- //ID|Device //9|ECU|Key switch @@ -35,6 +36,67 @@ //-------------------------------------------------------------------- + + +/*************Zivan NG3-G7MICB Charger(Input 230VAC-19A;Output 96 VDC-25A)***** +FLuxograma do processo de carregamento: +(1) Primeira parte do precharge +(2) Conectar baterias +(3) Segunda parte do precharge (inicio de carga) +(4) Mensagens periodicas 0x6C1 (modulação da corrente) +(4) Carregar a 25A atepremeira celula chegar aos 4.1V =>10A +(5) Parar carregamento quando tensao de todas as celulas= 4.1V ou de uma das celulas for 4.2V +(6) Desligar carregador e desconectar bateria ???(ver manual) + +Tarefas: +-acabar de formatar o codigo do BMS encurtando interrupts, programando todas as BMS's e aumentando fiabilidade, etc +-ligar carregador e ver que tensoes de CAN e de saida manda cá para fora+ ver que mensagens +-experimentar leer valores programados no charger com SDO messages (ver o que é um lsb) +-experimentar fazer um procedimento de precharge +-se a play and drive nao responder a tempo entao fazer logo com precharge + +Mensagens: +(charger CAN node is 11 by default. So the Id of the message will be 0x60B in +hexadecimal) + +"node id" [1;20]*4. ex. if node=1then 0x280+1*4=0x284 + +Charger->BMS (normally reserved id's) +0x380+node_id (period: 1,000S): actual output current, voltage and Ah +0x280+node_id (period: 4,000S): alarms flags, hardware start/stop status +0x180+node_id (answer for 0x776 message): tambem é uma das respostas durante o precharge +0x580+node_id: answer to 0x600 SDO message + +BMS->Charger +0x6C1: current output modulation(simplest implmentation) +0x776: (broadcast; from BMS to chargers): current and voltage setpoints, battery detection setpoint +0x6C1: (broadcast message; from BMS to charger): only mandatory message BMS need to implement (4s timeout) +0x600+node_id: SDO messages + +Reserved id's: +0x48A +0x68A +0x69A +0x777 +0x380+node_id +0x180+node_id +0x600+node_id +0x580+node_id +...remote display default node is 21... + +Precharge: +(ID|Message) +To charger:(0x600+node_id | 22-60-60-01-V_HI-V_LO-0-0) +From charger:(0x580+node_id | 60-60-60-01-0-0-0-0) +From charger:(0x580+node_id | 80-60-60-01-XX-XX-XX-XX) +From charger:(0x180+node_id | I_HI-I_LO-V_HI-V_LO-01-'O'-'K'-n) +To charger:(0x600+node_id | 22-60-60-02-0-0-0-0) +From charger:(0x580+node_id | 60-60-60-02-0-0-0-0) +From charger:(0x580+node_id | 80-60-60-02-XX-XX-XX-XX) + +******************************************************************************/ + + const unsigned int RX_ID = 0x100; const unsigned int TX_ID = 0x101; @@ -113,6 +175,7 @@ } data; bool to_charge_or_not_to_charge=true; // false = discharge +uint8_t motostate=0; int main() @@ -163,8 +226,8 @@ txMsg.clear(); txMsg.id = 9; //BMS1=>ID:11; BMS2=>ID:12; BMS3=>ID:13. txMsg.len = 1; - // txMsg.data[0] = (0b00000001 & key_switch)|((0b00000001 & to_charge_or_not_to_charge)<<1); -txMsg.data[0] = 0b00000010; + motostate = (0b00000001 & key_switch)|((0b00000001 & to_charge_or_not_to_charge)<<1); + txMsg.data[0] = motostate; //------------------------------------------------ if(can.write(txMsg)) {