Community
cancel
Showing results for 
Search instead for 
Did you mean: 
TTimV
Beginner
1,656 Views

serial USB wrongly recognised as ACM device

Hi,

I'm using:

3.10.98-poky-edison+

host mode enabled

A serial device connected trough an USB cable containing FDTI chip from ST Microelectronics

The device is recognised as a USB ACM device:

[ 4570.341510] usb 1-1: USB disconnect, device number 2

[ 4593.483190] usb 1-1: new full-speed USB device number 3 using dwc3-host

[ 4593.506787] usb 1-1: New USB device found, idVendor=0483, idProduct=7270

[ 4593.506818] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0

[ 4593.506840] usb 1-1: Product: USB to Serial bridge

[ 4593.506859] usb 1-1: Manufacturer: STMicroelectronics

[ 4593.507759] usb 1-1: ep 0x81 - rounding interval to 1024 microframes, ep desc says 2040 microframes

[ 4593.516172] cdc_acm 1-1:1.0: This device cannot do calls on its own. It is not a modem.

[ 4593.520307] cdc_acm 1-1:1.0: ttyACM0: USB ACM device

but /dev/ttyACM0 is not useable

I had the same issue on my RaspberryPI and this forced it to use the usbserial_generic driver:

sudo modprobe -r cdc_acm

sudo modprobe -r usbserial

sudo modprobe usbserial vendor=0x0483 product=0x7270

The "usbserial_generic" driver is then used and the device is useable as /dev/ttyUSB0

Doesn't work on edison as "sudo modprobe -r cdc_acm" returns:

modprobe: FATAL: Module cdc_acm is builtin.

thanks,

Tim

0 Kudos
5 Replies
idata
Community Manager
43 Views

Hi Tim,

 

 

I would like to let you know that I've been looking for an alternative way to change the ttyAMC to ttyUSB as you're doing it in your Raspberry Pi, I would also like to know what kind of USB device you're connecting to your Edison, also if you've tried to use the device without changing the port. What behavior do you get?

 

I would like to let you know that given the kernel module cdc_acm is built in in the Edison (and by consequence not removable with modprobe), it may not be possible to change the way the device is recognized, however, we will definitely try to find a workaround for this.

 

 

Regards,

 

-Pablo
TTimV
Beginner
43 Views

Hi Pablo,

Tnx for looking into a workaround.

The device is a schneider electric zelio smart relay connected over a serial to usb cable.(SR2USB01)

I pasted below the protocol that's implemented (in cpp) and running fine on PI raspbian using the ttyUSBx device supported by the generic usbserial driver

Can udev rules be of any help specifying which driver is used?

Tnx,

Tim

From the docs, this is the protocol:

The serial link is configured as follows:

dialog speed: 115 kilobauds,

format: 7 bits, even parity, 1 stop bit,

The Write Frame and the Response

Below is the write frame which should be sent to the smart relay:

Beginning delimiter: " : "

Slave address: 0x01

Write command: 0x10

Data address: 0x00 00 FF xx

xx is a number between 0x00 and 0x17 inclusively, corresponding to the address of the data to write less 1.

Number of bytes: 0xnn

This is the number of data to write. Each value is made up of two bytes.

Data to write: 0xd1H d1L d2H ... dnnL

There are the 0xnn bytes to write.

Checksum: 0xcc

This is the completed sum increased by 2, of the bytes between the slave address and the last of the date to write.

End delimiter: " CR " " LF "

The smart relay response is structured as follows:

Beginning delimiter: " : "

Slave address: 0x01

Write command: 0x10

Data address: 0x00 00 FF xx

Number of bytes: 0xnn

Checksum: 0xcc

This is the completed sum increased by 2, of the bytes between the slave address and the byte number.

End delimiter: " CR " " LF "

For example

Write to the 3 address the 16-bit value 8569:

8569 corresponds to 0x2179 in hexadecimal format.

Checksum: 0x01+0x10 + 0x00 + 0x00+ 0xFF + 0x02 + 0x02 + 0x21 + 0x79 = 0x1AE of which complement increased by 2 gives for a 0x53 byte

" : " 0x01 0x10 0x00 0x00 0xFF 0x02 0x02 0x21 0x79 0x53 " CR " " LF "

The frame in the format above is used to calculate the checksum. Except for the delimiters, each byte is sent as two ASCII characters. Which gives:

0x3A 0x30 0x31 0x31 0x30 0x30 0x30 0x30 0x30 0x46 0x46 0x30 0x32 0x30 0x32 0x32 0x31 0x37 0x39 0x35 0x33 0x0D 0x0A

Smart relay response: 0x3A 0x30 0x31 0x31 0x30 0x30 0x30 0x30 0x30 0x46 0x46 0x30 0x32 0x30 0x32 0x45 0x44 0x0D 0x0A

idata
Community Manager
43 Views

Hi Tim,

 

 

Thank you very much for the information you provided. We are still investigating this case and we'll get back to you once we have some updates.

 

 

Regards,

 

-Pablo
idata
Community Manager
43 Views

Hi Tim,

 

 

We've doing some more research, and according to this information http://unix.stackexchange.com/questions/61917/removing-builtin-modules-in-linux http://unix.stackexchange.com/questions/61917/removing-builtin-modules-in-linux, the error message you're getting is because the module was compiled into the kernel, and the only way to unload it is by compiling a new kernel and have it built as a dynamically module instead. This might be the reason it worked on Raspberry but not on Edison.

 

You might want to give it a try with the instructions from the Edison BSP, which you check here http://www.intel.com/content/dam/support/us/en/documents/edison/sb/edisonbsp_ug_331188007.pdf http://www.intel.com/content/dam/support/us/en/documents/edison/sb/edisonbsp_ug_331188007.pdf.

 

Hope this information helps you, hopefully you'll be able to use your USB device with the Edison.

 

 

Regards,

 

-Pablo
idata
Community Manager
43 Views

Hi Tim,

 

 

Do you have updates on this case? Do you still have questions on this?

 

 

Regards,

 

-Pablo