STM Nucleo F103RB - please read the docs!

STM32F103 Nucleo boards e.g. STM Nucleo F103RB
madias
Posts: 812
Joined: Mon Apr 27, 2015 11:26 am
Location: Vienna, Austria

STM Nucleo F103RB - please read the docs!

Postby madias » Wed May 27, 2015 9:51 pm

Just to remember:
Please read all additional doc's provided in the
STM32F1/variants/nucleo_f103rb/infos_pdfs
folder in the repo.
On many boards the crystal is NOT connected to "main" STM32F103RB MCU and you won't have any luck to get the board working with STM32duino.

Thanks
Matthias

[Roger: Is it okay to make this sticky?]

casemod
Posts: 10
Joined: Tue Jun 23, 2015 1:05 pm

Re: STM Nucleo F103RB - please read the docs!

Postby casemod » Wed Jun 24, 2015 4:04 pm

I believe only the pre-production boards had the RTC and main oscillators.
On standard boards a crystal along with two 15pF and two 0R resistors need to be installed.

It would be interesting tough, to setup the device to use the internal oscillator. This is what mbed uses.

madias
Posts: 812
Joined: Mon Apr 27, 2015 11:26 am
Location: Vienna, Austria

Re: STM Nucleo F103RB - please read the docs!

Postby madias » Wed Jun 24, 2015 5:02 pm

It would be interesting tough, to setup the device to use the internal oscillator. This is what mbed uses.

here you go:
https://github.com/leaflabs/libmaple/bl ... /board.cpp
on line 54

Code: Select all

namespace priv {
static stm32f1_rcc_pll_data pll_data = {RCC_PLLMUL_9};
rcc_clk w_board_pll_in_clk = RCC_CLK_HSI;
rcc_pll_cfg w_board_pll_cfg = {RCC_PLLSRC_HSI_DIV_2, &pll_data};
}

But it never worked for me (ok, I tried it just one or two times). There is no real benefit: Using half speed 36MHZ with the inaccurate internal osc, maybe getting in troubles with SPI,USART or solder two small jumpers. I decided the second option.

jcw
Posts: 170
Joined: Mon Oct 26, 2015 8:16 am

Re: STM Nucleo F103RB - please read the docs!

Postby jcw » Tue Oct 27, 2015 11:41 pm

casemod wrote:I believe only the pre-production boards had the RTC and main oscillators.
On standard boards a crystal along with two 15pF and two 0R resistors need to be installed.

It would be interesting tough, to setup the device to use the internal oscillator. This is what mbed uses.

Indeed - no 8 MHz crystal on my Nucleo F103RB either.

I tried commenting out these three lines, but that doesn't seem to resolve the issue:
https://github.com/rogerclarkmelbourne/ ... #L124-L127

jcw
Posts: 170
Joined: Mon Oct 26, 2015 8:16 am

Re: STM Nucleo F103RB - please read the docs!

Postby jcw » Wed Oct 28, 2015 12:19 am

Commenting out as above, and one extra change is needed to get the clock running without crystal:
https://github.com/rogerclarkmelbourne/ ... up.cpp#L58

Change RCC_PLLSRC_HSE to RCC_PLLSRC_HSI_DIV_2.

The only remaining issue is that now the system clock is 36 iso 72 MHz.
My blink test works, but at the wrong speed, and this is bound to also mess up serial I/O.

Not sure where to bump that PLL multiplier to twice the current value...

User avatar
RogerClark
Posts: 5470
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: STM Nucleo F103RB - please read the docs!

Postby RogerClark » Wed Oct 28, 2015 12:54 am

I made some changes a while back so that other clock frequencies could be used, but I dont think I setup for 36Mhz as this is not a speed that supports USB.

On the STM32 the only valid clock's that can also run USB are 72 and 48 because the USB prescaler only has 2 values ,1.5 and 1.0 (GD32 has 4 values so can run at 48,72,96 or 120 and still have USB)

Also the STM32F1 code presumes a 8Mhz clock, and all the PLL configs are based on that value

It would be possible to change the code so that a F_CLOCK was defined and appropriate changes made, but it would require changes to quite a few places.

jcw
Posts: 170
Joined: Mon Oct 26, 2015 8:16 am

Re: STM Nucleo F103RB - please read the docs!

Postby jcw » Wed Oct 28, 2015 11:38 am

I'm not very familiar with the STM32 clock design. My hope would be that we can make the µC run at 72 MHz off the internal oscillator, but there is no option to use the PLL directly at ÷1, it only has an option ÷2 for HSI. So probably some other multiplier or divider needs to be adjusted to end up with a 72 MHz system frequency again. Once it's back to 72 MHz, other peripherals should be fine too

Note that USB is not so important on a Nucleo board (a USART is connected to the on-board ST-Link), and the internal RC clock is probably not stable enough for it anyway.

It's definitely doable, as the Nucleo's usually run at 72 MHz.

The proper settings can no doubt be found in other projects, such as ChibiOS.

jcw
Posts: 170
Joined: Mon Oct 26, 2015 8:16 am

Re: STM Nucleo F103RB - please read the docs!

Postby jcw » Thu Oct 29, 2015 1:56 pm

Ehm, no - as far as I can tell, the ST32F103 can't run at 72 MHz off its internal clock. Maximum would be 64 MHz.

I've got a setup running properly at 48 Mhz, including the serial port (usable through the on-board ST-Link v2.1).
Can submit a pull request for it if needed - IMO it's best to have the F103RB Nucleo work in stock non-xtal mode.

Another change worth considering: Serial is USB on the Nucleo, which is not attached. It might be less confusing
to have the default "Serial" instance be Serial1, which is connected by default (well, at least TX is).

(with these changes, the Nucleo F103RB becomes quite a useful setup: all-in one upload, serial, and debugging)

User avatar
RogerClark
Posts: 5470
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: STM Nucleo F103RB - please read the docs!

Postby RogerClark » Thu Oct 29, 2015 7:58 pm

Hi jcw

The Nucleo has been a constant source of problems ;-)

I had to add all sorts of extra complication to the core etc to support it.

Re:USB serial

I think Serial should be mapped to the UART connected to the STLINK, there is mapping / setup in its variant files (sorry cant remember which board file it is, but its fairly obvious if you take a quick look ;-)

Re:Use internal xtal

we already have people using it with an external xtal, so if we have internal osc, it needs to be an option via a menu in boards.txt I think.

BTW.
@madias is the main man for this board. I dont have one.
(I have a Nucleo F3 but never used it)

jcw
Posts: 170
Joined: Mon Oct 26, 2015 8:16 am

Re: STM Nucleo F103RB - please read the docs!

Postby jcw » Thu Oct 29, 2015 8:35 pm

Odd - for me, the Nucleos have been the most consistent dev boards (not that I've done very much with 'em).
All the different boards I tried with ChibiOS worked out of the box. A pretty nice way to compare chips.
Uploads work both the MBED drag-file way, and via st-flash. Serial bridging. And gdb support via st-util.

Well, ok, maybe both with and without external XTAL should be supported, but the one without is really the one as shipped today.


Return to “STM Nucleo boards”

Who is online

Users browsing this forum: No registered users and 1 guest