Skip to content

Compilation error when using USB STM32L152CBT6 #1510

Closed
@ghost

Description

Describe the bug
Compilation error when making USB support. I tried to set different UART and USB settings, in all cases I get a compilation error. I need USB to exchange data via SERIAL.

To Reproduce
Test sketch:

int sensorValue = 100;

void setup() {
  Serial.begin(9600);
}

void loop() {
  Serial.println(sensorValue);
  delay(10);
}

Steps to reproduce the behavior:
The microcontroller is connected via STLink (SWD). Opening any sketch, trying to configure the UART over USB. The compilation runs without errors only if USB support is disabled. In all other cases, the compilation will cause errors. I've tried different UART and USB settings - compilation throws errors in all cases.

Expected behavior
I need the UART to work via USB

Screenshots
https://drive.google.com/file/d/18pP4FPUUW-Az42YfIWwL9xw_dm9VwKuM/view?usp=sharing
https://drive.google.com/file/d/1mmg1MyJKM7QSyCB9ZK3yEKpF1NR0DZWn/view?usp=sharing

Desktop (please complete the following information):

  • OS: Windows 7 x64
  • Arduino IDE version: 1.8.13
  • STM32 core version: 2.0.0
  • Tools menu settings if not the default: Different SERIAL and USB settings
  • Upload method: SWD

Board (please complete the following information):

  • Name: generic STM32L152CBT6
  • Hardware Revision: --
  • Extra hardware used if any: --

Additional context
Error log:

In file included from C:\Users\�����\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.0.0\cores\arduino/stm32/PinNames.h:4,
                 from C:\Users\�����\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.0.0\cores\arduino/stm32/pinmap.h:22,
                 from C:\Users\�����\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.0.0\cores\arduino/stm32/PeripheralPins.h:34,
                 from C:\Users\�����\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.0.0\cores\arduino/stm32/analog.h:44,
                 from C:\Users\�����\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.0.0\cores\arduino/board.h:8,
                 from C:\Users\�����\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.0.0\cores\arduino/wiring.h:41,
                 from C:\Users\�����\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.0.0\cores\arduino/Arduino.h:36,
                 from C:\Users\�����\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.0.0\variants\STM32L1xx\L100C6Ux(A)_L151C(6-8-B)(T-U)x(A)_L152C(6-8-B)(T-U)x(A)\PeripheralPins.c:22:
C:\Users\�����\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.0.0\variants\STM32L1xx\L100C6Ux(A)_L151C(6-8-B)(T-U)x(A)_L152C(6-8-B)(T-U)x(A)\PeripheralPins.c:215:58: error: 'GPIO_AF10_USB' undeclared here (not in a function); did you mean 'GPIO_AF0_SWJ'?
  215 |   {PA_11, USB, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF10_USB)}, // USB_DM
      |                                                          ^~~~~~~~~~~~~
C:\Users\�����\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.0.0\cores\arduino/stm32/PinNamesTypes.h:83:29: note: in definition of macro 'STM_PIN_DEFINE'
   83 |                           ((AFNUM & STM_PIN_AFNUM_MASK) << STM_PIN_AFNUM_SHIFT))
      |                             ^~~~~
C:\Users\�����\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.0.0\variants\STM32L1xx\L100C6Ux(A)_L151C(6-8-B)(T-U)x(A)_L152C(6-8-B)(T-U)x(A)\PeripheralPins.c:215:16: note: in expansion of macro 'STM_PIN_DATA'
  215 |   {PA_11, USB, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF10_USB)}, // USB_DM
      |                ^~~~~~~~~~~~
exit status 1
Ошибка компиляции для платы Generic STM32L1 series.

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions