cancel
Showing results for 
Search instead for 
Did you mean: 

Bug report: USB CDC Template and CubeMX code generation

work
Associate II
Posted on December 22, 2015 at 10:18

Hi,

I just created a new project for a STM32F103 MCU using CubeMX 4.12.0 and the firmware package 1.2.0 for the F1 family and came across two little issues.

In Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c starting at line 61:

/* Includes ------------------------------------------------------------------*/

&sharpinclude ''USBD_CDC.h''

&sharpinclude ''usbd_desc.h''

&sharpinclude ''usbd_ctlreq.h''

USBD_CDC.h is written in captial letters while the file is named usbd_cdc.h. Not a problem for Windows users, but on systems taking care of capitalisation it doesn't compile.

Then, in CubeMX I set SYS/Debug to Serial-Wire since I want to use SWD. The generated Src/stm32f1xx_hal_msp.c looked like this (I omitted the user code parts):

void HAL_MspInit(void)

{

  __HAL_RCC_AFIO_CLK_ENABLE();

 

  HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);

 

  /* System interrupt init*/

  /* SysTick_IRQn interrupt configuration */

  HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);

 

    /**NOJTAG: JTAG-DP Disabled and SW-DP Enabled  

    */

  __HAL_AFIO_REMAP_SWJ_NOJTAG();

}

In order to get SWD to work I had to delete the last line:

__HAL_AFIO_REMAP_SWJ_NOJTAG();

Is this a bug or do you have to make another setting in CubeMX apart from choosing Serial-Wire as debug option?

#!stm32-!cubemx
3 REPLIES 3
Posted on December 23, 2015 at 11:34

Hi h..dino,

1-Concerning the capital letter ''USBD_CDC.h'' in usb_cdc.c file, the issue is already fixed in the STM32_USB_Device_Library that will be released soon.

2-The function __HAL_AFIO_REMAP_SWJ_NOJTAG() sets correctly the SWJ_CFG[2:0] field of register AFIO_MAPR. Besides, I debug a STM32F103RB-Nucleo board  and the serial wire woks fine.

Maybe you have changed the configuration of AFIO_MAPR?

-Shahrzad-

Rob.Riggs
Senior
Posted on January 28, 2016 at 03:43

Will this same USBD_CDC.H bug be fixed in the STM32CubeF3 firmware package as well?  I have the November update (1.4.0) and this defect exists there as well.

Amel NASRI
ST Employee
Posted on January 28, 2016 at 09:02

Hi riggs.rob,

Yes the fix will be applied to all FW packages. But it will be available only in coming releases.

-Mayla-

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.