Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use RTR with due_can library ? #28

Open
mattiabalutto opened this issue Sep 14, 2017 · 3 comments
Open

How to use RTR with due_can library ? #28

mattiabalutto opened this issue Sep 14, 2017 · 3 comments

Comments

@mattiabalutto
Copy link

Hi,

I'm working with your library and I will to send a RTR frame. In your library I found the CAN_FRAME struct definition, where I have found the rtr variable:

typedef struct {
uint32_t id;      // EID if ide set, SID otherwise
   uint32_t fid;     // family ID
   uint8_t rtr;      // Remote Transmission Request <-- THIS
   uint8_t priority; // Priority but only important for TX frames and then only for special uses.
   uint8_t extended; // Extended ID flag
   uint8_t length;      // Number of data bytes
   BytesUnion data;  // 64 bits - lots of ways to access it.
} CAN_FRAME;

I have tried to send a frame with this variable but nothing change. What's wrong ?

Sketch Code:

#include "variant.h"
#include <due_can.h>

bool initDevices = false;

void setup() {
  Can0.begin(CAN_BPS_500K);
}

void loop() {
  CAN_FRAME output;

  if(!initDevices) { 
    output.id = 0x21;
    output.extended = false;
    output.length = 1;
    output.data.byte[0] = 0x05;
    CAN.sendFrame(output);
    
    initDevices = true;
  }

  output.id = 0x321;
  output.extended = false;
  output.rtr = 0x01;
  output.length = 0;
  CAN.sendFrame(output);

  delay(50);
}

Thank You in advance
Bye

P.S. Sorry for my English

@csBlueChip
Copy link
Contributor

This library does NOT support RTR
The RTR variable is declared, but it is NEVER used.

I have patched the library to READ the RTR flag, #33
...but I have NOT (yet) patched it to WRITE the RTR flag

@collin80
Copy link
Owner

collin80 commented Mar 6, 2018

Yeah, I really don't like the concept of RTR frames and I never did anything to support them. Maybe I kind of passively neglected to even implement RTR because I find it to be pointless. It has been deprecated for quite some time and isn't part of the CAN-FD standard at all. But, I suppose my dislike of RTR shouldn't mean that nobody else can use it if they wanted to. So, I really should merge your changes in. I'll try to get that done in the near future.

@BJoubert89
Copy link

I am using the due_can library and also noticed that setting the RTR flag does nothing. RTR support would be great as it is part of the CAN standard and is supported by the Due. I don't find it useless at all. Anyway, thanks for the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants