This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

can启用远程帧的接收位置

can我打开了RTR远程帧,中断接收函数canMessageNotification。

但是实际上我在中断中没有接收到远程帧,是不是另有地方来读取RTR?

我移植了CANopen,发送远程帧,开启RTR后,得到了回应,但是不知道在什么地方接受的远程帧,因为我写的底层can只有一个发送,一个中断。

  • CAN 远程帧是一个空数据场的帧, 关键是在它的ID场和远程帧标志位,当远程帧标志位为1时他就是远程帧,数据场必须为空,被请求节点通过ID场的辨识来响应,发送被请求的帧到总线上,具体举例,我随便举一个,BCM需要知道车门的状态,一个远程帧过去,车门把自己的状态发回来
    
    
    另外最后一句你的意思是,你没有写如何接收的代码?
  • 我的所有接收都是通过can中断来接收的,那么是不是包括远程帧呢?

    master发送远程帧的时候,can中断没有响应,所以下面的RTR判断也无法进行。

    unsigned char canReceive(Message *m)
    {
    	uint32 msgBoxArbitVal = 0;
    	uint32 msgCTL = 0;
    
    	msgCTL = canGetMCTL(canREG1,canMESSAGE_BOX1);
    	msgBoxArbitVal = canGetID(canREG1,canMESSAGE_BOX1);
    	canGetData(canREG1,canMESSAGE_BOX1,m->data);
    	m->cob_id = (uint16)(msgBoxArbitVal>>18) & 0x7FF;
    	m->len =  (uint8)(msgCTL & 0xFU);
    	m->rtr = (uint8)((msgCTL>>9)&0x01);
    	
    	return 1;
    }
    
  • 你好。

    你是否把接收远程帧的邮箱设置了自动答复?

    如果没有设置自动答复的话,那么收到的远程帧会被当作没有数据场的数据帧来处理。

  • A message object with Dir = ‘0’ is configured for the reception of data frames, with Dir = ‘1’ AND Umask =
    ‘1’ AND RmtEn = ‘0’ it is configured for the reception of remote frames.

    我按照以上描述进行配置,可以接收远程帧了,但是数据帧就收不到了。

    是不是数据帧和远程帧必须要分开使用两个message box呢?

    我想既收到数据帧也收到远程帧。

  • 按照你所说,自动答复是不是Enable RTR?HCG配置的

  • 你好。

    如果 你要用同一个邮箱来收数据帧和远程帧的话,建议把邮箱配置成接收Dir=1,这样远程帧会被当作数据帧接收。

    接收到后,你可以用软件来判断是远程帧还是数据帧。

  • 你好 我也正在移植CANOPEN,我想请教下远程帧应该怎么发?

    我试了很多方法,手册上说的是把接收对象的TxRqst置高就会引起远程帧的发送。但实际上这么做以后发出的数据还是“数据帧”,而不是远程帧。

     Setting TxRqst for
    a receive object causes the transmission of a remote frame with the same identifier as the data frame for
    which this receive object is configured.

    谢谢!