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

Fix USB detection whith bootloader #1

Closed
TeXitoi opened this issue Nov 18, 2019 · 11 comments
Closed

Fix USB detection whith bootloader #1

TeXitoi opened this issue Nov 18, 2019 · 11 comments

Comments

@TeXitoi
Copy link
Owner

TeXitoi commented Nov 18, 2019

No description provided.

@TeXitoi
Copy link
Owner Author

TeXitoi commented Nov 20, 2019

Maybe power off the usb stack before initializing it, something like

regs.cntr.modify(|_, w| w.pdwn().set_bit());

@TeXitoi
Copy link
Owner Author

TeXitoi commented Nov 20, 2019

Doesn't work, but seems a bit better.

@daagaak
Copy link

daagaak commented Dec 29, 2019

Thought you might be interested to know, the reason USB doesn't come up at 48mhz is that the USB device needs to to be disabled via APB1ENR before you can successfully change the USB clock. It's still enabled from the bootloader and you can't change the USB clock while it's active.

@TeXitoi
Copy link
Owner Author

TeXitoi commented Dec 29, 2019

Yeah, I find that was caused by the clock. Using 72MHz also do the job fine.

@TeXitoi
Copy link
Owner Author

TeXitoi commented Dec 29, 2019

Just out of curiosity, how are you? Are you using this firmware?

@daagaak
Copy link

daagaak commented Dec 29, 2019

I’m not. I actually wrote my own FW in rust and then found this bug when I ported it to my Ortho60, then found your repo after that ;).

@TeXitoi
Copy link
Owner Author

TeXitoi commented Dec 29, 2019

Great! Enjoy, and feel free to ask any question, I might have some similar problem in the past ;-)

Any link to your firmware?

@TeXitoi
Copy link
Owner Author

TeXitoi commented Dec 29, 2019

You might be interested in TeXitoi/keyberon#14 where you can find some different keyboard implementation in rust.

@daagaak
Copy link

daagaak commented Dec 29, 2019

I don’t have a link, sadly. I can’t push stuff to github.

I made my interrupt driven, though it requires a lot of board specific boiler plate. I also have an extra layer of indirection in the layout so that you can pull common layouts into shared parts (fex. the core QWERTY or Colemak layout keys). I also have a version working on an STM32WB nucleo. I want to see if I can get Bluetooth working.

@TeXitoi
Copy link
Owner Author

TeXitoi commented Dec 29, 2019

Look at https://github.com/rtfm-rs/cortex-m-rtfm if you didn't know already: a really great paradigm for interrupt driven firmware. And really lightweight.

@daagaak
Copy link

daagaak commented Dec 29, 2019

Yep! That’s what I’m using. The boilerplate in mine comes from having to declare the 3-4 board-specific GPIO/EXTI interrupt handlers and funnel them all into the poll routine.

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

No branches or pull requests

2 participants