mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
6f0ac0c092
19460: cpu/stm32/usbdev_fs: fix ep registration and EP_REG assignments r=gschorcht a=dylad ### Contribution description This PR provides two fixes for the `usbdev_fs` driver: - Fix endpoints registration - Fix assignment of toggleable bits in EP_REG(x) registers These bugs were encountered with the USBUS MSC implementation. Regarding the endpoints registration: For the `usbdev_fs` peripheral, IN and OUT endpoints of the same index must have the same type. For instance, if EP1 OUT is a bulk endpoint, EP1 IN must either be unused or used as bulk too but it cannot be used as interrupt or isochronous. With the previous check, the following registration pattern (EP OUT Bulk -> EP IN Interrupt -> EP IN Bulk) would assign both EP OUT Bulk and EP IN Interrupt to same endpoint index. So the configuration would be broken. Applying the same registration pattern with this patch would now produce EP OUT Bulk -> 1 / EP IN Interrupt -> 2 / EP IN Bulk 1. Which is a working configuration for this IP. and for the second fix: EP_REG(x) registers have a total of 6 toggleable bits. Those bits can only be toggled if we write a one to it, otherwise writing a zero has no effect This commit fixes all the access to these registers to prevent from modifying these bits when not needed. Without this patch, the endpoint status (VALID / NACK / STALL) can be erroneously modify because bits are not cleared when assigning the new content to the register and thus make the bits toggle and change values. ### Testing procedure This can be tested with tests/usbus_msc on any board using this `usbdev_fs` driver. It is easier to test this PR with #19443 alongside. Then the following would be enough: `CFLAGS='-DSECTOR_COUNT=64' USEMODULE='mtd_emulated' make -j8 BOARD=p-nucleo-wb55 -C tests/usbus_msc flash` Otherwise this can also be tested by attaching a SPI<->SDCARD adapter. ### Issues/PRs references None. Co-authored-by: Dylan Laduranty <dylan.laduranty@mesotic.com> |
||
---|---|---|
.. | ||
arm7_common | ||
atmega32u4 | ||
atmega128rfa1 | ||
atmega256rfr2 | ||
atmega328p | ||
atmega1281 | ||
atmega1284p | ||
atmega2560 | ||
atmega_common | ||
atxmega | ||
avr8_common | ||
cc26x0_cc13x0 | ||
cc26x2_cc13x2 | ||
cc26xx_cc13xx | ||
cc2538 | ||
cortexm_common | ||
efm32 | ||
esp32 | ||
esp8266 | ||
esp_common | ||
fe310 | ||
gd32v | ||
kinetis | ||
lm4f120 | ||
lpc23xx | ||
lpc1768 | ||
msp430_common | ||
msp430fxyz | ||
native | ||
nrf5x_common | ||
nrf51 | ||
nrf52 | ||
nrf9160 | ||
qn908x | ||
riscv_common | ||
rpx0xx | ||
sam0_common | ||
sam3 | ||
sam_common | ||
samd5x | ||
samd21 | ||
saml1x | ||
saml21 | ||
stellaris_common | ||
stm32 | ||
doc.txt | ||
Kconfig |