Skip to content

Commit 2d7d107

Browse files
authored
Merge pull request #2955 from hathach/fix-dwc2-issue
Work around for esp32s3 racing/timing issue with macos
2 parents 880aae4 + 786aa2c commit 2d7d107

File tree

8 files changed

+17
-21
lines changed

8 files changed

+17
-21
lines changed

.circleci/config2.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ commands:
114114
name: Build
115115
command: |
116116
if [ << parameters.toolchain >> == esp-idf ]; then
117-
docker run --rm -v $PWD:/project -w /project espressif/idf:v5.3.1 python tools/build.py << parameters.family >>
117+
docker run --rm -v $PWD:/project -w /project espressif/idf:v5.3.2 python tools/build.py << parameters.family >>
118118
else
119119
# Toolchain option default is gcc
120120
if [ << parameters.toolchain >> == arm-clang ]; then

.github/actions/setup_toolchain/action.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ inputs:
44
toolchain:
55
description: 'Toolchain name'
66
required: true
7-
toolchain_version:
8-
description: 'Toolchain version'
9-
required: false
107

118
outputs:
129
build_option:
@@ -27,7 +24,6 @@ runs:
2724
uses: ./.github/actions/setup_toolchain/espressif
2825
with:
2926
toolchain: ${{ inputs.toolchain }}
30-
toolchain_version: ${{ inputs.toolchain_version }}
3127

3228
- name: Get Toolchain URL
3329
if: >-

.github/actions/setup_toolchain/espressif/action.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ inputs:
66
required: true
77
toolchain_version:
88
description: 'Toolchain version'
9-
required: true
9+
required: false
10+
default: 'v5.3.2'
1011

1112
runs:
1213
using: "composite"
@@ -39,3 +40,9 @@ runs:
3940
du -sh $DOCKER_ESP_IDF
4041
docker load --input $DOCKER_ESP_IDF
4142
shell: bash
43+
44+
- name: Tag Local Image
45+
run: |
46+
docker tag espressif/idf:${{ inputs.toolchain_version }} espressif/idf:tinyusb
47+
docker images
48+
shell: bash

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ jobs:
118118
runs-on: [self-hosted, Linux, X64, hifiphile]
119119
env:
120120
BUILD_ARGS: ${{ join(fromJSON(needs.set-matrix.outputs.json)['arm-iar'], ' ') }}
121-
# IAR_LMS_BEARER_TOKEN: ${{ secrets.IAR_LMS_BEARER_TOKEN }}
121+
IAR_LMS_BEARER_TOKEN: ${{ secrets.IAR_LMS_BEARER_TOKEN }}
122122
steps:
123123
- name: Clean workspace
124124
run: |

.github/workflows/build_util.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ jobs:
4141
uses: ./.github/actions/setup_toolchain
4242
with:
4343
toolchain: ${{ inputs.toolchain }}
44-
toolchain_version: 'v5.3.1'
4544

4645
- name: Get Dependencies
4746
uses: ./.github/actions/get_deps
@@ -61,7 +60,7 @@ jobs:
6160
- name: Build
6261
run: |
6362
if [ "${{ inputs.toolchain }}" == "esp-idf" ]; then
64-
docker run --rm -v $PWD:/project -w /project espressif/idf:v5.3.1 python tools/build.py ${{ matrix.arg }}
63+
docker run --rm -v $PWD:/project -w /project espressif/idf:tinyusb python tools/build.py ${{ matrix.arg }}
6564
else
6665
python tools/build.py -s ${{ inputs.build-system }} ${{ steps.setup-toolchain.outputs.build_option }} ${{ steps.set-one-per-family.outputs.build_option }} ${{ matrix.arg }}
6766
fi

.github/workflows/hil_test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ jobs:
9494
hil-hfp:
9595
if: github.repository_owner == 'hathach'
9696
runs-on: [self-hosted, Linux, X64, hifiphile]
97-
#env:
98-
# IAR_LMS_BEARER_TOKEN: ${{ secrets.IAR_LMS_BEARER_TOKEN }}
97+
env:
98+
IAR_LMS_BEARER_TOKEN: ${{ secrets.IAR_LMS_BEARER_TOKEN }}
9999
steps:
100100
- name: Clean workspace
101101
run: |

hw/bsp/espressif/boards/family.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -175,20 +175,14 @@ bool usb_init(void) {
175175
// maybe we can use USB_OTG_MODE_DEFAULT and switch using dwc2 driver
176176
#if CFG_TUD_ENABLED
177177
.otg_mode = USB_OTG_MODE_DEVICE,
178-
.otg_speed = BOARD_TUD_RHPORT ? USB_PHY_SPEED_HIGH : USB_PHY_SPEED_FULL,
179178
#elif CFG_TUH_ENABLED
180179
.otg_mode = USB_OTG_MODE_HOST,
181-
.otg_speed= BOARD_TUH_RHPORT ? USB_PHY_SPEED_HIGH : USB_PHY_SPEED_FULL,
182180
#endif
181+
// https://github.com/hathach/tinyusb/issues/2943#issuecomment-2601888322
182+
// Set speed to undefined (auto-detect) to avoid timinng/racing issue with S3 with host such as macOS
183+
.otg_speed = USB_PHY_SPEED_UNDEFINED,
183184
};
184185

185-
// OTG IOs config
186-
// const usb_phy_otg_io_conf_t otg_io_conf = USB_PHY_SELF_POWERED_DEVICE(config->vbus_monitor_io);
187-
// if (config->self_powered) {
188-
// phy_conf.otg_io_conf = &otg_io_conf;
189-
// }
190-
// ESP_RETURN_ON_ERROR(usb_new_phy(&phy_conf, &phy_hdl), TAG, "Install USB PHY failed");
191-
192186
usb_new_phy(&phy_conf, &phy_hdl);
193187

194188
return true;

src/portable/nxp/khci/dcd_khci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ void dcd_int_handler(uint8_t rhport)
565565

566566
if (is & USB_ISTAT_SOFTOK_MASK) {
567567
KHCI->ISTAT = USB_ISTAT_SOFTOK_MASK;
568-
dcd_event_bus_signal(rhport, DCD_EVENT_SOF, true);
568+
dcd_event_sof(rhport, tu_u16(KHCI->FRMNUMH, KHCI->FRMNUML), true);
569569
}
570570

571571
if (is & USB_ISTAT_STALL_MASK) {

0 commit comments

Comments
 (0)