Mbed CAN 网络只能获取一半的数据

Mbed CAN network only gets half the data

我正在创建一个软件,该软件必须在具有 CAN 网络的单元中请求数据。 出于某种原因,我只在被要求时收到一部分正在发送的数据。 如代码所示,该单元具有 100 kbit 或 100000 位的 CAN 频率。 我正在使用 Nucleo-F767ZI 并连接到 CAN 网络,我正在使用开发板的内置功能。

我已经查看了正在发送的数据是否有错误,但这似乎没问题,因为不同的程序能够毫无错误地读取它。 我目前用来测试的代码就是这个位

#include "mbed.h"

CAN can1(PD_0, PD_1);//Sets the pins for the CAN.
Serial pc(USBTX, USBRX);//Selects the type of serial and assigns a name to it.
char buffer[300];

int main (){
    pc.baud(9600);//sets serialportbaud to 9600
    CANMessage test;
    can1.frequency(100000); //Sets frequency speed. it has to be 100000 otherwise the unit wont respond
    test.format = CANStandard; //Selects the format for the can message.
    test.id = 24; //Gives the can message an ID.
    test.len = 2; //How long the message is in bytes.
    test.data[0] = 0; //Select the data for this byte. 
    test.data[1] = 3;
    can1.write(test); //this sends the data of 0 , 3 with the id of 24 and gets data from the unit its being send to.

    printf("\n\rsended \n\r"); //confirmation that it has come this far without crashing.

    while(true){
        can1.read(receive);//receives any message send over the network except his own.
        sprintf(buffer, "%d/%d/%d/%d/%d/%d/%d/%d", receive.data[0], receive.data[1], receive.data[2], receive.data[3], receive.data[4], receive.data[5], receive.data[6], receive.data[7]);//stores data in buffer
        printf("%s \n\r", buffer);//shows what the data was
    }
}

我通过增加串行波特率来修复它,它显然太慢了,无法在它已经改变之前足够快地打印 te 数据。