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

proper way to use echo_id #50

Open
brandonros opened this issue May 22, 2020 · 4 comments
Open

proper way to use echo_id #50

brandonros opened this issue May 22, 2020 · 4 comments

Comments

@brandonros
Copy link
Contributor

async sendCanFrame(arbitrationId, data) {
    const frame = Buffer.alloc(0x14)
    frame.writeUInt32LE(0xFFFFFFFF, 0x00) // echo_id
    frame.writeUInt32LE(arbitrationId, 0x04) // can_id
    frame.writeUInt8(0x08, 0x08) // can_dlc
    frame.writeUInt8(0x00, 0x09) // channel
    frame.writeUInt8(0x00, 0x0A) // flags
    frame.writeUInt8(0x00, 0x0B) // reserved
    frame.writeUInt8(data[0], 0x0C)
    frame.writeUInt8(data[1], 0x0D)
    frame.writeUInt8(data[2], 0x0E)
    frame.writeUInt8(data[3], 0x0F)
    frame.writeUInt8(data[4], 0x10)
    frame.writeUInt8(data[5], 0x11)
    frame.writeUInt8(data[6], 0x12)
    frame.writeUInt8(data[7], 0x13)
    return this.device.transferOut(this.outEndpoint.endpointNumber, frame)
  }

When I write a CAN frame over USB, it gets echoed back to me. Is there a way to not do this?

@fritz-net
Copy link

as i remember it is not echoed, it gives the frame on the bus with proper time (which is a very helpful feature - I think youre writting a driver impl for js as i remember, i would keep this feature). The easiest solution would be handling this in your wrapper.

@brandonros
Copy link
Contributor Author

brandonros commented May 23, 2020 via email

@fritz-net
Copy link

fritz-net commented May 23, 2020

as i know there is no possibility in the gs_usb driver to disable this. Are you sure the bottleneck is USB? If your dive does not replay with the exact same frame you could filter your tx in your wrapper/driver (save last TX -> compare (with timeout) -> ignore)

Someone is writing on a new version of this Firmware, he wants to adopt the driver as well to support CAN fd, maybe talk to him (don't know who atm)

@brandonros
Copy link
Contributor Author

Am I supposed to reset and start 2 channels? 1 for read, 1 for write?

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

2 participants