cancel
Showing results for 
Search instead for 
Did you mean: 

USB and compiler problem

Hello

I dont know what is the problem that when I compile my code with Keil, the USB works nicely,

but when I use cubeide compiler, the usb doesnt work. Both codes are generated by cubemx

when the code compiled by cubeide, the usb is recognised, but communication is denied.

I use USB in CDC mode. When the code compiled by keil everythings works.

9 REPLIES 9
Amel NASRI
ST Employee

Hi @Vahid Ajallooeian​ ,

Could you please provide some more details about the issue you are facing:

  • which STM32CubeMX and STM32CubeIDE versions are you using? Generally it is recommended to be aligned with latest available ones.
  • which STM32 device or board you selected?
  • it would be helpful to share the .ioc file to easily reproduce the issue.

-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.

STM32cube and STM32ide both are latest version.

STM32cubeMX V6.0.0. (Don't know if it was with earlier versions.)

STM32cube IDE V1.4.2 (Although the matter was with 1.3.0 till now)

I used different graphic libraries with other peripherals running at the same time. (Stemwin with some bugs, Touchgfx somehow good and LVGL really the best of them till now.) I say the code is okay with keil compiler NO MATTER which graphical library is used (with different optimization levels). But USB doesn't work in CDC mode if CUBEIDE compiler is used. Dont know what is the problem.

Since CUBEIDE is eclipse based, it is preffered.

I use STM32f429IGT6 custom board. (The IC Designers of ST is perfect, unfortunately the board desiger was such an idiot)

The IOC file is attached. Don't now if it is possible to regenerate the problem.

Not looking to wade into this too deeply, but Keil vs GCC, I would focus on code in startup.s and how the stack/heap work.

The USB code uses the heap.

For other latent code issues, turn off optimization and see if functionality changes.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Dear @Amel NASRI​ and @Community member​ 

No matter if no other peripheral is activated, the matter persist. Checked also with IAR, the problem persist. Here is different compilers projects file with IOC for checking sole USB_CDC.

Some easier way to see the matter. You can check it with discovery boards also. I checked with STM32f407vgt DISCOVERY - STM32CUBEIDE - FW-F4 V1.25.0.

I'm a Keil guy, I can't commit resources to chase down issues with IAR, GNU/GCC or CubeMX.​

I'd suggest you output diagnostic informat​ion related to RCC and other peripheral settings. Clocks, peripherals and pins.

Start with the PLL, and the 48 MHz​ clock source going to the USB peripheral.

Unpack the clock settings, keep digging until you can isolate the difference between the working and non-working.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

There are two matters.

First and foremost the codes are identical, even no ; is different.

Second in all cases, the usb is detected in device manager. But in different serial port utilities like puty or serial port monitor or other softwares the port is not able to open if the UC code is compiled with compiler other than KEIL. the clocks seems OK. I think its the compilation time matter.

@Amel NASRI​  Any solution?:crying_face:

To dear whom, it may concern,

Please follow this bug on stm32cubeide.

Attached is the code, regenerate the code with Cubemx, then regenerate the code with Touchgfx, then regenerate the code with Cubemx, and then compile with each of the mentioned compilers and see the BUG.