Hi,
How can i send serial coomands to this device using python
Bus 001 Device 004: ID 04d8:000a Microchip Technology , Inc. CDC RD-232 Emulation Demo
Hi,
How can i send serial coomands to this device using python
Bus 001 Device 004: ID 04d8:000a Microchip Technology , Inc. CDC RD-232 Emulation Demo
Iâm not a Python guy, but this is fairly standard and Python should not change how this works. Here is some background which might helpâŠ
The device is a serial UART, and each side of the cable has another serial UART. Both UARTs must run at the same settings, e.g., both are probably set by default as speed 115200, 8-bits, no parity, and one stop bit. The result of having the driver run for a UART is the existence of the device special file. Examples: â/dev/ttyUSB0
â for the first FTDI brand chipset (numbers increment if there is more than one), â/dev/ttyS0
â if using an older 16550A compatible chip (which is what serial console normally does when exposed to individual header pins, but this differs when exposed via USB), or some other name scheme. The name is irrelevant other than giving clues as to which driver and chipset are used. The CDC name makes me believe the device special file would be something like â/dev/ttyACM0
â (because this is a manufacturer of serial UARTs).
Once these devices are paired you simply treat the device special file as an ordinary file to read or write to. You would simply use something like an âopen('/dev/ttyACM0', 'r')
â for reading, or with a â'w'
â for writing, or you could open read-write. Then print to that file, or read from that file.
Note that if you monitor âdmesg --follow
â, and then plug in the USB side of that device, the logs should tell you about what device special file name is used, or if it is missing a driver itâll just note plug-in but not provide more details. It is highly likely it would âjust workâ, but you can always ask more questions if not.
There is no dev file name, how can get the drivers.
or
where can i find cdc-acm my kernal version is 4.9.201-tegra.
If you run the command âdmesg --follow
â, and then plug in the device, what log lines show up from the plug-in? Normally the cdc-acm is is already present. To verify, what do you see from:
zcat /proc/config.gz | grep '_ACM'
I would expect the above to result in something like this:
# zcat /proc/config.gz | grep '_ACM'
CONFIG_USB_ACM=m
CONFIG_USB_F_ACM=y
CONFIG_USB_CONFIGFS_ACM=y
dmesg --follow shows the device
[ 112.678429] usb 1-4: USB disconnect, device number 3
[ 114.803847] usb 1-4: new full-speed USB device number 4 using tegra-xusb
[ 114.827269] usb 1-4: New USB device found, idVendor=04d8, idProduct=000a
[ 114.827279] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 114.827284] usb 1-4: Product: Qioptiq Imaging Controller
[ 114.827287] usb 1-4: Manufacturer: Qioptiq, Inc.
and this is as expected
$ zcat /proc/config.gz | grep â_ACMâ
CONFIG_USB_ACM=m
CONFIG_USB_F_ACM=y
CONFIG_USB_CONFIGFS_ACM=y
but i have installed an cdc-acm driver of kernal version 4.4.38-tegra, this shows as âExec format errorâ when i use modprobe.
You already have ACM supported. Installing a driver from an outdated and incorrect release will cause an error. Also note that âExec format errorâ means the driver you added is also for the wrong architecture. Where did you get the module for the 4.4.38-tegra release? I suspect this is so old it might be from a 32-bit ARM system, which is armhf
, but you need 64-bit aarch64
/arm64
(but that is only if the feature did not already existâŠadding this in addition to already having this would have unpredictable consequences).
Looking at the actual logs I can identify idVendor 04d8
as âMicrochip Technology, Inc.â (which is a common supplier of UARTs), and the specific idProduct 000a
as âCDC RS-232 Emulation Demo
â. I donât know if this is enough to identify the device for the driver or not, but I donât see a log saying the device tried to load a driver.
The first step though is to determine if your driver you added has overwritten the âCONFIG_USB_ACM
â module which was previously present. If so, then you will probably have to repair the module content. The driver which you added would have to be removed since you already had the driver and the ânewâ driver (the old and incorrect architecture driver) would have to be removed.
If it turns out that the only issue is the driver not identifying itself as using the ACM driver, then the typical way of handling this is with a udev
rule. udev
is typically used to perform tasks like renaming a device special file, or adding a symbolic link in â/dev
â which points at a default name. A typical example of when this is done is if a manufacturer uses a âstandardâ device, but has the USB identify the device with the actual vendorâs name for marketing purposes. Then udev
could be used to trigger upon insert of the âcustomâ name via USB, and create an association with the âstandardâ driver to the âcustomâ name.
Do you have a URL for this emulation demo hardware? I am curious if they show a udev
file in their âdriverâ. You could not use the actual incorrect armhf
driver, but you could still use the udev
file for association.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.