6 years ago.

CAN bus operation Nucleo F746ZG

A quick question.

Using code based on the CAN demo with the Nucleo F746ZG I'm sending a CAN message once every half a second using a wait.

#include "mbed.h"

CAN can1(PD_0, PD_1);
char counter = 0;

int main() {
    CANMessage msg;
    while(1) {
        if(can1.write(CANMessage(1337, &counter, 1))) 
            printf("Message sent: %d\n", counter);

When I put a scope on the CAN lines I get the following, it looks like its transmitting much much faster than that, what is going on?


Thanks for your help.

1 Answer

6 years ago.

If no other nodes are connected to the CAN bus then what you see on the scope are most likely the automatically repeated transmits of your node because it does not get acknowledgement from others. To fix it, either connect at least one additional node to the CAN bus or try to run your node in loop-back mode.

Accepted Answer