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

Pull in cherry picked stm32f4 fixes from lesshonor #37

Merged

Conversation

petejohanson
Copy link

lesshonor has graciously assembled these fixes from newer Zephyr release to address issues with the Zephyr 3.5 USB support for F4. Creating this PR that includes their work to fix F4 for now until we update Zephyr versions.

Desvauxm-st and others added 6 commits October 5, 2024 22:50
Isochronous endpoint issue with USB drivers on STM32G491
we setup an isochronous endpoint and are having an issue
where every other frame sends the desired data sandwiched
between garbage data.

For isochronous the parameter ep_kind into the fonction :
HAL_PCDEx_PMAConfig(PCD_HandleTypeDef *hpcd, uint16_t ep_addr,
uint16_t ep_kind, uint32_t pmaadress) must be PCD_DBL_BUF.

The parameter pmaadress (EP address in The PMA) is like that:
EP address in The PMA: In case of single buffer endpoint
this parameter is 16-bit value providing the address
in PMA allocated to endpoint.
In case of double buffer endpoint this parameter
is a 32-bit value providing the endpoint buffer 0 address
in the LSB part of 32-bit value and endpoint buffer 1 address
in the MSB part of 32-bit value.


Signed-off-by: Marc Desvaux <[email protected]>
The stm32H5 mcu has an independent USB supply to be enabled
at init with LL_PWR_EnableVDDUSB function like the stm32U5 serie.
Both series have PWR_USBSCR_USB33SV bit in their USBSCR POWER reg.
and other series all have PWR_CR2_USV bit in their CR2 POWER reg.

Signed-off-by: Francois Ramu <[email protected]>
Like the stm32H5, stm32u5 usb device has an independent
power supply, but control bit is PWR_SVMCR_USV.
The control bit for the stm32H5 is PWR_USBSCR_USB33SV (no change)

Signed-off-by: Francois Ramu <[email protected]>
The driver cannot handle OUT transactions for an endpoint with an
MPS smaller than 64 bytes. To solve the issue, we will not use one
fixed value, EP_MPS, but instead use the actual MPS of an endpoint,
ep_state->ep_mps.

Signed-off-by: Marc Desvaux <[email protected]>
Signed-off-by: Loic Poulain <[email protected]>
The RX FIFO size is in words, so needs to be subtracted from the total
memory size *after* it's divided by 4.

Fixes zephyrproject-rtos#70789.

Signed-off-by: Armin Brauns <[email protected]>
Magic constants throughout the code made this difficult to reason about,
especially with two different units of measurement (bytes and words) at
play.

Signed-off-by: Armin Brauns <[email protected]>
@petejohanson
Copy link
Author

Tested on F4, where I confirmed the fix works as expected, and tested on my stm32f072 Le Chiffre PCB, and no regressions there. Merging.

@petejohanson petejohanson merged commit 7a7c0b5 into zmkfirmware:v3.5.0+zmk-fixes Nov 11, 2024
7 of 9 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.

4 participants