Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
7 years, 1 month ago.
How to USE CAN3 of NUCLEO-F767ZI?
CAN 1 and 2 of NucleoF 767 ZI were able to work, but CAN 3 can not be worked.
CAN3 test
#include "mbed.h" CAN can1(PB_8,PB_9); CAN can2(PB_5,PB_6); CAN can3(PB_3,PB_4); Serial pc(USBTX,USBRX); int main() { can1.frequency(500000); can2.frequency(500000); can3.frequency(500000); CANMessage msg[3]; msg[0].id = 0x701; msg[0].data[0] = 1; msg[1].id = 0x702; msg[1].data[0] = 2; msg[2].id = 0x703; msg[2].data[0] = 3; pc.printf("Start\r\n"); while (true) { pc.printf("send CAN msg\r\n"); can1.write(msg[0]); can2.write(msg[1]); can3.write(msg[2]); wait(1); } }
When trying to change the baud rate of CAN 3, the following error will be output from the serial port.
can ESR 0x3567.9116 + timeout status 0
CAN 1 and CAN 2 will work when changed as shown below, but CAN 3 is unresponsive
CAN3 test
~ //CAN can3(PB_3,PB_4); CAN can3(PB_3,PB_4,500000); ~ // can3.frequency(500000);
https://os.mbed.com/teams/ST/wiki/SDK-changes-log
It says that there are only two CANs in device.h. Is not CAN 3 usable?
https://github.com/ARMmbed/mbed-os/blob/master/targets/TARGET_STM/TARGET_STM32F7/can_device.h
/*+ + + Added on December 6 + + +*/
CAN 3 is supported with v 156
However, when trying to change the frequency of CAN 3 with the following program, an error was output from the USB serial. Also, LD1 will blink.
error print [ can ESR 0x3d77.a116 + timeout status 0 ]
Is there a workaround?
CAN3 test SDK v157
#include "mbed.h" DigitalOut led(LED2); CAN can1(PB_8,PB_9); CAN can2(PB_12,PB_13); CAN can3(PB_3,PB_4); Serial pc(USBTX,USBRX); int main() { CANMessage msg[3]; msg[0].id = 0x701; msg[0].data[0] = 1; msg[1].id = 0x702; msg[1].data[0] = 2; msg[2].id = 0x703; msg[2].data[0] = 3; pc.printf("CAN1 freq change\r\n"); can1.frequency(500000); pc.printf("CAN2 freq change\r\n"); can2.frequency(500000); pc.printf("CAN3 freq change\r\n"); can3.frequency(500000); while (true) { can1.write(msg[0]); can2.write(msg[1]); can3.write(msg[2]); led = !led; wait(1); } }
Question relating to:
1 Answer
7 years, 1 month ago.
Hi,
This is a bug. Only CAN1 and CAN2 are supported right now. We'll correct it.
Thanks for having found this.
Thank you for responding.
But CAN 2 and CAN 3 did not work.
OnlineIDE: mbed-os 3561: 182 bb d 5
mbed CLI: ARMmbed-mbed-os-mbed_lib_rev 156-0-g182bbd5.zip
I tried both but stopped trying to change the communication speed of CAN 2, CAN 3 to 500 kbps.
There is no problem with CAN 1 alone.
posted by 02 Dec 2017Assigned to
7 years ago.This means that the question has been accepted and is being worked on.
Correction on-going on GitHub:
https://github.com/ARMmbed/mbed-os/pull/5486
posted by bco stm 15 Nov 2017