7 years 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:

STM32 Nucleo-144 development board with STM32F767ZIT6 MCU, supports Arduino, ST Zio and morpho connectivity

Correction on-going on GitHub:

https://github.com/ARMmbed/mbed-os/pull/5486

posted by bco stm 15 Nov 2017

1 Answer

7 years 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 your response. I am looking forward to the correction.

posted by sh koyama 14 Nov 2017

CAN3 is now supported in mbed-os-5.6.5

posted by bco stm 27 Nov 2017

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 sh koyama 02 Dec 2017

Just to confirm: Before mbed-os 5.6.5 Can1 and Can2 worked on the F767ZI, Can3 did not. The fix in mbed-os 5.6.5 and 5.6.6 breaks Can2, trying to initialize it results in a timeout.

posted by Anders Tallberg 08 Dec 2017

Assigned to sh koyama 6 years, 11 months ago.

This means that the question has been accepted and is being worked on.