![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Test CAN bus on Stm32F746nG
Dependencies: F746_GUI mbed CANMsg
Revision 1:68083f9dd39d, committed 2020-08-30
- Comitter:
- 38domo
- Date:
- Sun Aug 30 14:42:53 2020 +0000
- Parent:
- 0:77e62347e7c9
- Commit message:
- test bus can avec stm32f746
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Aug 06 14:21:20 2020 +0000 +++ b/main.cpp Sun Aug 30 14:42:53 2020 +0000 @@ -222,6 +222,25 @@ } //timer.start(); // insert transmission lag } // end if timer + // read can + if (can.read(rxMsg)); + { + pc.printf("-------------------------------------\r\n"); + pc.printf("CAN message received\r\n"); + serial2.printf("CAN message received\r\n"); + + printMsg(rxMsg,1); + serial2.printf("%d\n",rxMsg); + serial2.printf("ID: "); + serial2.printf("ID: 0x%.3x ", rxMsg.id); + serial2.printf("D: "); + for(int i = 0; i < rxMsg.len; i++) + serial2.printf(" 0x%.2X", rxMsg.data[i]); + serial2.printf("\r\n"); + } + + + // read serial port // get serial 2 //serial2.gets(buffer, 4);