对于USB眼图,并不是很清楚这种硬件特性,USB控制器一般本身自带测试模式,所以只需要修改寄存器来发送对应的测试包就行了。
/**********************************************************************
* USB眼图
* 说明:
* 对于USB眼图,并不是很清楚这种硬件特性,USB控制器一般本身自带测试
* 模式,所以只需要修改寄存器来发送对应的测试包就行了。USB Hub可以用usb-tools。
*
* 2018-7-11 深圳 宝安西乡 曾剑锋
*********************************************************************/
一、参考文档:
1. USB 眼图测试
https://community.nxp.com/thread/357113
2. The solution for the USB test
https://community.nxp.com/thread/321605
3. i.MX6Q/eye pattern of USB HS1 setup
https://community.nxp.com/thread/383925
4. I.MX6 series USB Certification Guides
https://community.nxp.com/docs/DOC-105609
5. 65.6 USB Core Memory Map/Register Definition
6. https://github.com/felipebalbi/usb-tools
7. USB HOST TEST MODE
http://eagerhsu.blogspot.com/2012/07/usb-host-test-mode.html
8. USB High Speed Electrical Test
https://github.com/MicrochipTech/USB-Hub-Linux-Examples/tree/master/General%20USB%20Examples/USB%20High%20Speed%20Electrical%20Test
二、原理说明:
The USB controller is compliant with the EHCI specification. The test modes are set by the PTC bits in the PORTSC register (bits 19-16).
三、USB_nPORTSC1 field descriptions

四、测试示例:
memtool 0x2184184 1 //read the register settings, address of the other USB port is 0x2184384
memtool 0x2184184=0x18441205 // Force to output Test Packet for Eye Diagram Test
memtool 0x2184184=0x18411205 //Force to output J_STATE
memtool 0x2184184=0x18421205 // Force to output K_STATE
memtool 0x2184184=0x18431205 // Force to output SE0 (host) / NAK (device)
memtool 0x2184384=0x18001305 // Force to output Reset
memtool 0x2184384=0x18001285 //Ho Force to output Suspend
memtool 0x2184384=0x18001245 // Force to output Resume
五、PORTSCn地址信息:
| Absolute |
| address | | Width |
| (hex) | Register name | (in bits) | Access Reset value
+----------+-----------------------------------------+-----------+-------------------
| 218_4184 | Port Status & Control (USB_UOG_PORTSC1) | 32 | R/W 1000_0000h
+----------+-----------------------------------------+-----------+-------------------
| 218_4384 | Port Status & Control (USB_UH1_PORTSC1) | 32 | R/W 1000_0000h
+----------+-----------------------------------------+-----------+-------------------
| 218_4584 | Port Status & Control (USB_UH2_PORTSC1) | 32 | R/W 1000_0000h
+----------+-----------------------------------------+-----------+-------------------
| 218_4784 | Port Status & Control (USB_UH3_PORTSC1) | 32 | R/W 1000_0000h