Skip to content

Conversation

@m-mcgowan
Copy link

@m-mcgowan m-mcgowan commented Feb 28, 2025

Fixes USB on Cygnet.

Major changes, enabling USB functionality:

  • The L433 doesn't support USB OTG, hence the USB ISR has a different name with the L433 compared to the L4R5.
  • The enable/disable interrupts code was failing and disabling all interrupts after a certain period because it was using non-atomic operations. I rewrote the code to use atomic operations so that interrupts are re-enabled correctly. (Edit: I'm not convinced the new code is actually atomic, but could have resulted in a compiler optimization error.)

Minor changes:

  • Normalized the defines that differ by case (STM32L4R5xx / STM32L4R5XX) to use only the lowercase version, and similarly for the L433, which were only causing confusion.
  • Tidied up some defines that were using preprocessor symbols in a way that implied they were guaranteed to be defined, being either 0 or 1, but in reality are only defined when targeting certain boards.
  • indented init_usb_vbus_sense() to make the nested conditionals clearer to read.

Copy link
Member

@bsatrom bsatrom left a comment

Choose a reason for hiding this comment

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

Thanks @m-mcgowan! I'll test these changes today and let you know!

@bsatrom bsatrom merged commit 70dc681 into blues:blues_cygnet Feb 28, 2025
32 of 36 checks passed
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