Page 1 of 2
Serial over USB driver STM32L0xx
Posted: Fri Jun 30, 2017 6:21 pm
by marcoferd
Hi,
I'm developing an application based on a board integrating the MCU STM32L052K8 and i need to build a USB to SPI bridge. Are there any example codes using the Serial over USB driver (USB CDC) running on MCU belonging to STM32L0 family?
Thanks in advantage,
Marco Ferdinandi
Re: Serial over USB driver STM32L0xx
Posted: Sat Jul 01, 2017 7:23 am
by Giovanni
Hi,
There isn't one but all USB demos are the same, you may start from the F0 demo then change the paths in the makefile to point to L0 components.
Giovanni
Re: Serial over USB driver STM32L0xx
Posted: Mon Jul 03, 2017 11:04 am
by marcoferd
Hi,
thanks for the answer. Since I have a NUCLEO-F401RE and there is the F4xx demo for USB-CDC, I'm trying to start from it in order to make the porting for the STM32L0. First of all, I'm trying to test the demo on the Nucleo STM32F401RE after that I've changed the board pointed by the ChibiStudio project, but it seems not working properly. Connecting the USB to my PC nothing happens: the O.S. doesn't detect any USB and/or COM. What problem could I have with my demo? Should I change something else in the project files?
Thanks in advantage,
Marco Ferdinandi
Re: Serial over USB driver STM32L0xx
Posted: Mon Jul 03, 2017 12:37 pm
by Giovanni
Hi,
F401 has a different USB, it requires more changes. It is better if you start from L0 or F3.
Giovanni
Re: Serial over USB driver STM32L0xx
Posted: Mon Jul 03, 2017 3:58 pm
by marcoferd
Hi,
I have started from the driver STM32F0xx-USB_CDC but i still have problems. Following I list all the steps:
-I have made the necessary changes in debug configurations;
-I have changed the pointed board (replacing with ST_NUCLEO64_L073RZ );
-I have changed the pointed files in the make file;
-I have overwritten the mcuconf.h file with another one, taken from an RT-STM32L073RZ existing project;
-I have added the following code to the mcuconf.h :
Code: Select all
/*
* USB driver system settings.
*/
#define STM32_USB_USE_USB1 TRUE
#define STM32_USB_LOW_POWER_ON_SUSPEND FALSE
#define STM32_USB_USB1_HP_IRQ_PRIORITY 1
#define STM32_USB_USB1_LP_IRQ_PRIORITY 2
Now I'm receiving the following error:
C:\ChibiStudio\chibios176/os/hal/ports/STM32/LLD/TIMv1/hal_st_lld.c:135:2: error: #error "TIM21 is not a 32bits timer"What am I wrong? Is there something that I haven't still done?
Thanks in advantage,
Marco Ferdinandi
Re: Serial over USB driver STM32L0xx
Posted: Mon Jul 03, 2017 4:08 pm
by RoccoMarco
Hi Marco,
I think that you have wrongly edited mcuconf.h
Maybe you have made a typo in this line
and most likely you have written
Re: Serial over USB driver STM32L0xx
Posted: Mon Jul 03, 2017 4:27 pm
by marcoferd
Hi,
I have solved the error by setting the CH_CGF_ST_RESOLUTION to 16 in the chconf.h file (it was set to 32). Now there aren't any errors but when I connect the USB to the PC i receive the windows 43 error code (Windows has stopped this device because it has reported problems. (Code 43)).
How can I fix it?
Thanks in advantage,
Marco Ferdinandi
Re: Serial over USB driver STM32L0xx
Posted: Mon Jul 03, 2017 4:35 pm
by marcoferd
Hi Rocco,
I had the problem you say. I have set
but the problem still exist and I need to set the CH_CFG_ST_RESOLUTION from 32 to 16.
Finally, I still receive the same error: windows 43 error code (Windows has stopped this device because it has reported problems. (Code 43)). Device Descriptor Request Failed.
Thanks,
Marco
Re: Serial over USB driver STM32L0xx
Posted: Mon Jul 03, 2017 4:59 pm
by RoccoMarco
Which demo are you using as starting demo? I was sure we was talking about stm32f401 were tim2 is a 32bit timer.
Re: Serial over USB driver STM32L0xx
Posted: Mon Jul 03, 2017 5:06 pm
by marcoferd
Hi Rocco,
I was starting from STM32F401RE since I have a physical board, but Giovanni said that its more complicated than starting from F0. For this reason I'm doing the porting of the demo STM32F0xx-USB_CDC for the ST_NUCLEO64_L073RZ.
Thanks,
Marco