soc: stm32h755xx: STM32H755II fails to enumerate USB CDC on M4 core
priority: lowarea: USBplatform: STM32
### Describe the bug
Currently attempting to port an existing project using STM32H755II to Zephyr RTOS, having used Zephyr extensively in other projects.
For our previous firmware revision, we have implemented the USB CDC on the ARM Cortex M4; when migrating to Zephyr, the USB CDC fails to enumerate.
However, when putting the USB CDC on the M7 core, running `dmesg` and `lsusb` verifies that the USB CDC is only available on the M7 core. **No logs are created when attempting to run the USB CDC on the M4 core.**
```
(sdi-zephyr-workspace) kurtisl@host:~/Documents/repos/sdi-zephyr-workspace/fw-repo/app$ sudo dmesg
[ 6509.935215] usb 3-3: new full-speed USB device number 86 using xhci_hcd
[ 6510.060153] usb 3-3: New USB device found, idVendor=dead, idProduct=beef, bcdDevice= 4.04
[ 6510.060158] usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 6510.060159] usb 3-3: Product: Test Project
[ 6510.060160] usb 3-3: Manufacturer: Sarcomere Dynamics Inc.
[ 6510.060161] usb 3-3: SerialNumber: 3833373630335113002C0049
[ 6510.061612] cdc_acm 3-3:1.0: ttyACM0: USB ACM device
(sdi-zephyr-workspace) kurtisl@host:~/Documents/repos/sdi-zephyr-workspace/fw-repo/app$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 003: ID 8087:0026 Intel Corp. AX201 Bluetooth
Bus 003 Device 086: ID dead:beef Sarcomere Dynamics Inc. Test Project
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
```
### Regression
- [ ] This is a regression.
### Steps to reproduce
For a given USB CDC instance:
```
zephyr_udc0: &usbotg_fs {
pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12>;
pinctrl-names = "default";
status = "okay";
project_cdc: project_cdc {
compatible = "zephyr,cdc-acm-uart";
};
};
```
Set the chosen ` zephyr,console` and `zephyr,shell-uart` to `&project_cdc` for the desired core (M4 vs M7).
Enable any Kconfigs related to USB logging for the core assigned to USB CDC.
### Relevant log output
```shell
```
### Impact
Showstopper – Prevents release or major functionality; system unusable.
### Environment
- OS: Ubuntu 24.04.4 LTS
- Zephyr version: main@d7a825dc89201dff5389b66bf35bd733bef7c936
- Hardware: Custom board built on STM32H755II
### Additional Context
# Devicetree
### `project_stm32h755xx.dtsi`
```
#include <st/h7/stm32h755iikx-pinctrl.dtsi>
&rcc {
d1cpre = <1>;
hpre = <2>;
d1ppre = <2>;
d2ppre1 = <2>;
d2ppre2 = <2>;
d3ppre = <2>;
};
&pwr {
power-supply = "ldo";
};
&mailbox {
status = "okay";
};
```
### `project_stm32h755xx_m7.dts`
```
/dts-v1/;
#include <st/h7/stm32h755Xi_m7.dtsi>
#include "project_stm32h755xx.dtsi"
/ {
model = "Project (M7)";
compatible = "sdi,project";
chosen {
zephyr,dtcm = &dtcm;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};
};
&clk_lsi {
status = "okay";
};
&clk_hsi48 {
status = "okay";
};
&clk_hse {
clock-frequency = <DT_FREQ_M(25)>;
status = "okay";
};
&pll {
div-m = <5>;
mul-n = <100>;
div-p = <2>;
div-q = <8>;
div-r = <5>;
clocks = <&clk_hse>;
status = "okay";
};
&pll2 {
div-m = <5>;
mul-n = <50>;
div-p = <5>;
div-q = <5>;
div-r = <2>;
clocks = <&clk_hse>;
status = "okay";
};
&pll3 {
div-m = <5>;
mul-n = <48>;
div-p = <5>;
div-q = <5>;
div-r = <4>;
clocks = <&clk_hse>;
status = "okay";
};
&rcc {
clocks = <&pll>;
clock-frequency = <DT_FREQ_M(250)>;
};
```
### `project_stm32h755xx_m4.dts`
```
/dts-v1/;
#include <st/h7/stm32h755Xi_m4.dtsi>
#include "project_stm32h755xx.dtsi"
/ {
model = "Project (M4)";
compatible = "sdi,project";
chosen {
zephyr,console = &project_cdc;
zephyr,shell-uart = &project_cdc;
zephyr,sram = &sram1;
zephyr,flash = &flash1;
};
};
&rcc {
clock-frequency = <DT_FREQ_M(125)>;
};
zephyr_udc0: &usbotg_fs {
pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12>;
pinctrl-names = "default";
status = "okay";
project_cdc: project_cdc {
compatible = "zephyr,cdc-acm-uart";
};
};
```
# Kconfig
The following Kconfigs are enabled on the core being actively used for USB CDC:
```
CONFIG_SERIAL=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_USB_DEVICE_STACK_NEXT=y
CONFIG_CDC_ACM_SERIAL_INITIALIZE_AT_BOOT=y
CONFIG_CDC_ACM_SERIAL_VID=0xDEAD
CONFIG_CDC_ACM_SERIAL_PID=0xBEEF
CONFIG_CDC_ACM_SERIAL_MANUFACTURER_STRING="Sarcomere Dynamics Inc."
CONFIG_CDC_ACM_SERIAL_PRODUCT_STRING="Test Product"
# CONFIG_CDC_ACM_SERIAL_ENABLE_AT_BOOT=n
CONFIG_CDC_ACM_SERIAL_SELF_POWERED=y
CONFIG_UART_CONSOLE_LOG_LEVEL_OFF=y
CONFIG_UART_LOG_LEVEL_OFF=y
CONFIG_LOG=y
CONFIG_USBD_LOG_LEVEL_ERR=y
CONFIG_UDC_DRIVER_LOG_LEVEL_ERR=y
CONFIG_USBD_CDC_ACM_LOG_LEVEL_OFF=y
CONFIG_APP_HOST_LOG_LEVEL_DBG=y
CONFIG_LOG_PROCESS_THREAD_STARTUP_DELAY_MS=5000
```
When creating the custom board definition, the following references were used:
* `nucleo_h755zi_q`
* `stm32h745i_disco`
* `stm32h747i_disco`
5 条评论