Skip to content

Add Kinetis USB Phy #6337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

c1728p9
Copy link
Contributor

@c1728p9 c1728p9 commented Mar 12, 2018

  • Add Kinetis USBPhy
  • Add extra checks to USBDevice
  • Fix read_start behavior when configuring

@c1728p9
Copy link
Contributor Author

c1728p9 commented Mar 12, 2018

Please review @maciejbocianski and @fkjagodzinski

@c1728p9 c1728p9 requested review from ashok-rao and 0xc0170 March 12, 2018 20:34
@c1728p9 c1728p9 force-pushed the feature-hal-spec-usb-device branch from 262cddc to a9f94dc Compare March 12, 2018 22:30
Copy link
Contributor

@ashok-rao ashok-rao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes LGTM!..would be nice to know how to unit test these..!

NVIC_EnableIRQ(USB0_IRQn);
}

void USBPhyHw::deinit()
Copy link
Contributor

@maciejbocianski maciejbocianski Mar 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we add disconnecting code here (similar to LPC176X implementation)?
without it, re-initialization is failing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. It has been added.

c1728p9 added 3 commits March 14, 2018 18:47
Copy the Kinetis USB driver files from
mbed-os\features\unsupported\USBDevice\targets\TARGET_Freescale
and update them to match the new USBPhy API.
Assert that when a callback is completed it is the active callback.
Remove the USBDevice function read_start and automatically start all
reads internally in USBDevice. This patch also renames the function
read_finish to read.
@c1728p9 c1728p9 force-pushed the feature-hal-spec-usb-device branch from a9f94dc to 0c90346 Compare March 14, 2018 23:48
@c1728p9
Copy link
Contributor Author

c1728p9 commented Mar 14, 2018

@ashok-rao the USB device HAL specification explains how to run the tests:

mbed test -t <toolchain> -m <target> -n mbed-os-tests-usb_device-*

@c1728p9
Copy link
Contributor Author

c1728p9 commented Mar 14, 2018

Addressed @maciejbocianski's comment and also simplified the USBDevice read API (user API not HAL API). The older API allowed reads to be explicitly started, which some hardware doesn't support (Like the LPC1768). With the new API the receiver is automatically started when the endpoint is added.

Old endpoint state machine diagram:

usb_endpoint_state_diagram_user

New endpoint state machine diagram:

usb_endpoint_state_diagram_user

The USB technology docs PR has also been updated to reflect this.

@cmonr
Copy link
Contributor

cmonr commented Mar 15, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Mar 15, 2018

Build : FAILURE

Build number : 1449
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6337/

Remove read_start and replace read_finish with read to match the new
USBDevice API.
@c1728p9 c1728p9 force-pushed the feature-hal-spec-usb-device branch from 0c90346 to 1ee2866 Compare March 15, 2018 16:48
@cmonr
Copy link
Contributor

cmonr commented Mar 15, 2018

Will relaunch when able to. ARM license CI issue.

@cmonr
Copy link
Contributor

cmonr commented Mar 15, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Mar 15, 2018

Build : SUCCESS

Build number : 1459
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6337/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Mar 15, 2018

@mbed-ci
Copy link

mbed-ci commented Mar 15, 2018

c1728p9 and others added 2 commits March 15, 2018 20:04
Initialize the _transfer structure so the behavior is the same
regardless of prior memory contents. This fixes a hang during
USB testing when CI flags are used.
Call USBDevice::endpoint_stall/unstall in the request to set/clear
halt so the endpoint state is properly updated in the array
_endpoint_info.
@cmonr
Copy link
Contributor

cmonr commented Mar 16, 2018

CI issue: NRF52 flash cache test

Rebuilding due to new PR commits.
/morph build

@mbed-ci
Copy link

mbed-ci commented Mar 16, 2018

Build : SUCCESS

Build number : 1462
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6337/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Mar 16, 2018

@mbed-ci
Copy link

mbed-ci commented Mar 16, 2018

@cmonr
Copy link
Contributor

cmonr commented Mar 16, 2018

CI issue: NRF52 flash cache test

Restarting.
/morph test

@mbed-ci
Copy link

mbed-ci commented Mar 16, 2018

@cmonr cmonr merged commit 46fe769 into ARMmbed:feature-hal-spec-usb-device Mar 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants