USB function driver on WinCE60

This forum is for users of Atmel's SAM Series and who are interested in using WinCE OS.

Moderator: nferre

talabzs
Posts: 9
Joined: Tue Jun 19, 2007 5:14 pm

USB function driver on WinCE60

Wed Feb 03, 2010 3:27 pm

Hey,
i try to build a virtual COM port on WinCE 6.9 with AT91SAM9263. The same as i would connect in SAM-BA mode (with host Windows CDC driver) but my device would run a Windows CE. I dont knwo wehter this is same as active sync serial connection, but i would prefer this CDC conection...
The serial usb host driver (usbser) under WinCE does very well, but i would need a function client driver for serial and/or mass storage.
It seems to me, that the USB function driver does not work properly under Windows CE. I see a cable attach event, but thats all. I have built of course an image with the usb function client drivers(mass storage and serial) and activesync, too. In the registry all the defaults. My host PC detects a connection but does not recognise my WinCE device, PID, VID read as 0.
Can somebody help me?

Thanks in advance,
Zsolt
guangyu.ren
Posts: 23
Joined: Tue Mar 31, 2009 7:22 am

Re: USB function driver on WinCE60

Thu Feb 04, 2010 11:00 am

Please check the values under [HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers\] in reginit.ini under your release folder.

Make sure idProduct and idVendor are set properly, especially the ones under [HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers\Serial_Class].

Also the main algorithm of USB function driver is at PLATFORM\COMMON\SRC\SOC\atmel\COMMON\DRIVERS\USBHSFN
talabzs
Posts: 9
Joined: Tue Jun 19, 2007 5:14 pm

Re: USB function driver on WinCE60

Thu Feb 04, 2010 11:28 am

Thanks for reply.
This is my reg:
[HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers\Serial_Class]
; "Dll"="serialusbfn.dll"
"Dll"="usbser_fn.dll"
"Index"=dword:3
; As per the Spec, InterfaceSubClass and
; Interfaceprotocol is set to default value of FF
"InterfaceSubClass"=dword:ff
"InterfaceProtocol"=dword:ff

"FriendlyName"="USB Cable:"

; Name of the Ras connection used
"DeviceName"="USBFNS1:"
; "DeviceName"="UFN1:"

; Dll for the Transport Service provider. We will
; use the unimodem.dll for our modem related commands.
"Tsp"="Unimodem.dll"

; Device Prefix for the USB Serial profile
"Prefix"="COM"

; Friendly Name for the USB Serial connection
"FriendlyName"="USB Cable:"

; Device Index for the Device to be created.
; Note that on DVEVM the initial Device Indices such as
; COM0, COM1 are reserved for the UART Serial Ports.
"DeviceArrayIndex"=dword:0

"DeviceType"=dword:0
"IClass"="{CC5195AC-BA49-48a0-BE17-DF6D1B0173DD}"

; Vendor ID for the USB Serial profile.
; Set to Texas Instruments USB Vendor ID
"idVendor"=dword:03EB

; String Description of the Vendor
"Manufacturer"="Anedo"

; Product ID for the USB Serial Profile
"idProduct"=dword:6124

; String description for the Product
"Product"="VTxxx Generic Serial"
"bcdDevice"=dword:0

[HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers\Serial_Class\Unimodem]
"Tsp"="Unimodem.dll"
"FriendlyName"="USB Cable:"
"DeviceType"=dword:0
"DevConfig"=hex: 10,00, 00,00, 05,00,00,00, 10,01,00,00, 00,4B,00,00,
00,00, 08, 00, 00, 00,00,00,00

[HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers\Serial_Class\Unimodem\Config]
"EnableFlowHard"=dword:0
"EnableFlowSoft"=dword:0

I use the same vendor and pruduct id as Atmel, because i would like to use the same CDC driver as for accessing the processor in SAM-BA mode.
And i use still the "older" driver from Adeneo, so i have not compiled with the high speed library, but i suppose the old one shall work, too...

There is also HW feature on our board that may cause this malfunction. The USB device and host port is connected, so we would like to use our terminal as some kind of OTG device. As default, USB host driver are loaded, WLAN, Bluetooth, Mass storage devices work. If i would like my device as client, an interrupt of that 5V, the host driver will be deregistered, and the USB function driver will be registered. It should work.
For testing, I have completely removed the host driver from registry and from bib file, so CE boots up with function driver, but same issue.
Is there in OAL layer any part that can initialise the host peripherie in the controller?
guangyu.ren
Posts: 23
Joined: Tue Mar 31, 2009 7:22 am

Re: USB function driver on WinCE60

Fri Feb 05, 2010 5:17 am

1. I noticed that the driver dll you are using for Serial_Class is usbser_fn.dll instead of WinCE default serialusbfn.dll. Where is this from?

2. I am not sure whether the windows serial USB driver can work with CDC driver on your PC.

3. I am not sure whether your hardware design will cause issue or not. Could you use the default USB setting with Atmel BSP for 9263 and try the builtout image on AT91SAM9263EK? See whether Activesync can be connnected or not.
talabzs
Posts: 9
Joined: Tue Jun 19, 2007 5:14 pm

Re: USB function driver on WinCE60

Fri Feb 05, 2010 10:37 am

1. I noticed that the driver dll you are using for Serial_Class is usbser_fn.dll instead of WinCE default serialusbfn.dll. Where is this from?

This is the same, i have just tried to rebuild the original one for debug purposses, but does not helped!

2. I am not sure whether the windows serial USB driver can work with CDC driver on your PC.
I would be glad with async, if it would worked. It was just a tought, 'cause in SAM-BA mode it works with the standard CDC driver.

3. I am not sure whether your hardware design will cause issue or not. Could you use the default USB setting with Atmel BSP for 9263 and try the builtout image on AT91SAM9263EK? See whether Activesync can be connnected or not.

All the USB drivers are the same as in BSP, with a single modification for detection pin! Can be differenciesin OAL and/or other drivers, but i am not sure wether they affect this issue, like PLL settings and so on...
(Demo image on EVA board works with activesync...)

I found this in datasheet of AT91SAM9263:
"WARNING: Due to synchronization between MCK and UDPCK, the software application must wait for the end of the write
operation before executing another write by polling the bits which must be set/cleared.
//! Clear flags of UDP UDP_CSR register and waits for synchronization
#define Udp_ep_clr_flag(pInterface, endpoint, flags) { \
pInterface->UDP_CSR[endpoint] &= ~(flags); \
while ( (pInterface->UDP_CSR[endpoint] & (flags)) == (flags) ); \
}
//! Set flags of UDP UDP_CSR register and waits for synchronization
#define Udp_ep_set_flag(pInterface, endpoint, flags) { \
pInterface->UDP_CSR[endpoint] |= (flags); \
while ( (pInterface->UDP_CSR[endpoint] & (flags)) != (flags) ); \
}
"
But this is not happening so. Can be a problem? I dont use the same PLL settings as on EVA board.
craven
Posts: 14
Joined: Mon Aug 18, 2008 3:31 pm

Re: USB function driver on WinCE60

Fri Feb 05, 2010 11:19 am

We also do have problems with the USB device driver -> forum/viewtopic.php/f,9/t,18921/

Do you have an USB analyzer to check the bus traffic?

In my situation ActiveSync is working at least sometimes :)
Have you created a ras-book entry for Active Sync?

Code: Select all

[HKEY_LOCAL_MACHINE\Comm\DefaultConnections] 
    "USB device"=multi_sz:"USB Cable:","115200" 

[HKEY_CURRENT_USER\ControlPanel\Comm] 
    "Cnct"="USB device" 
    "AutoCnct"=dword:1


[HKEY_CURRENT_USER\Comm\RasBook\USB device]
"Entry"=hex:\
      08,02,40,00,00,00,00,00,00,00,00,00,00,00,05,c0,08,00,00,00,07,00,00,00,65,\
      00,00,00,02,00,30,05,30,00,00,00,01,00,00,00,57,06,00,00,02,00,30,05,01,00,\
      00,00,98,e9,74,d1,84,af,06,c0,30,00,04,d0,00,00,00,00,57,06,00,00,10,00,97,\
      d0,01,00,00,00,01,00,00,00,e0,ca,b3,d0,01,00,00,00,00,00,00,00,10,00,97,d0,\
      01,00,00,00,01,00,00,00,64,e8,05,c0,00,ff,74,d1,f0,e9,74,d1,5c,05,05,d0,55,\
      55,00,00,4c,85,06,c0,10,00,04,d0,02,00,30,05,f0,e9,74,d1,64,e8,05,c0,24,00,\
      00,00,f1,b6,e4,a9,a5,a6,a7,a8,a9,aa,ab,ac,40,00,00,00,00,00,00,00,14,ea,74,\
      d1,98,b1,06,c0,02,00,30,05,1c,ea,74,d1,64,e8,05,c0,08,00,00,00,0e,00,00,00,\
      3b,00,00,00,02,00,30,05,30,00,04,d0,3c,00,00,00,be,03,00,00,02,00,30,05,01,\
      00,00,00,48,ea,74,d1,84,af,06,c0,30,00,04,d0,00,00,00,00,be,03,00,00,10,00,\
      b3,d0,02,00,00,00,01,00,00,00,c0,77,6a,d1,01,00,00,00,00,00,00,00,10,00,b3,\
      d0,02,00,00,00,84,c3,3f,c0,70,76,6a,d1,02,00,30,05,64,37,a8,c0,00,00,00,00,\
      00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,01,00,00,00,64,00,69,00,72,\
      00,65,00,63,00,74,00,00,00,30,05,01,00,00,00,b8,ea,74,d1,6c,a8,3e,c0,60,37,\
      40,c0,10,74,53,00,65,00,72,00,69,00,61,00,6c,00,20,00,6f,00,6e,00,20,00,55,\
      00,53,00,42,00,00,00,a7,81,e4,ea,74,d1,e0,f1,18,80,a0,9a,a7,81,01,00,00,00,\
      02,00,40,00,a0,9a,a7,81,01,00,00,00,01,00,00,00,00,00,00,00,0f,00,00,00,01,\
      00,00,00,a0,9a,a7,81,00,af,3e,c0,00,00,00,00,01,00,00,00,80,9b,a7,81,01,00,\
      00,00,80,9b,a7,81,c0,96,a7,81,98,ec,74,d1,38,eb,74,d1,01,00,00,00,a4,1d,f9,\
      82,01,00,00,00,01,00,00,00,4c,eb,74,d1,d0,a6,15,80,a4,1d,f9,82,02,00,00,00,\
      01,00,00,00,00,00,00,00,50,05,05,d0,54,a4,3e,c0,01,00,00,00,ff,01,00,00,00,\
      8a,f4,82,a4,1d,f9,82,01,00,00,00,01,00,00,00,00,00,00,00,54,a4,3e,c0,8c,eb,\
      74,d1,a0,b9,15,80,00,00,00,00,ff,ff,ff,ff,a4,1d,f9,82,00,00,00,00,01,00,00,\
      00,a4,1d,f9,82,00,00,00,00,01,00,00,00,b4,eb,74,d1,44,68,14,80,a0,9a,a7,81,\
      03,00,3f,05,01,00,00,00,01,00,00,00,00,00,d5,82,01,00,00,00,d4,eb,74,d1,b8,\
      21,14,80,a0,9a,a7,81,01,00,00,00,00,00,01,00,e8,eb,74,d1,64,a3,15,80,01,00,\
      00,00,a0,9a,a7,81,00,b0,ff,83,42,00,00,00,01,00,01,00,00,b0,ff,83,a4,1d,f9,\
      82,00,00,00,00,10,ec,74,d1,ac,a7,15,80,00,b0,ff,83,ff,ff,ff,ff,01,00,00,00,\
      01,00,00,00,24,ec,74,d1,e8,63,19,80,00,b0,ff,83,00,00,00,00,01,00,00,00,01,\
      00,00,00,d8,aa,12,80,00,b0,ff,83,00,00,00,00,00,00,00,00,11,00,00,00,c0,67,\
      14,80,00,00,00,00,01,00,00,00,68,ec,74,d1,01,00,00,00,00,b0,ff,83,00,00,00,\
      00,00,00,00,00,01,00,00,00,03,00,3f,05,01,00,00,00,00,00,77,d1,60,02,00,00,\
      00,00,00,00,01,00,00,00,0c,ee,74,d1,00,00,00,00,01,00,00,00,48,fd,01,16,a0,\
      ec,74,d1,fc,87,03,c0,02,00,00,00,bc,ec,74,d1,00,00,00,00,01,00,00,00,01,00,\
      00,00,01,00,00,00,c8,ec,74,d1,00,00,00,00,00,00,00,00,c8,ec,74,d1,fc,d1,05,\
      c0,00,00,00,00,42,00,00,00,03,00,3f,05,00,00,00,00,00,80,00,00,04,00,00,00,\
      03,00,3f,05,00,00,00,00,60,02,00,00,50,01,00,00,50,01,77,d1,20,00,00,00,40,\
      00,00,00,14,00,00,00,00,00,77,d1,04,ed,74,d1,43,65,43,61,6c,6c,55,73,65,72,\
      50,72,34,ed,74,d1,00,fe,74,d1,55,55,00,00,4c,85,06,c0,cc,20,5e,c0,00,80,00,\
      00,00,00,00,00,00,a0,ff,83,10,01,00,00,f1,b6,e4,a9,a5,a6,a7,a8,a9,aa,ab,ac,\
      20,01,00,00,00,00,00,00,58,ed,74,d1,98,b1,06,c0,02,00,30,05,60,ed,74,d1,64,\
      e8,05,c0,08,00,00,00,00,00,00,00,5e,00,00,00,02,00,30,05,30,00,04,d0,01,00,\
      00,00,e0,05,00,00,02,00,30,05,01,00,00,00,8c,ed,74,d1,84,af,06,c0,30,00,04,\
      d0,00,00,00,00,e0,05,00,00,10,00,b3,d0,09,00,00,00,01,00,00,00,00,bc,6a,d1,\
      01,00,00,00,00,00,00,00,10,00,b3,d0,09,00,00,00,01,00,00,00,00,a0,ff,83,d4,\
      cd,05,c0,00,00,00,00,00,00,00,00
talabzs
Posts: 9
Joined: Tue Jun 19, 2007 5:14 pm

Re: USB function driver on WinCE60

Fri Feb 05, 2010 1:13 pm

Thanks for the info.

I have the same entries in platform.reg.

It seems to me the serialsubfn.dll does not load at all.
This comes out on debug port:
"
ATMEL_usbfn!C_USB_DEVICE::ThreadRun: : Suspend Detected
ATMEL_usbfn!C_USB_DEVICE::ThreadRun: : Reset Detected
UsbFnMdd!UfnMdd_Notify: Ignoring notification 0x00000001 - 0x00000002 from PDD
+ + + C_USB_DEVICE::Start
ATMEL_usbfn!C_USB_DEVICE::ThreadRun: : Detach Detected
UsbFnMdd!UfnMdd_Notify: Ignoring notification 0x00000001 - 0x00000000 from PDD
+ + + C_USB_DEVICE::ReInit
+ + + C_USB_DEVICE::HardwareInit
+ + + C_USB_DEVICE::Start
ATMEL_usbfn!C_USB_DEVICE::ThreadRun: : Resume Detected
+ + + C_USB_DEVICE::Start
ATMEL_usbfn!C_USB_DEVICE::ThreadRun: : Reset Detected
UsbFnMdd!UfnMdd_Notify: Ignoring notification 0x00000001 - 0x00000002 from PDD
ATMEL_usbfn!C_USB_DEVICE::ThreadRun: : Attach Detected
+ + + C_USB_DEVICE::ReInit
+ + + C_USB_DEVICE::HardwareInit
+ + + C_USB_DEVICE::Start
UsbFnMdd!UfnMdd_Notify: Ignoring notification 0x00000001 - 0x00000001 from PDD
UsbFnMdd!UfnMdd_Notify: Ignoring notification 0x00000003 - 0x00000001 from PDD
+ + + C_USB_DEVICE::Start
ATMEL_usbfn!C_USB_DEVICE::ThreadRun: : Reset Detected
UsbFnMdd!UfnMdd_Notify: Ignoring notification 0x00000001 - 0x00000002 from PDD
+ + + C_USB_DEVICE::Start
ATMEL_usbfn!C_USB_DEVICE::ThreadRun: : Reset Detected
UsbFnMdd!UfnMdd_Notify: Ignoring notification 0x00000001 - 0x00000002 from PDD
+ + + C_USB_DEVICE::Start
ATMEL_usbfn!C_USB_DEVICE::ThreadRun: : Reset Detected
UsbFnMdd!UfnMdd_Notify: Ignoring notification 0x00000001 - 0x00000002 from PDD
+ + + C_USB_DEVICE::Start
ATMEL_usbfn!C_USB_DEVICE::ThreadRun: : Suspend Detected
"
On device reset/attach these notification are sent out, as i see it in driver:
DeviceNotification(UFN_MSG_BUS_EVENTS, UFN_RESET);
DeviceNotification(UFN_MSG_BUS_EVENTS, UFN_ATTACH);
DeviceNotification(UFN_MSG_BUS_SPEED, BS_FULL_SPEED);

As i see on debug port, no reaction of that notifications...
craven
Posts: 14
Joined: Mon Aug 18, 2008 3:31 pm

Re: USB function driver on WinCE60

Tue Feb 09, 2010 7:02 pm

Do you have an USB analyzer? Maybe we really have the same problem.

Could you please try to add some debug outputs in your IST? Please check if there is some data left in the fifo when hitting the timeout.
A complete debug-version of the USB driver will not work due to available timing restrictions during handshake. Therfore you will need to add some small retail-messages yourself.
"WARNING: Due to synchronization between MCK and UDPCK, the software application must wait for the end of the write
operation before executing another write by polling the bits which must be set/cleared.
I have also read this note in the datasheet. But the USB driver unfortunatly does no recognize this at all.

Return to “WinCE”

Who is online

Users browsing this forum: No registered users and 9 guests