Commit Graph

22160 Commits (feature-hal-spec-usb-device)

Author SHA1 Message Date
Cruz Monrreal 2ba1cdd4cb
Merge pull request #9539 from c1728p9/fix_travis
Remove inclusion of mbed.h from USB
2019-01-29 21:26:31 -06:00
Russ Butler f8864ae307 Applied suggested astyle fixes 2019-01-29 15:45:18 -06:00
Russ Butler 5867e99bc9 Remove inclusion of mbed.h from USB
Remove mbed.h from USB files and fix the build errors this causes.
This is required to pass CI.
2019-01-29 15:31:24 -06:00
bcostm e23e57de68 STM32L4 USB: enable USBDEVICE 2019-01-29 12:27:34 -06:00
Filip Jagodzinski da3b4a9036 Tests: USB: Use astyle to format the test class 2019-01-29 12:27:34 -06:00
Filip Jagodzinski 9ba3df4c30 Tests: USB: Fix 'endpoint halt' test
Abort all endpoint transfers before running the test again.
Use an updated vendor request to explicitly restart device reads.
2019-01-29 12:27:34 -06:00
bcostm c20e2e72fa STM32F7 USB: enable USBDEVICE in targets.json 2019-01-29 12:27:34 -06:00
bcostm 28150d1d90 STM32F7 USB: add NUCLEO_F756ZG in pins definition 2019-01-29 12:27:33 -06:00
bcostm 9c83fe9ff0 STM32F7 USB: change VBUS pin for DISCO_F746NG FS 2019-01-29 12:27:33 -06:00
bcostm a1d3e313a7 STM32F7 USB: add patch in CubeF7 hal driver 2019-01-29 12:27:33 -06:00
bcostm 6825f3a8ac STM32L4 USB: move HAL_PCD_EP_Abort function
This function is for USB_OTG_FS devices only. Move it in the correct place (in "#ifdef USB_OTG_FS" area).
2019-01-29 12:27:33 -06:00
bcostm b91a196b22 STM32L4 USB: add pins definition for STM32L496/L4R5 MCUs 2019-01-29 12:27:33 -06:00
bcostm d97f6f8a8d STM32L4 USB: add patch in CubeL4 hal driver 2019-01-29 12:27:33 -06:00
TomoYamanaka 2495386eda Renesas : Implement USB Device feature
I implemented USB Device feature for Renesas mbed boards.
The code referenced the following code as a starting point and is implemented it by inheritting USBPhy same as other boards.
(mbed-os\features\unsupported\USBDevice\targets\TARGET_RENESAS)
2019-01-29 12:27:33 -06:00
Filip Jagodzinski 20de382939 Tests: USB: Add a README for Linux users
Explain how to overcome xHCI limitations in kernels prior to v4.17 and
successfully run USB tests.
2019-01-29 12:27:33 -06:00
bcostm 40c106d97d STM32F4 USB: enable USB Device in targets.json
tests-usb_device-basic are OK on the following platforms:

NUCLEO_F412ZG
NUCLEO_F413ZH
NUCLEO_F429ZI
NUCLEO_F446ZE
DISCO_F413ZH
DISCO_F469NI
2019-01-29 12:27:33 -06:00
bcostm dd58a048f6 STM32F4 USB: remove useless macro 2019-01-29 12:27:33 -06:00
bcostm ad4837156a STM32F4 USB: add patch in CubeF4 hal driver 2019-01-29 12:27:33 -06:00
Filip Jagodzinski aab52fc2a6 Tests: USB: DTR fix for Linux hosts
A DTR line is used to signal that the host has configured a terminal and
is ready to transmit and receive data from the USB CDC/Serial device.
When this test suite is run with the use of a Linux host, a workaround has
to be used to overcome some platform specific DTR line behavior.
Every time the serial port file descriptor is opened, the DTR line is
asserted until the terminal attributes are set.
As a consequence, the device receives a premature DTR signal with a
duration of 200-500 us before the correct, long-lasting DTR signal set by
the host-side test script. (tested on the Linux kernel 4.15.0)

The solution is to wait for the first DTR spike, ignore it, and wait for
the correct DTR signal again.
2019-01-29 12:27:32 -06:00
Russ Butler 23f43ecd58 Remove USB disconnect delay from Serial test
Remove the USB disconnect delay since there is no reason this is
needed. Failures which occur without this indicate a device or host
problem.
2019-01-29 12:27:32 -06:00
Russ Butler 3b4dd6b385 Tests: USB: Increase serial open retries
Double the number of attempts that are made to open a serial port.
This makes tests run more reliably on Windows.
2019-01-29 12:27:32 -06:00
Russ Butler 869003ccab Tests: USB: Remove TX_DELAY_MS from serial test
Remove TX_DELAY_MS and all the places it was called since it is not
needed when DTR flow control is used.
2019-01-29 12:27:32 -06:00
Russ Butler bcca3ed2a5 Tests: USB: Use DTR to make Serial tests reliable
Update the serial host test to set DTR low before opening a serial
port. Set DTR high once the serial object is ready. This ensures that
no data is sent by the device until the host is ready.
2019-01-29 12:27:32 -06:00
Filip Jagodzinski 13ab89337e Tests: USB: Increas the size of RX CDC test data
This ensures the flow control is tested.
2019-01-29 12:27:32 -06:00
Filip Jagodzinski e954f7866e Tests: USB: Fix Windows USB SN handling 2019-01-29 12:27:32 -06:00
Filip Jagodzinski 9387165f8c Tests: USB: Update code comments 2019-01-29 12:27:32 -06:00
Filip Jagodzinski 7684ffd8b9 Tests: USB: Use SN generated by the host machine 2019-01-29 12:27:32 -06:00
Filip Jagodzinski 8801d20fde Tests: USB: Correct reconnect delay
Setting to 1 ms to be on the safe side. The USB spec defines this delay
to be at least 200 us.
2019-01-29 12:27:32 -06:00
Filip Jagodzinski ffaa050a89 Tests: USB: Wait before transmitting data to host
Despite having ECHO and ECHOCTL POSIX lflags disabled by default by
pyserial, a delay is needed for host to properly handle data received
from USB serial/CDC device.
With no delay host would echo 0x00-0x31 characters prefixed with '^'.
2019-01-29 12:27:31 -06:00
Filip Jagodzinski b6ed7aaab1 Tests: USB: Wait before closing host's port
This delay eliminates the possibility of the device detecting the port
being closed when still waiting for data.
2019-01-29 12:27:31 -06:00
Filip Jagodzinski 0f5c285182 Tests: USB: Add Serial test for line coding change 2019-01-29 12:27:31 -06:00
Filip Jagodzinski 30af468d86 Tests: USB: Use the serial number to find device
Use the USB device SN instead of VID & PID to find the device port name
on the host system.
2019-01-29 12:27:31 -06:00
Filip Jagodzinski 9bbbe28796 Tests: USB: Fix USB reconnect tests for Win hosts 2019-01-29 12:27:31 -06:00
Filip Jagodzinski 776167a55f Tests: USB: Add tests for Serial class. 2019-01-29 12:27:31 -06:00
Filip Jagodzinski ba44260fe7 Tests: USB: Add tests for CDC class. 2019-01-29 12:27:31 -06:00
Russ Butler 83ffab6763 Ignore disabled Kinetis USB endpoint interrupts
Ignore interrupts on disabled USB endpoints. This prevents handling
interrupts when in the wrong state.

Prior to this patch when running the serial test on a K64F the assert
on line 908 of USBDevice.cpp would sometimes be triggered. This
assert indicates that an endpoint 0 IN interrupt occurred before
the device was ready.

This occurs during the test_cdc_usb_reconnect test when the host sends
a "Set Control Line State" USB request and the device acknowledges it
just before USB is disconnected.
2019-01-29 12:27:31 -06:00
Russ Butler 721e81b3c6 Fix USB traceback during testing when wrong size
In the pyusb_basic host test check the length of control transfers
before comparing contents for equality.
2019-01-29 12:27:31 -06:00
Russ Butler 805e5631a9 Remove HAL_GetTick from ST USBPhy
Remove the function HAL_GetTick from the ST USBPhy driver. This is no
longer needed as that change has been made on master.
2019-01-29 12:27:31 -06:00
Filip Jagodzinski ea52de6886 Tests: USB: Check ep buffer is released by abort
Validate that endpoint buffer is not used after a transfer has been
aborted.
2019-01-29 12:27:31 -06:00
Filip Jagodzinski a7abab3323 Tests: USB: Update endpoint halt test
Wait for a locally created Timer thread to finish before returning.
2019-01-29 12:27:30 -06:00
Filip Jagodzinski 57a35d3e83 Tests: USB: Decrease the max data size for iso ep
Although the USB spec sets the upper limit on FS isochronous endpoint
payloads to 1023 B, this value is hard to test in practice. Moreover,
not all the targets Mbed OS supports (like NUCLEO_F207ZG) are able to
handle all the endpoints set to max.
2019-01-29 12:27:30 -06:00
Russ Butler e1efa8d3e9 Update test to restart reads after unstall
After an endpoint is unstalled any pending transfers are terminated.
This patch re-starts any reads that were ongoing.
2019-01-29 12:27:30 -06:00
Filip Jagodzinski e55142a044 Tests: USB: Update ep callbacks
Endpoint callbacks no longer have endpoint as a param. This update was
introduced in #7267.
2019-01-29 12:27:30 -06:00
Filip Jagodzinski 5b70a263b6 Tests: USB: Add data toggle test 2019-01-29 12:27:30 -06:00
Filip Jagodzinski aad645312d Tests: USB: Update endpoint tests
Fix the host script issues present on Windows machines.
Add 0 B payload size to bulk endpoints test.
Update halt and abort tests according to PR comments.
Add an explicit request to start reading on OUT endpoints.
2019-01-29 12:27:30 -06:00
Filip Jagodzinski d83aa3e80e Tests: USB: Generic: Update documentation 2019-01-29 12:27:30 -06:00
Filip Jagodzinski caaedd50d6 Tests: USB: Generic: Add basic endpoint tests 2019-01-29 12:27:30 -06:00
Filip Jagodzinski 4c752ff057 USB: EndpointResolver: Add a generic method to get a free endpoint 2019-01-29 12:27:30 -06:00
Russ Butler 88b5d1c963 Remove OR from ST endpoint activation
When activating an endpoint assign new data rather than ORing
data to it. This ensures that values set from the previous use
do not effect the current configuration.
2019-01-29 12:27:30 -06:00
Russ Butler 4dfc6debe5 Fix ST test failures due to endpoint reconfiguration
Also always use the max endpoint size for SetTxFifo
since re-configuring fifos when endpoints are added or removed
causes tests to fail.
2019-01-29 12:27:30 -06:00