cancel
Showing results for 
Search instead for 
Did you mean: 

convert STM32F072_EVAL CDC_Standalone at STM32F072B-DISCO doesn't work

holland MICHAEL
Associate II
Posted on October 08, 2017 at 08:07

I don't need any other things except USB and UART, so I remove the stm32f072b_eval.c. I change the target device to 072RB in MDK option tab. I modified usdb_cdc_interface.h usart to uart1 as discovery board.

I also copy from discovery project this to this new project.

0690X00000603u3QAA.jpg

The PC could recognize it, but shows can't start. 

0690X000006048DQAQ.jpg

I use STM32CubeMX generate CDC, there is no issue. I can't figure out where should I modify from the eval cdc code to make it work.

Another thing, may not relate, but strange to me.

In the usbd_cdc_interface.h line 91

&sharpdefine TIMx_FORCE_RESET()               __HAL_RCC_USART3_FORCE_RESET()

&sharpdefine TIMx_RELEASE_RESET()             __HAL_RCC_USART3_RELEASE_RESET()

why timer reset is usart3 reset? I see this in L0 project too.

I start from L0538 disco board, try to convert L073 without success, that one even worse, Even STM32CubeMX generate project has the same result as PC can't start (code 0).

I must miss some fundamental thing, but, where could be wrong? My target is F072. Appreciate suggestions!  

#stm32f072-cdc
2 REPLIES 2
Amel NASRI
ST Employee
Posted on October 09, 2017 at 18:11

Hi

‌,

Try to compare the USART1 configuration with the one generated by CubeMX (pins, DMA configuration, ...).

You can share the .ioc file of the working project, if possible.

Then, regarding this code:

#define TIMx_FORCE_RESET() __HAL_RCC_USART3_FORCE_RESET()#define TIMx_RELEASE_RESET() __HAL_RCC_USART3_RELEASE_RESET()�?�?�?�?

I agree with you that it is wrong and should be:

#define TIMx_FORCE_RESET() __HAL_RCC_TIM3_FORCE_RESET()#define TIMx_RELEASE_RESET() __HAL_RCC_TIM3_RELEASE_RESET()�?�?

-Amel

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.

holland MICHAEL
Associate II
Posted on October 10, 2017 at 05:09

Thank you for the direction. I compare the file from stm32cubemx and track down to one line make the difference.

There is no this line at SystemClock_Config(void) function of the Eval code:  RCC_OscInitStruct.HSI48State = RCC_HSI48_ON .

When I add this line, the PC could identify it successfuly as stm32cubemx generated code.

Another thing you may need to update in the code in usbd_cdc_interface.c line 432:   TimHandle.Init.Prescaler = 84-1;

Probably it is 48-1, not 84.

In general, I appreciate ST's work, so many sample codes, stm32cubemx tools. I can't image how many years we need to figure out everything without these help. Great micro, great tool and great community!