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

Extended Frames not working #11

Open
Duality4Y opened this issue Nov 15, 2023 · 4 comments
Open

Extended Frames not working #11

Duality4Y opened this issue Nov 15, 2023 · 4 comments

Comments

@Duality4Y
Copy link

Hello,
Thank you very much for this useful utility!!

I am using the usb-can dongle to debug connections with an STM32F103 using Standard frames and that works,
However I Want to use Extended frames, so I changed the source in such a way hoping to enable Extended frames:

diff --git a/canusb.c b/canusb.c
index d1aaba2..464b2cf 100644
--- a/canusb.c
+++ b/canusb.c
@@ -407,7 +407,7 @@ static int inject_data_frame(int tty_fd, const char *hex_id, const char *hex_dat
         binary_data[i]++;
     }
 
-    error = send_data_frame(tty_fd, CANUSB_FRAME_STANDARD, binary_id_lsb, binary_id_msb, binary_data, data_len);
+    error = send_data_frame(tty_fd, CANUSB_FRAME_EXTENDED, binary_id_lsb, binary_id_msb, binary_data, data_len);
   }
 
   return error;
@@ -606,7 +606,8 @@ int main(int argc, char *argv[])
     return EXIT_FAILURE;
   }
 
-  command_settings(tty_fd, speed, CANUSB_MODE_NORMAL, CANUSB_FRAME_STANDARD);
+  // command_settings(tty_fd, speed, CANUSB_MODE_NORMAL, CANUSB_FRAME_STANDARD);
+  command_settings(tty_fd, speed, CANUSB_MODE_NORMAL, CANUSB_FRAME_EXTENDED);
 
   if (inject_data == NULL) {
     /* Dumping mode (default). */

but it does not work and only produces standard frames

@Duality4Y
Copy link
Author

The first ~16 frames my dongle sends out are malformed the End of Frame is wrong
here is a capture with my logic analyzer:
image
As you can see the End of Frame contains zeros where there should have been ones.
I am not sure if this is an issue with my dongle or with your code.

@Duality4Y
Copy link
Author

I think send_data_frame needs to be edited to send correct ID information in-case of a Extended Frame
Because the usb-can analyzer protocol defines for Standard frame that 2 bytes are used for ID
Where as with Extended ID it is 4 bytes.

@kobolt
Copy link
Owner

kobolt commented Nov 15, 2023

The problem is probably in the code, if you can get it working then I will gladly accept a pull request!

@Duality4Y
Copy link
Author

Duality4Y commented Nov 16, 2023

The first ~16 frames my dongle sends out are malformed the End of Frame is wrong here is a capture with my logic analyzer: image As you can see the End of Frame contains zeros where there should have been ones. I am not sure if this is an issue with my dongle or with your code.

I already solved this issue, it happens when there is no node connected to the network to ACK the frame.
I'll see If I can do something with the code to add extended frames as I currently have access to a setup to full test that out :)

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