linklayer / cantact-fw Goto Github PK
View Code? Open in Web Editor NEWFirmware source files for the CANtact tool
Home Page: http://cantact.io
License: Other
Firmware source files for the CANtact tool
Home Page: http://cantact.io
License: Other
I am using SocketCAN and CANtact toolkit to send and receive CAN message. I am using two CANtact toolkits one to send CAN message and other to receive the CAN message both the CANtact toolkits are connected by DB9 female to DB9 female and the other ends are connected to the USB port of the laptop.
I used the following SocketCAN commands to first configure them
sudo modprobe can
sudo modprobe can_raw
sudo modprobe slcan
sudo slcand -o -s6 -t hw -S 3000000 /dev/ttyACM0 slcan0
sudo ip link set slcan0 up
The above commands are for the first CANtact toolkit then I connected the second CANtact toolkit and configured it with the following commands
sudo modprobe can
sudo modprobe can_raw
sudo modprobe slcan
sudo slcand -o -s6 -t hw -S 3000000 /dev/ttyACM1 slcan1
sudo ip link set slcan1 up
And then I types the following Python code which uses CANard libraries.I have attached a detailed screenshot of it
How can I resolve this problem?
FYI: There is a signed versions of the driver available in my fork at https://github.com/colinoflynn/cantact-fw/tree/master/windows-driver .
They are signed by my cert, so on install it says provided by "NewAE Technology Inc.", but afterwards they look as now (i.e., same name as you are used to in device manager etc). I find it easier to install on many systems having a signed driver (and no big red warning).
Haven't tested them on Win 10 yet either, but the signature should be good I think there too.
Feel free to copy them to your repo - I didn't open a pull request as I wasn't sure if you'd want them back in the main repo, since the signature isn't actually by you.
What is the most alive fork of this repo?
uint8_t CDC_Transmit_FS(uint8_t* Buf, uint16_t Len)
{
uint8_t result = USBD_OK;
/* USER CODE BEGIN 8 */
uint16_t i;
for (i=0; i < sizeof(UserTxBufferFS); i++) {
UserTxBufferFS[i] = 0;
}
for (i=0; i < Len; i++) {
UserTxBufferFS[i] = Buf[i];
}
Hey there,
I am working on Kali GNU/Linux 2.0 (sana) 64-bit where I made some changes to the fw, compiled it with make, and then wanted to download it to CANtact using the instructions for Windows here and here (discuss.cantact.io).
After installing the driver I get the error "Device cannot start - code 10", therefore DfuSe tool fails with upgrading. I tried to fix this by executing all of the mentioned fixes here, but nothing worked. Can anyone help me?
[Tried it on WIN7 64bit, WIN8 including driver signature disabling)]
Also I updated the fw on Linux with make flash, but different versions of the fw all have the same md5 checksum, telling me the fw remained unchanged. Am I right?
$ uname -a
Darwin Brandons-MacBook-Pro-2.local 19.0.0 Darwin Kernel Version 19.0.0: Thu Oct 17 16:17:15 PDT 2019; root:xnu-6153.41.3~29/RELEASE_X86_64 x86_64
For whatever reason, the device does not come up on the latest version of Mac OS.
For Mac OS users looking to interact with gs_usb/CandleLight/CANtact devices, please see: https://github.com/brandonros/node-gs_usb
Hi, linklayer:
I like this project very much and I have some questions.
What Is the highest baud rates for this hardware?
And how many frames can CANtact send or receive in the most rate?
I'm having some issues with cantact (minipci variation):
Seldomly i'm having this error message bringing up the interface
cdc_acm 2-1.4:1.0: failed to set dtr/rts
Also when the interface starts if i have no frames on bus the cantact sends it's message correctly, if start loading the bus cantact after a while stops sending frames (but still keep receiving, led blinks and candump shows incoming frames).
To fix i need a power cycle, soft reboot of the host machine is not enough
I'm sure is not an issue of the linux side becouse if i replace cantact with cantin i have no more issues, therfore i guess the slcan linux side is ok.
here are is my starting script:
`#!/bin/sh
slcan_attach -f -s8 -o /dev/ttyACM0
sleep 1
slcand ttyACM0 slcan0
sleep 5
ifconfig slcan0 up
sleep 2
/root/JSON.sh/send-3ginfo.sh &
`
send-3ginfo.sh just sends the LTE line informations to the can using CANSEND, it's a simple bash script.
Tested also something different
slcand -o -c -f -s8 -S921600 /dev/ttyACM0 slcan1 sleep 2 ifconfig slcan0 up sleep 2 /root/JSON.sh/send-3ginfo.sh &
Changes a bit the behaviour, i keep receving the frames from the OpenWRT box but by the time passes i start having dropped frames and takes longer time to stop sending.
Haven't tested yet higher speeds but will do for sure.
What is weird is that i can see locally the fames (with candump) but not remotely.
That means to me that the frames are sent to the socket interface but not to the bus by the canable.
My setup is:
cantact side:
APU3 with last OpenWRT
With an ME909s LTE modem (using interfaces ttyUSB2 and usb0)
Bus Side
Windows with PCAN interface and PCAN-View to load the bus, the bus is set at 1Mbit, terminated both sides.
I tried CANtact on WinXP and RHEL OS.
Both system recognize device but dont communicate by serial.
In WinXP I used CANHacker SW, in RHEL I used GTKterm (run as root).
CANHacker reported: CAN interface not responding.
In GTKterm I didnt receive response for any command ( V for example).
Is it depends on the COM-port speed? I tried 38400, 57600, 115200 - unsuccessful.
RHEL diagnostic:
$ tail /var/log/messages
Nov 23 00:02:36 localhost kernel: usb 3-4.4: new full-speed USB device number 38 using xhci_hcd
Nov 23 00:02:36 localhost kernel: usb 3-4.4: New USB device found, idVendor=ad50, idProduct=60c4
Nov 23 00:02:36 localhost kernel: usb 3-4.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Nov 23 00:02:36 localhost kernel: usb 3-4.4: Product: CANtact dev
Nov 23 00:02:36 localhost kernel: usb 3-4.4: Manufacturer: CANtact
Nov 23 00:02:36 localhost kernel: usb 3-4.4: SerialNumber: 00000000001A
Nov 23 00:02:36 localhost kernel: cdc_acm 3-4.4:1.0: ttyACM0: USB ACM device
PS: one thing different: I used STM32F072RBT6 chip instead F042C6T6 (also change LD-script and assembler startup file from latest CMSIS).
What approach I should use for my issue diagnostic?
I believe, incorrect command-selecting bytes are being used in the SLCAN message parser in slcan.c:
} else if (buf[0] == 'm' || buf[0] == 'M') {
// set mode command
if (buf[1] == 1) {
// mode 1: silent
can_set_silent(1);
} else {
// default to normal mode
can_set_silent(0);
}
return 0;
} else if (buf[0] == 'F') {
// set filter command
uint32_t id = 0;
for (i = 1; i < len; i++) {
id *= 16;
id += buf[i];
}
current_filter_id = id;
can_set_filter(current_filter_id, current_filter_mask);
} else if (buf[0] == 'K') {
// set mask command
uint32_t mask = 0;
for (i = 1; i < len; i++) {
mask *= 16;
mask += buf[i];
}
current_filter_mask = mask;
can_set_filter(current_filter_id, current_filter_mask);
}
'm' and 'M' are used to set the "mode" of the adapter, while 'F' and 'K' are used to set filter ID and mask. Instead, according to the LAWICEL CAN232 protocol, 'm' and 'M' should be used to set filter mask and ID.
See also: https://github.com/linux-can/can-utils/blob/master/slcanpty.c#L130
I build this project and burn into chip.
When I plug the device into USB the device is recognised and ttyACM0 is bring up, but text description not available (although I found it in sources: Src/usbd_desc.c )
$ dmesg | tail
[1837394.042353] usb 1-3.1: new full-speed USB device number 63 using xhci_hcd
[1837394.127740] usb 1-3.1: New USB device found, idVendor=ad50, idProduct=60c4
[1837394.127742] usb 1-3.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[1837394.127743] usb 1-3.1: Product: CANtact dev
[1837394.127744] usb 1-3.1: Manufacturer: CANtact
[1837394.127745] usb 1-3.1: SerialNumber: 00000000001A
[1837394.128520] cdc_acm 1-3.1:1.0: ttyACM0: USB ACM device
$ lsusb
Bus 001 Device 063: ID ad50:60c4
Bus 001 Device 064: ID 0483:3748 STMicroelectronics ST-LINK/V2
I mean this string device don't have text description:
Bus 001 Device 063: ID ad50:60c4
In other word: which descriptor I should add to Src/usbd_desc.c for lsusb and other tool correct works with this device?
Hello,
I tried the steps in my OBD-II connector and here is what I got:
root@ubuntu:~# ifconfig
can0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP RUNNING NOARP MTU:16 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:10
RX bytes:0 (0.0 B) TX bytes:16 (16.0 B)
ens33 Link encap:Ethernet HWaddr 00:0c:29:80:d7:24
inet addr:192.168.96.151 Bcast:192.168.96.255 Mask:255.255.255.0
inet6 addr: fe80::bb80:92f2:64ef:dc3f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4954 errors:0 dropped:0 overruns:0 frame:0
TX packets:3391 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4238809 (4.2 MB) TX bytes:286960 (286.9 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:1160 errors:0 dropped:0 overruns:0 frame:0
TX packets:1160 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:170211 (170.2 KB) TX bytes:170211 (170.2 KB)
root@ubuntu:~# cansend can0 123#1122334455667788
write: No buffer space available
root@ubuntu:~# cansniffer can0
46 delta ID data ... < cansniffer can0 # l=20 h=100 t=500 >
I can't seem to sniff the data on it. I'm using vmware fusion for my Ubuntu btw.
I got following error when trying to write PID request message on can socket:
errno 105 " No Buffer Space Available"
This error appear randomly when trying to send high rate of request (64 request per second).
I tried to close socket and create new one, however, this didn't fix the issue.
Note that i'm using linux and code is written using SocketCAN.
Please check it and inform me in case there is any thing that can fix this issue.
According to the data sheet, the STM32F042x includes a 96-bit unique identifier. It would be great if the firmware exposed this unique identifier to the operating system when connected as a serial port, instead of relying on the OS assigning it an ID based on the port and order in which it is connected.
For example, on macOS, when I plug in a serialized FTDI USB to serial adapter, it shows up as /dev/tty.usbserial-########
, where the ########
is unique for each physical adapter. I would love for each physical CANtact device to show up in a similar way with a consistent identifier.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.