原创 为AM335x移植Linux内核主线代码(23)USB2514

2015-1-6 10:06 5158 11 11 分类: MCU/ 嵌入式 文集: Linux Kernel的DTS

USB2514 is a USB hub controller. To run USB2514 correctly, fellow steps should be done.

Prepare:
1. Connect USB0_VBUS of AM335x to +5V;
2. Connect USB0_ID of AM335x to GND;
3. Let USB0_DRVVBUS stay unconnected (because we don't neet it.)
4. Connect USB0_N/USB0_P to USB2514 test board.
5. Power boards.

Step 1:
Define the mux. Notice that usb0_id's mux is necessary.
static struct module_pin_mux usb0_pin_mux[] = {
        {OFFSET(usb0_dp),       MODE(0)},
        {OFFSET(usb0_dm),       MODE(0)},
        {OFFSET(usb0_id),       MODE(0)},
        {-1},
};

Step 2:
Configure pin's module. This sentence can be put into board_init function since u-boot.img is starting from SDRAM where SPL/MOL will not be executed.
configure_module_pin_mux(usb0_pin_mux);

Step 3:
Change the your configs. Notice if CONFIG_USB_MAX_CONTROLLER_COUNT is 2, then USB0 and USB1 can not be both HOST or PERIPHERAL.
#define CONFIG_USB_MAX_CONTROLLER_COUNT 1
#define CONFIG_USB_MUSB_DSPS
#define CONFIG_ARCH_MISC_INIT
#define CONFIG_MUSB_GADGET
#define CONFIG_MUSB_PIO_ONLY
#define CONFIG_MUSB_DISABLE_BULK_COMBINE_SPLIT
#define CONFIG_USB_GADGET
#define CONFIG_USBDOWNLOAD_GADGET
#define CONFIG_USB_GADGET_DUALSPEED
#define CONFIG_USB_GADGET_VBUS_DRAW     2
#define CONFIG_MUSB_HOST
#define CONFIG_AM335X_USB0
#define CONFIG_AM335X_USB0_MODE MUSB_HOST
#define CONFIG_AM335X_USB1
#define CONFIG_AM335X_USB1_MODE MUSB_PERIPHERAL
#define CONFIG_USB_KEYBOARD
#define CONFIG_SYS_USB_EVENT_POLL
#define CONFIG_CMD_USB
#define CONFIG_USB_STORAGE

Step 4:
Make and tftp to board's 0x83000000.
U-Boot# set ipaddr 192.168.1.117; set serverip 192.168.1.116
U-Boot# tftp 0x83000000 u-boot.bin
U-Boot# go 0x83000000

Step 5:
Start USB in new u-boot.bin at 0x83000000. I add some printf infomation so I can observe USB2514's features.  

U-Boot# usb start                                                               
(Re)start USB...                                                                
maria usb: USB_MAX_DEVICE = 32                                                                                            
scanning bus 0 for devices... maria usb: dev_index = 0, dev_num = 1, maxchild =0
maria usb: dev = 0x9f7a7a80                                                     
maria usb: usb_new_device enter.                                                
maria usb: not CONFIG_LEGACY_USB_INIT_SEQ                                       
maria usb: usb_get_descriptor enter                                             
maria usb: usb_get_configuration_no enter.                                      
maria usb: usb_set_configuration enter.                                         
maria usb: usb_hub_probe enter.                                                 
maria usb: find a hub.                                                          
4 ports detected.                                                               
individual port power switching                                                 
individual port over-current protection                                         
power on to power good time: 100ms                                              
hub controller current requirement: 1mA                                         
port 1 is removable                                                             
port 2 is removable                                                             
port 3 is removable                                                             
port 4 is removable                                                             
get_hub_status returned status 0, change 0                                      
local power source is good                                                      
no over-current condition exists                                                
usb_hub_power_on                                                                
Port 1 Status 101 Change 1                                                      
port 1 connection change                                                        
maria usb: dev_index = 1, dev_num = 2, maxchild = 0                             
maria usb: usb_dev[1] = 0x9f7a8400                                              
maria usb: usb_alloc_device enter. dev->parent = 0x9f7a7a80                     
maria usb: not CONFIG_LEGACY_USB_INIT_SEQ                                       
maria usb: usb_get_descriptor
maria usb: port num = 0                                                         
maria usb: usb_get_configuration_no enter.                                      
maria usb: usb_set_configuration enter.                                         
maria usb: usb_hub_probe enter.                                                 
maria usb: It is not a hub.                                                     
Port 2 Status 100 Change 0                                                      
Port 3 Status 100 Change 0                                                      
Port 4 Status 100 Change 0                                                      
2 USB Device(s) found                                                           
maria usb: stor_scan                                                            
       scanning usb for storage devices... 1 Storage Device(s) found            
maria usb: kbd_init     
 
Step 6:
Get USB info. Find the USB storage and try other usb command.
U-Boot# usb info
U-Boot# usb storage
U-Boot# usb read 0x85000000 0 400
U-Boot# md 0x85000000 400
                                                       
U-Boot# usb info                                                                
1: Hub,  USB Revision 2.0                                                       
 - Class: Hub                                                                   
 - PacketSize: 64  Configurations: 1                                            
 - Vendor: 0x0424  Product 0x2514 Version 11.179                                
   Configuration: 1                                                             
   - Interfaces: 1 Self Powered Remote Wakeup 2mA                               
     Interface: 0                                                               
     - Alternate Setting 0, Endpoints: 1                                        
     - Class Hub                                                                
     - Endpoint 1 In Interrupt MaxPacket 1 Interval 12ms                        
     - Endpoint 1 In Interrupt MaxPacket 1 Interval 12ms                        
                                                                                
2: Mass Storage,  USB Revision 2.0                                              
 - ADATA ADATA USB Flash Drive 119230846234002B                                 
 - Class: (from Interface) Mass Storage                                         
 - PacketSize: 64  Configurations: 1                                            
 - Vendor: 0x125f  Product 0xc08a Version 17.0                                  
   Configuration: 1                                                             
   - Interfaces: 1 Bus Powered 500mA                                            
     Interface: 0                                                               
     - Alternate Setting 0, Endpoints: 2                                        
     - Class Mass Storage, Transp. SCSI, Bulk only                              
     - Endpoint 1 In Bulk MaxPacket 512                                         
     - Endpoint 2 Out Bulk MaxPacket 512                                        
     
======================================================
这里参考生产USB2514的半导体公司SMSC的技术手册:
"PCB Design Guidelines for QFN and DQFN Packages" -- SMSC

1、焊接时QFN芯片不能放置得太高,要不然周围的perimeter pads就接触不到焊盘,造成开路;也不能放置得太低,要不然会把中间的焊锡挤出来,造成短路。

2. 中间flag焊盘上的过孔是越多越好,36pin的芯片至少放置8个,6mmx6mm的flag焊盘则至少放置16个。过孔的FHS面积至少要为3.5mm至5mm(FHS:Finished hole size)。过孔越多,热传导越好;靠近flag焊盘边缘的过孔越多,回流面积越小,这将减少信号的返回长度。

3. 使用分隔成4块或者9块的Solder Stencil方式,比一大块要好。stencil,也就是钢网,主要功能是帮助焊膏的沉积,从而将焊膏转移到空PCB的准确位置。

4. 不要在flag和pads之间走线,它们很容易短路。

附上测试板的原理图和PCB:

usb2514_sch.jpg
usb2514_brd.jpg



 

PARTNER CONTENT

文章评论0条评论)

登录后参与讨论
EE直播间
更多
我要评论
0
11
关闭 站长推荐上一条 /3 下一条