Skip to content

Commit

Permalink
Merge #19358
Browse files Browse the repository at this point in the history
19358: sys/usbus/cdc/ecm: fix High-Speed mode r=dylad a=gschorcht

### Contribution description

This PR provides some changes to fix the USBUS CDC ECM interface in High-Speed mode.

In High-Speed mode, the EP data size has to be at least 512 bytes instead of 64 Byte in Full-Speed mode. To be able to define configurations like EP data sizes depending on whether Full-Speed or High-Speed USB device peripherals are used, the feature `periph_usbdev_hs`/`HAD_PERIPH_USBDEV_HS` is introduced.

### Testing procedure

Use `tests/usbus_cdc_ecm`  and any board with USB HS connector, for example:
```
USEMODULE=periph_usbdev_hs_utmi BOARD=stm32f723e-disco make -j8 -C tests/usbus_cdc_ecm flash
```
`ping` command works with this PR but doesn't work without this PR.

### Issues/PRs references

Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
  • Loading branch information
bors[bot] and gschorcht authored Mar 7, 2023
2 parents 777857a + 4f49fc8 commit 6c1de71
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions boards/stm32f723e-disco/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ config BOARD_STM32F723E_DISCO
select HAS_PERIPH_UART
select HAS_PERIPH_UART_HW_FC
select HAS_PERIPH_USBDEV
select HAS_PERIPH_USBDEV_HS
select HAS_PERIPH_USBDEV_HS_UTMI

# Put other features for this board (in alphabetical order)
Expand Down
1 change: 1 addition & 0 deletions boards/stm32f723e-disco/Makefile.features
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ FEATURES_PROVIDED += periph_timer
FEATURES_PROVIDED += periph_uart
FEATURES_PROVIDED += periph_uart_hw_fc
FEATURES_PROVIDED += periph_usbdev
FEATURES_PROVIDED += periph_usbdev_hs
FEATURES_PROVIDED += periph_usbdev_hs_utmi

# Put other features for this board (in alphabetical order)
Expand Down
1 change: 1 addition & 0 deletions boards/stm32f746g-disco/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ config BOARD_STM32F746G_DISCO
select HAS_PERIPH_TIMER
select HAS_PERIPH_UART
select HAS_PERIPH_USBDEV
select HAS_PERIPH_USBDEV_HS
select HAS_PERIPH_USBDEV_HS_ULPI
select HAS_TINYUSB_DEVICE

Expand Down
1 change: 1 addition & 0 deletions boards/stm32f746g-disco/features-shared.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ FEATURES_PROVIDED += periph_spi
FEATURES_PROVIDED += periph_timer
FEATURES_PROVIDED += periph_uart
FEATURES_PROVIDED += periph_usbdev
FEATURES_PROVIDED += periph_usbdev_hs
FEATURES_PROVIDED += periph_usbdev_hs_ulpi
FEATURES_PROVIDED += tinyusb_device
1 change: 1 addition & 0 deletions boards/stm32f7508-dk/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ config BOARD_STM32F7508_DK
select HAS_PERIPH_TIMER
select HAS_PERIPH_UART
select HAS_PERIPH_USBDEV
select HAS_PERIPH_USBDEV_HS
select HAS_PERIPH_USBDEV_HS_ULPI
select HAS_TINYUSB_DEVICE

Expand Down
6 changes: 6 additions & 0 deletions drivers/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,16 @@ endif

ifneq (,$(filter periph_usbdev_hs_ulpi,$(USEMODULE)))
FEATURES_REQUIRED += periph_usbdev_hs_ulpi
USEMODULE += periph_usbdev_hs
endif

ifneq (,$(filter periph_usbdev_hs_utmi,$(USEMODULE)))
FEATURES_REQUIRED += periph_usbdev_hs_utmi
USEMODULE += periph_usbdev_hs
endif

ifneq (,$(filter periph_usbdev_hs,$(USEMODULE)))
FEATURES_REQUIRED += periph_usbdev_hs
endif

ifneq (,$(filter pn532_i2c,$(USEMODULE)))
Expand Down
5 changes: 5 additions & 0 deletions kconfigs/Kconfig.features
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,11 @@ config HAS_PERIPH_USBDEV
help
Indicates that an USBDEV peripheral is present.

config HAS_PERIPH_USBDEV_HS
bool
help
Indicates that the USBDEV peripheral supports High-Speed.

config HAS_PERIPH_USBDEV_HS_UTMI
bool
help
Expand Down
4 changes: 4 additions & 0 deletions sys/include/usb/usbus/cdc/ecm.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ extern "C" {
*
* Used for the transfer of network frames.
*/
#ifndef MODULE_PERIPH_USBDEV_HS
#define USBUS_CDCECM_EP_DATA_SIZE 64
#else
#define USBUS_CDCECM_EP_DATA_SIZE 512
#endif

/**
* @brief Full ethernet frame rounded up to a whole number of transfers
Expand Down

0 comments on commit 6c1de71

Please sign in to comment.