cancel
Showing results for 
Search instead for 
Did you mean: 

BlueCoin RCC configuration issue / BlueCoin board (STEVAL-BCNCS01V1)

ghibli
Associate II

Hi all,

I am trying to implement simple USB-FS communication on a BlueCoin board (STEVAL-BCNCS01V1). I am following the official STM tutorial on USB CDC and referencing the official SW package for BlueCoin.

So, for USB I need PLL source from HSE clock: BlueCoin schematic shows that there is a crystal oscillator @16Mhz (NDK NX2520SA) installed directly on the board, so I configured RCC HSE as Crystal/Ceramic Resonator; the problem is that the function HAL_RCC_OscConfig(&RCC_OscInitStruct) in SystemClock_Config retrieves HAL_TIMEOUT as a result. Timeout value is default at 100ms.

Clock configuration in STM32CubeMX is as suggested in the official USB tutorial:

ghibli_0-1776289461396.png

My current debug configuration has BlueCoin connected via SWD to a NUCLEO-G0B1RE, as suggested in UM2240 (see page 14).

Could you please help me? Am I missing something? Thanks to anybody who can help!

7 REPLIES 7
mƎALLEm
ST Employee

Hello @ghibli and welcome to the ST community, 

I don't have idea about that BlueCoin board but referring to its schematic, it has indeed a crystal on it of 16MHz:

mALLEm_1-1776337325379.png

But from what you shared in the CubeMx screenshot, it seems you are configuring HSE in Bypass mode:

Only one pin is used in this case while you need OSC_IN and OSC_OUT for a crystal.

mALLEm_2-1776337424580.png

So you need to select Crystal/Ceramic Resonator in CubeMx for your case:

mALLEm_3-1776337549887.png

Bypass mode is used for example for crystal oscilators (XO) and not for crystals (XTAL).

PS: in your main.c you've attached, HSE is correctly configured! So that doesn't reflect the CubeMX configuration! which induces to some confisions here.. 

  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
  RCC_OscInitStruct.HSEState = RCC_HSE_ON;
  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;

Hope that helps.

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.

Hi @mƎALLEm, thanks for your feedback and for the welcome!!

The confusion is due to the late hour at which I wrote the post... The screenshot is wrong, please forgive me for that.

Anyway, the correct configuration that you suggested is the one that I definitely tested in main.c file, but still it gets stuck in HAL_RCC_OscConfig for the same reason; the screenshot comes from a previous configuration that I tested (and which did not obviously work...).

Do you know whether I have to set some other configurations in order to have the external oscillator on the board working properly (maybe on ST-Link side)?

Thanks again for your support!

PS: the BlueCoin board is actually a product from ST, more information here. It's a pity that I could not find much documentation or samples about that because it's definitely a very interesting board for prototyping.

mƎALLEm
ST Employee

Hello,

1- You mentioned in a previous post NUCLEO-G0B1RE. So could you please confirm your are debugging on STEVAL-BCNCS01V1 that contains a STM32F446 and not NUCLEO-G0B1RE which contains a STM32G0B1 MCU?

2- Check you have that crystal on your board and that was not unsoldered:

mALLEm_0-1776339553203.png

3- Test if you can use HSI as source clock:

mALLEm_1-1776339611547.png

This is just for test.

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.
ghibli
Associate II

Hi @mƎALLEm, thanks for your feedback. I will try out your points and give a feedback as soon as possible.

ghibli
Associate II

Hi @mƎALLEm, I tested your points. Here are my findings:

1) I confirm, debug is active on STM32F446

2) The oscillator is present on the board

3) If I switch to HSI, this is what I get (I guess USB-FS needs HSE):

ghibli_0-1777101135560.png

Thanks again for your suppport.

Hello,


@ghibli wrote:

3) If I switch to HSI, this is what I get (I guess USB-FS needs HSE):

ghibli_0-1777101135560.png


Because USB needs HSE with an external crystal to work properly in this product.

Forget about USB for now and deactivate it in CubeMx. Create a very simple project and select HSE with a 16MHz  with PLL as clock source. The test is to check whether there is an issue in your hardware.

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.

Hi @mƎALLEm, good suggestion. I set up a simple project which switches LEDs on and off using HSE and a timer and it works fine, so I assume the external oscillator is ok. I attach the project, maybe it can be useful to someone in the community. 

Getting back to the original USB project, I will compare the RCC_CR register to the simple project and check if something is wrong with the configuration.