Skip to content
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

Add hcd driver for frdm kl25z #1304

Merged
merged 7 commits into from
Feb 9, 2022

Conversation

kkitayam
Copy link
Collaborator

Describe the PR
Add a HCD driver for NXP FRDM-KL25Z.
The HCD driver works with only HCD class.

Additional context
In order to operate as a USB host function, J21 must be shorted. The schematic is shown below.
image
This PR was tested on cdc_msc_hid example with a low speed mouse(Logitech M-UB48) and a full speed mouse(Logitech G403).

When running with a HUB, some patches are needed to make buffers align 4 byte boundary and to make buffer length be in 4 byte unit. It seems that KL25Z's USB IP(ChipIdea Fullspeed OTG core) writes data into memory in 4 byte unit.

Current HUB class driver requests IN transfer with the following buffers. The buffers needs patches.

uint8_t status_change; // data from status change interrupt endpoint

hub_port_status_response_t port_status;

CFG_TUSB_MEM_SECTION TU_ATTR_ALIGNED(4) static uint8_t _hub_buffer[sizeof(descriptor_hub_desc_t)];

After the patches are applied, the HCD driver works with a pair of a full speed hub and a full speed mouse. However it does not work with a pair of a full speed hub and a low speed mouse. A bus turnaround timeout error will be occurred.

@hathach
Copy link
Owner

hathach commented Feb 1, 2022

Thank you @kkitayam for another excellent PR. I am currently on TET (Lunar New Year) holiday. I will check this out as soon as I could.

Copy link
Owner

@hathach hathach left a comment

Choose a reason for hiding this comment

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

thank you very much for your PR. I was putting my KL25z on soldering table, then realize that it is rev D and does not feature the J21 and R82 to test out the host functionality. I will try to test this later on with a newer/better board later on. For now, I fully rely on your testing.

image

@hathach hathach merged commit 63cb3cd into hathach:master Feb 9, 2022
@kkitayam kkitayam deleted the add_hcd_for_frdm_kl25z branch February 19, 2022 07:49
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.

2 participants