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

USB peripheral support #135

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

liamkinne
Copy link
Contributor

Adds the required implementation to support USB device with usb-device and stm32-usbd.

@liamkinne
Copy link
Contributor Author

@usbalbin I have mostly ripped this implementation from the F3 repo. However I'm not sure if it is not working correctly or if I have a hardware issue since the G4 board I'm using doesn't feature a USB connector.

If you have the ability to test using the example that would be great. Otherwise wait until I can get my hands on the correct hardware before merging.

const EP_MEMORY_ACCESS_2X16: bool = true;

fn enable() {
critical_section::with(|_| unsafe {

This comment was marked as resolved.

This comment was marked as resolved.

Copy link
Contributor

Choose a reason for hiding this comment

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

What is the different between critical_section::with (requiring a new dependency) and cortex_m::interrupt::free as used in src/serial/usart.rs?

Copy link
Contributor

Choose a reason for hiding this comment

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

If there would be no downside, I would prefer to avoid the extra dependency

@usbalbin
Copy link
Contributor

Note there is also #50 . @kevswims what is the status and/or plans of #50?

@usbalbin
Copy link
Contributor

@usbalbin I have mostly ripped this implementation from the F3 repo. However I'm not sure if it is not working correctly or if I have a hardware issue since the G4 board I'm using doesn't feature a USB connector.

If you have the ability to test using the example that would be great. Otherwise wait until I can get my hands on the correct hardware before merging.

I do not have access to such hardware right now. Might in several months, maybe, but not now.

BTW, thanks!

@liamkinne
Copy link
Contributor Author

@usbalbin didn't see #50 but I will have a look at it an see if there's anything to bring across.

I'll go ahead and order the expansion board to give my dev board USB. If that doesn't fix it, my best guess is there's a clocking issue causing the host to reject the connection.

@usbalbin
Copy link
Contributor

@usbalbin didn't see #50 but I will have a look at it an see if there's anything to bring across.

I'll go ahead and order the expansion board to give my dev board USB. If that doesn't fix it, my best guess is there's a clocking issue causing the host to reject the connection.

Awesome!

Correct me if I am wrong, have not looked into USB, but I believe I read about some sort of clock recovery system in #50 for running without a crystal in case that helps.

@kevswims
Copy link
Contributor

Note there is also #50 . @kevswims what is the status and/or plans of #50?

I have switched my project over to use embassy which is why I haven't done anything more with that PR. As far as I remember with a bit of cleanup it should be good to go in if someone wants to use the work from it. I'm happy to answer questions or assist with that if someone wants to take it over.

@liamkinne
Copy link
Contributor Author

@usbalbin with the correct hardware, all is working now.

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.

3 participants