cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L496ZG-NUCLEO-144 X-CUBE-SBSFU using USB_OTG_FS Virtual Com Port instead of YMODEM over UART

GJose.1
Associate

Hello everyone,

Thank you for clicking this post. I am new to the community and ecosystem. Here's my task, I am trying to use the X-CUBE-SBSFU libraries to perform a secure firmware update procedure. I am using the STM32L496ZG-NUCLEO-144 board to test before applying it to our hardware.

There exists the 32L496G discovery project in the XCUBE-SBSFU example projects. I was able to flash the NUCELO board with this and use the project over UART and an FTDI to usb serial adaptor. Great.

Now I want to rewrite the communication layer in the SBSFU example to use the USB_OTG_FS virtual com port using the USB CDC libraries instead of UART.

I have an example project build with the ".ioc" graphical tool where I can successfully print hello world over the virtual com port. I noticed some Middlewares/ST/STM32_USB_Device_Library and USB_DEVICE folders in the hello world project so I copied them into the SBSFU application folder.

I also selected project->properties->MCU GCC Compiler and added the following to the include paths:

"${workspace_loc:/${ProjName}/USB_DEVICE/App}"

"${workspace_loc:/${ProjName}/USB_DEVICE/Target}"

"${workspace_loc:/${ProjName}/Middlewares/ST/STM32_USB_Device_Library/Core/Inc}"

"${workspace_loc:/${ProjName}/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc}"

So that the files and folders I copied into the SBSFU project are linked.

Then I got an error that some PCD calls were not working so I edited the stm32l4xx_hal_conf.h file to include "#define HAL_PCD_MODULE_ENABLED"

I still am getting the following error:

/Applications/STM32CubeIDE.app/Contents/Eclipse/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.macos64_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: USB_DEVICE/Target/usbd_conf.o: in function `USBD_LL_Transmit

/Downloads/STM32CubeExpansion_SBSFU_V2.4.0/Projects/32L496GDISCOVERY/Applications/2_Images/2_Images_SBSFU/SW4STM32/STM32L496G-Discovery_2_Images_SBSFU/Debug/../USB_DEVICE/Target/usbd_conf.c:750: undefined reference to `HAL_PCD_EP_Transmit'

One thing I have noticed is in my 2_Image_SBSFU project, under Drivers/STM32L4XX_HAL_Driver the stm32l4xx_hal_pcd.c files are not showing up.

Any help or guidance would be greatly appreciated.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Paul1
Lead

Attached notes may help

  • We implement VCP by connecting only D+/D-/Gnd to the USB (With resistors to tell it mode for only these pins)
  • Appears as standard Com port, Works with terminal programs (Coolterm, Teraterm...), so you can implement your code on PC/etc.
  • Read the fine print in the notes, and the linked posts
  • usb_vcp_20210520PR.zip

Paul

View solution in original post

4 REPLIES 4
Paul1
Lead

Attached notes may help

  • We implement VCP by connecting only D+/D-/Gnd to the USB (With resistors to tell it mode for only these pins)
  • Appears as standard Com port, Works with terminal programs (Coolterm, Teraterm...), so you can implement your code on PC/etc.
  • Read the fine print in the notes, and the linked posts
  • usb_vcp_20210520PR.zip

Paul

Paul1
Lead
  • Ensure you include appropriate protection on your connector for your application (ESD, etc.)
GJose.1
Associate

@Community member​ Thank you for the resources them, I am reviewing them and integrating that into my application.

Tarun
Associate III

Hi GJose,

How are you doing?

Are you able to finish the task?

I stuck in couple of issues. would you be able to help me?

I'm trying port STM32G071RB to STM32G0B1RE and need to change com layer to usb cdc from uart.

1. The example projects are working as expected but causing issues when I change Symbol to STM32G0B1xx instead STM32G071xx in STM32CubeIDE->Properties->Paths and Symbols tab. The reason I would need to  change is to use USD DRD and its drives code. Here the SBSFU application loading from uart itsself failing and its triggering hard fault after loading UserApplication.