Closed larsgk closed 10 years ago
Quoting from mbed.org for the lazy ;) ->
"I have been using USBSerial for 1/2 year now on FRDM-KL25Z with no problems at all. All of a sudden (when testing on a new MacBook Air 2013) - I see that when connected to either USB port, the device no longer pops up in the /dev/tty.xxx list.
The error that dmesg displays is:
1 2 USBF: 110.115 The IOUSBFamily gave up enumerating a USB device after 10 retries. (Port 1 of Hub at 0x14000000) USBF: 110.115 The IOUSBFamily was not able to enumerate the device (Port 1 of Hub at 0x14000000). I seem to have narrowed it down to be a problem on the new Haswell Mac laptops (tried it on a new Pro 2013 and Air 2013 that shows the problem - and an old Pro and Air (pre-2013) that works just fine.
At the moment, I am trying to modify the kext "driver" files in /System/Library/Extensions to grab my particular VID/PID and force some USB serial driver/module.
My guess:
I have also tried to build with the latest mbed code from github (same result).
.. these are just guesses... digging further.
UPDATE:
I tried to make the VID/PID the same as for the main flashing port that seems to mount fine as a USB serial device on the mac... the problem then might be in the details of the CDC setup. I am attaching the two printouts of lsusb from linux with the details."
I can't include the txt printouts as attachments - so pasting in here:
KL25Z normal flashing port (CDC profile works on the new mac):
Bus 002 Device 012: ID 1357:0707 P&E Microcomputer Systems
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2 ?
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 16
idVendor 0x1357 P&E Microcomputer Systems
idProduct 0x0707
bcdDevice 8.00
iManufacturer 1
iProduct 2
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 98
bNumInterfaces 3
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xc0
Self Powered
MaxPower 464mA
Interface Association:
bLength 8
bDescriptorType 11
bFirstInterface 0
bInterfaceCount 2
bFunctionClass 2 Communications
bFunctionSubClass 3 Telephone
bFunctionProtocol 0
iFunction 2
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 2 Communications
bInterfaceSubClass 2 Abstract (modem)
bInterfaceProtocol 0 None
iInterface 0
CDC Header:
bcdCDC 1.10
CDC Call Management:
bmCapabilities 0x01
call management
bDataInterface 1
CDC ACM:
bmCapabilities 0x06
sends break
line coding and serial state
CDC Union:
bMasterInterface 0
bSlaveInterface 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x85 EP 5 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0010 1x 16 bytes
bInterval 10
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 10 CDC Data
bInterfaceSubClass 0 Unused
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0010 1x 16 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x04 EP 4 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0010 1x 16 bytes
bInterval 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 2
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 8 Mass Storage
bInterfaceSubClass 6 SCSI
bInterfaceProtocol 80 Bulk-Only
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Same output - but from the USB Serial (=> USB CDC) generated profile from the "user port" of the KL25Z board:
Bus 002 Device 011: ID 1357:0707 P&E Microcomputer Systems
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 2 Communications
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x1357 P&E Microcomputer Systems
idProduct 0x0707
bcdDevice 1.00
iManufacturer 1
iProduct 2
iSerial 3
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 75
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 100mA
Interface Association:
bLength 8
bDescriptorType 11
bFirstInterface 0
bInterfaceCount 2
bFunctionClass 2 Communications
bFunctionSubClass 2 Abstract (modem)
bFunctionProtocol 0 None
iFunction 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 2 Communications
bInterfaceSubClass 2 Abstract (modem)
bInterfaceProtocol 1 AT-commands (v.25ter)
iInterface 0
CDC Header:
bcdCDC 1.10
CDC Call Management:
bmCapabilities 0x03
call management
use DataInterface
bDataInterface 1
CDC ACM:
bmCapabilities 0x06
sends break
line coding and serial state
CDC Union:
bMasterInterface 0
bSlaveInterface 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 16
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 10 CDC Data
bInterfaceSubClass 0 Unused
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
OK - I have investigated this a bit further:
The FRDM-KL25Z fresh from factory has firmware on it from Freescale that WORKS ON THE NEW MACS while the mbed USB CDC/Serial doesn't.
I have tried to hack the CDC USB descriptors in USBCDC.cpp to match as good as possible but it seems to be some handshake after the initial init that goes wrong. I see a difference in endpoint values in the descriptor but have no idea where to change in the underlying USB code - please help me out there ;)
I am including a dump of the working Freescale (factory) firmware descriptor (when attached to the user USB port -> new haswell macbook air):
Bus 001 Device 008: ID 15a2:a50f Freescale Semiconductor, Inc.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 2 Communications
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 32
idVendor 0x15a2 Freescale Semiconductor, Inc.
idProduct 0xa50f
bcdDevice 0.00
iManufacturer 1
iProduct 2
iSerial 3
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 67
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xc0
Self Powered
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 2 Communications
bInterfaceSubClass 2 Abstract (modem)
bInterfaceProtocol 1 AT-commands (v.25ter)
iInterface 1
CDC Header:
bcdCDC 1.10
CDC Call Management:
bmCapabilities 0x00
bDataInterface 1
CDC ACM:
bmCapabilities 0x00
CDC Union:
bMasterInterface 0
bSlaveInterface 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0020 1x 32 bytes
bInterval 2
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 10 CDC Data
bInterfaceSubClass 0 Unused
bInterfaceProtocol 0
iInterface 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0020 1x 32 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0020 1x 32 bytes
bInterval 0
There is an update from Apple who were so kind to take a look at the issue (bought a board, installed the firmware and did tests..) - they found the following:
"This is not an OS X problem. It is a low level problem with the board when communicating with a USB 3.0 controller. The device is not responding to a SET_ADDRESS command. In other cases, it does not respond to the GET_DESCRIPTOR(CONFIGURATION). It has nothing to do with the descriptors programmed."
I am not a USB low level expert - so I hope that there are someone here who can help me out with what this means.
br Lars
Seems to have been fixed with 43113cf13ab02e1781755dd29140f93773dc6147
great work (and I hope it is stable :+1: )
See: https://mbed.org/questions/2599/Is-USBSerial-giving-problems-on-new-Hasw/
To save people some time: The main flashing port on an untouched KL25Z (from factory) works fine on these macs (comes up with the additional tty USB port in /dev/tty.usbmodem....).
In the issue mentioned on mbed.org, I've included the CDC (and rest of USB) profiles as shown in linux for the two ports. As you can see there seem to be some things missing from what the mbed CDC should have been reporting (e.g. power consumption defaults to 100mA and some other params are not the same). It could be that the new apple devices are more strict in SW or HW and that we need to get the parameters fixed on the mbed side to match.