STM Nucleo F103RB – please read the docs!

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
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
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
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};
}

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.


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…


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


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


madias
Thu Oct 29, 2015 9:09 pm
RogerClark wrote:
BTW.
@madias is the main man for this board. I dont have one.
(I have a Nucleo F3 but never used it)

jcw
Thu Oct 29, 2015 9:56 pm
What about people who don’t solder but just connect jumpers and breadboards?

I’m sorry, but I don’t understand why Nucleo’s are getting such a bad rap.

(as for no silk screen: use a diagram on-screen or printout on your desk?)


mrburnette
Thu Oct 29, 2015 10:16 pm
jcw wrote:What about people who don’t solder but just connect jumpers and breadboards?

I’m sorry, but I don’t understand why Nucleo’s are getting such a bad rap.

(as for no silk screen: use a diagram on-screen or printout on your desk?)


jcw
Thu Oct 29, 2015 11:17 pm
Heh, well, it’s easy to forget. I routinely solder TSSOP chips by hand without thinking much about it 🙂

RogerClark
Fri Oct 30, 2015 12:55 am
How easy is it to add a menu for this ?? i.e can we use a #ifdef for the differences ?

jcw
Fri Oct 30, 2015 1:16 am
Current changes are to adjust existing entry – see https://github.com/rogerclarkmelbourne/ … 2/pull/126

Do you want two entries, one for a Nucleo F103 with and one without external crystal?
I suggest discussing this further on GitHub.


Zingg_JM
Tue Jan 17, 2017 11:00 am
This is the topic I was looking for, but…

I like this: -please read the docs – but a clickable link is what I need for a quick start!

So I will simply add a new topic for my actual issue

Jean-Marc


Rick Kimball
Sun Jun 25, 2017 3:29 pm
I know this is an old topic, however I just had to deal with this type of issue with an older NUCLEO-STM32F030R8 board. It doesn’t provide an external XTAL and I wanted to get an accurate clock. To achieve this without an external XTAL, you can change some solder bridges and get an accurate 8MHz clock from the MCO pin of the STLINK side of the board. I redid my solder bridges according to the UM1724 manual:

UM1724 wrote:• MCO from ST-LINK: MCO output of ST-LINK MCU is used as input clock. This
frequency cannot be changed, it is fixed at 8 MHz and connected to
PF0/PD0/PH0-OSC_IN of the STM32 microcontroller.
The following configuration is needed:
– SB55 OFF and SB54 ON
– SB16 and SB50 ON
– R35 and R37 removed


Leave a Reply

Your email address will not be published. Required fields are marked *