![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
all bms comunicating with nucleo board and balancing
Fork of Can_sniffer_BMS_GER by
Diff: main.cpp
- Revision:
- 4:ccf4ac2deac8
- Parent:
- 3:464b06c16d24
- Child:
- 5:c6503b7ae971
--- a/main.cpp Fri Jul 24 00:46:47 2015 +0000 +++ b/main.cpp Sat Jul 25 19:43:00 2015 +0000 @@ -7,7 +7,10 @@ * See <https://developer.mbed.org/users/WiredHome/notebook/can---getting-started/> * The same source code is used for both NUCLEO boards, but: * For board #1 compile the example without any change. - * For board #2 set BOARD1 to 0 + * For board #2 comment out the line #define BOARD1 1 before compiling + * + * Once compiled, download the binaries to the boards. + * To start ping/ponging messages reset both boards at the same time. * * Note: * To simplify adding/getting data to/from a CAN message @@ -58,7 +61,7 @@ * @retval */ int main() { - can.frequency(500000); // Initialize CAN and set bit rate to 500kbs + can.frequency(1000000); // Initialize CAN and set bit rate to 1Mbps can.attach(&onMsgReceived, CAN::RxIrq); // attach 'CAN receive complete' interrupt handler timer.reset(); #if defined(BOARD1) @@ -69,7 +72,7 @@ #endif while(1) { - if(timer.read() >= 2.0) { // check for timeout + if(timer.read() >= 1.0) { // check for timeout timer.stop(); // stop timer timer.reset(); // reset timer (to avaoid repeated send) counter++; // increment counter