AnsweredAssumed Answered

Bug report: USB CDC Template and CubeMX code generation

Question asked by h..dino on Dec 22, 2015
Latest reply on Jan 28, 2016 by Amel N
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 ------------------------------------------------------------------*/
#include "USBD_CDC.h"
#include "usbd_desc.h"
#include "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?

Outcomes