cancel
Showing results for 
Search instead for 
Did you mean: 

STM32f070F6 with CDC HAL libs?

David Martins
Senior
Posted on May 10, 2018 at 16:32

Hi.

I'm trying to upgrade an existing PCB (so changing the MCU is not an option for now).

The MCU used so far is the STM32f070F6. The MCU has USB peripheral and I want to use this as VCOM.

When I generate the code with CubeMX and try to compile (with absolutely no code change), I get the message that the MCU do not have enough RAM: '/arm-none-eabi/bin/ld.exe: region` RAM 'overflowed by 1760 bytes'.

I have already changed the CDC buffers to a size of 40 bytes (maximum of what I want to transfer), but I still have a similar error.

Is there an example with this MCU in which the USB peripheral is used?

Thank you.

#cubemx #usbvcom #stm32f070f6 #stm32f070
15 REPLIES 15
Posted on May 16, 2018 at 13:17

Hi David,

Change the APP_RX_DATA_SIZE and the APP_TX_DATA_SIZE to 64 solve the problem.

Can you confirm that it is

a CubeMX bug?

-> I will share this internally for further check and come back to you with an answer ASAP.

  • Please have a look on AN4879 application note, chapter 'Hardware guidelines for USB implementation'.

Khouloud.

Posted on May 16, 2018 at 13:26

I see that your oscillator is 16MHz but the value in the clock configuration is 8MHz:

0690X0000060KnPQAU.png

See HSE_VALUE macro.

Posted on May 16, 2018 at 13:54

In fact a negligent mistake from me.

I tested momentarily with an 8MHz crystal to see if there were any changes.

When I put the 16MHz crystal back on again, I did not see it oscillates.

Now when I read the post I went to see and itnot

oscillate

... because the crystal was badly welded.

https://s7.postimg.cc/ltkwp7xgr/Capturar.png

Now the crystal is oscillating again.

But it still does not detect anything on the USB ....

Posted on May 16, 2018 at 14:05

Problem solved!

When regenerating the configuration with CubeMX, I had to make an update.

I compiled the code and flashed the MCU. I turned on the USB and it worked right away.

Please confirm if the

APP_RX_DATA_SIZE and the APP_TX_DATA_SIZE with 2048

 is

a CubeMX bug?

The CubeMX do not change these values...

Thank you all!

Posted on May 17, 2018 at 10:06

Hi David,

Happy to hear that your issue is solved!

Regarding 'APP_RX_DATA_SIZE' and 'APP_TX_DATA_SIZE' values, they are configured by STM32CubeMX tool just the first time; Then it's up to user to redefine and/or remove those define based on his needs (the generated code is placed in dedicated section between: 

/* USER CODE BEGIN PRIVATE_DEFINES */ and /* USER CODE END PRIVATE_DEFINES */; thus it's no longer modified by the tool).

However, I have highlighted your point to our CubeMX team and one of our experts will answer you ASAP.

Khouloud.

Nawres GHARBI
ST Employee
Posted on May 18, 2018 at 10:44

Hi David, 

The user tags have been kept for compatibility with old project where the RX and TX buffer size weren't generated bu CubeMX. 

2048 will never be compiled as your chip is of 6KByte RAM (0x1800), you have to set a lower value that fits in your RAM