Skip to content

Commit 8159b67

Browse files
committed
2 parents 9ddbdb3 + 8834ae2 commit 8159b67

4 files changed

Lines changed: 35 additions & 15 deletions

File tree

.github/actions/pio-build/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ ENV LANG C.UTF-8
55
ENV LC_ALL C.UTF-8
66

77
# Install prerequisites
8-
RUN apt-get update && apt-get install -y git python3 python3-pip wget
8+
RUN apt-get --quiet=2 update && apt-get install --quiet=2 --assume-yes git python3 python3-pip wget
99

1010
# Install PlatformIO
11-
RUN pip3 install -U platformio
11+
RUN pip3 install --quiet --upgrade platformio
1212
CMD /bin/bash
1313

1414
# Copies your code file from your action repository to the filesystem path `/` of the container
Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
1-
#!/bin/bash -x
1+
#!/bin/bash
22

3-
CMSIS_VERSION=$1
4-
CMSIS_ARCHIVE=CMSIS-${CMSIS_VERSION}.tar.bz2
3+
readonly CMSIS_VERSION="$1"
4+
readonly CMSIS_ARCHIVE="CMSIS-${CMSIS_VERSION}.tar.bz2"
55

66
# Install the development version of ststm32 platform
7-
platformio platform install https://github.com/platformio/platform-ststm32.git
8-
7+
platformio platform install "https://github.com/platformio/platform-ststm32.git" || {
8+
exit 1
9+
}
910
# Prepare framework for CI
10-
python3 -c "import json; import os; fp=open(os.path.expanduser('~/.platformio/platforms/ststm32/platform.json'), 'r+'); data=json.load(fp); data['packages']['framework-arduinoststm32']['version'] = '*'; fp.seek(0); fp.truncate(); json.dump(data, fp); fp.close()"
11-
12-
ln -sf $GITHUB_WORKSPACE $HOME/.platformio/packages/framework-arduinoststm32
11+
python3 -c "import json; import os; fp=open(os.path.expanduser('~/.platformio/platforms/ststm32/platform.json'), 'r+'); data=json.load(fp); data['packages']['framework-arduinoststm32']['version'] = '*'; fp.seek(0); fp.truncate(); json.dump(data, fp); fp.close()" || {
12+
exit 1
13+
}
14+
ln --symbolic "$GITHUB_WORKSPACE" "$HOME/.platformio/packages/framework-arduinoststm32" || {
15+
exit 1
16+
}
1317
# Download and unpack CMSIS package
14-
wget https://github.com/stm32duino/ArduinoModule-CMSIS/releases/download/$CMSIS_VERSION/CMSIS-$CMSIS_VERSION.tar.bz2
15-
tar -xvjf CMSIS-$CMSIS_VERSION.tar.bz2
16-
cd $GITHUB_WORKSPACE/CI/build/
18+
wget --no-verbose "https://github.com/stm32duino/ArduinoModule-CMSIS/releases/download/$CMSIS_VERSION/$CMSIS_ARCHIVE" || {
19+
exit 1
20+
}
21+
tar --extract --bzip2 --file="$CMSIS_ARCHIVE" || {
22+
exit 1
23+
}
24+
cd "$GITHUB_WORKSPACE/CI/build/" || {
25+
exit 1
26+
}
1727
python3 platformio-builder.py --board=blackpill_f103c8 --board=remram_v1
1828

1929
exit $?

cores/arduino/stm32/usb/usbd_conf.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
#else
2929
/* Private typedef -----------------------------------------------------------*/
3030
/* Private define ------------------------------------------------------------*/
31+
#if !defined(USBD_VBUS_DETECTION_ENABLE)
32+
#define VBUS_SENSING DISABLE
33+
#else
34+
#define VBUS_SENSING ENABLE
35+
#endif
3136

3237
/* Private macro -------------------------------------------------------------*/
3338
/* Private variables ---------------------------------------------------------*/
@@ -479,14 +484,14 @@ USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev)
479484
g_hpcd.Init.phy_itface = PCD_PHY_ULPI;
480485
#endif
481486
g_hpcd.Init.speed = PCD_SPEED_HIGH;
482-
g_hpcd.Init.vbus_sensing_enable = ENABLE;
487+
g_hpcd.Init.vbus_sensing_enable = VBUS_SENSING;
483488
g_hpcd.Init.use_external_vbus = DISABLE;
484489
#else /* USE_USB_FS */
485490
#ifdef USB_OTG_FS
486491
g_hpcd.Instance = USB_OTG_FS;
487492
g_hpcd.Init.use_dedicated_ep1 = DISABLE;
488493
g_hpcd.Init.dma_enable = DISABLE;
489-
g_hpcd.Init.vbus_sensing_enable = DISABLE;
494+
g_hpcd.Init.vbus_sensing_enable = VBUS_SENSING;
490495
g_hpcd.Init.use_external_vbus = DISABLE;
491496
#else
492497
g_hpcd.Instance = USB;

variants/board_template/variant.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ extern "C" {
157157
// SD Read/Write timeout, default value defined in STM32SD library
158158
//#define SD_DATATIMEOUT x
159159

160+
// USB Vbus sensing. Require to have Vbus pin connected to Vbus signal.
161+
// Warning, pin is different depending on FullSpeed or High Speed mode used
162+
// See AN4879 https://www.st.com/content/st_com/en/search.html#q=AN4879-t=resources-page=1
163+
//#define USBD_VBUS_DETECTION_ENABLE
164+
160165
#ifdef __cplusplus
161166
} // extern "C"
162167
#endif

0 commit comments

Comments
 (0)