Anyone tried ST Nucleo boards?

STMicroelectronics has produced a series of interesting STM32 boards with Arduino Uno style headers.

Has anyone tried these boards?

This board costs $10.33, has 512 KB flash, 96 KB SRAM and runs at 84 MHz http://www.digikey.com/product-detail/en/NUCLEO-F401RE/497-14360-ND/4695525.

You only need a min USB cable to use the board since it has an integrated ST-LINK/V2-1 debugger/programmer.

Looks like ST will use this form factor for many more boards. Here is a brief for the first nine http://www.st.com/st-web-ui/static/active/en/resource/technical/document/data_brief/DM00105918.pdf.

I ordered two of the STM32F401 boards. Here is the user guide http://www.st.com/st-web-ui/static/active/en/resource/technical/document/user_manual/DM00105823.pdf.

An interesting looking board at a very interesting price.
I will soon be doing a small ST micro project and that may tempt me to investigate there MCU's in more detail and this looks a nice starting point. Not to sure about mbed environment though.

Another link for viewing.
https://mbed.org/platforms/ST-Nucleo-F401RE/

Not to sure about mbed environment though.

ST supports Mbed so users can try STM32 without installing a development environment.

Just use a standard ARM tool chain like the free Sourcery CodeBench Lite Edition including ARM GCC IDE http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/.

I use CodeBench on Windows.

Most Linux distributions have the tools. Here is how to setup Nucleo on Linux http://regalis.com.pl/en/arm-cortex-stm32-gnulinux/

The Nucleo F401 board arrived. I spent about two hours playing with it. So far I like it more than any other ST demo board.

I loaded the USB driver and the board appears as at least three devices.

Flash can be accessed as a 512 KB mass store device. I think this is mainly for flash programming by Mbed.

One of the Serial ports shows up as a COM port like Arduino.

An ST-link debug port can be used to load programs, set break points and observe RAM during execution.

Here is how I did my first blink program, very bare metal. I attached a .zip with the "project files". I used no fancy tools, just a .bat file to build the hex. Amazing how simple this was.

Download and installed Gnu Arm tools (gcc-arm-none-eabi-4_8-2014q1-20140314-win32.exe)
https://launchpad.net/gcc-arm-embedded

Download STM32Cube firmware for STM32 F4 and unzipped it in a folder named STM32CubeF4Root.

Download and installed ST-Link USB driver and ST-Link utility.

Use this Linux article as a guide to make a bare metal blink program on Windows 7.
http://regalis.com.pl/en/arm-cortex-stm32-gnulinux/

Built the hex file with a .bat file, build.bat.

Load the program with the ST-Link utility.

This is true bare metal. The attached zip file has all code for blink. Just three source files are compiled to .o files and linked. No other ST firmware files are linked.

The three source files are:

startup_stm32f401xe.s
system.c
main.c

blink.zip (11.2 KB)

I have started using STM32CubeMX to configure Nucleo projects and several other STM32 boards. STM32CubeMX is a big improvement over previous ST configuration tools. http://www.st.com/web/catalog/tools/FM147/CL1794/SC961/SS1743/PF259242

STM32CubeMX is a graphical configuration tool that automates configuration and generation of STM32 initialization C code.

The STM32CubeMX pin-out wizard assists pin assignment to avoid conflicts and has a constraints solver.

The clock-tree wizard assigns clocks and performs dynamic validation. The user interface is a diagram of the clock tree and you just edit this diagram.

The peripherals-and-middleware wizard aids configuration to avoid unusable settings.

The power-consumption wizard estimates the application's power usage.

STM32CubeMX creates a project with the generated start-up code and copies needed library code to the project. Several people have posted Makefiles templates to build projects generated by STM32CubeMX. There is also a eclipse plugin.

I also like the STMStudio debug tool http://www.st.com/web/en/catalog/tools/PF251373. STMStudio reads the elf file generated by the linker to find and displays variables in real-time.

STM Studio reads data through the ST-Link SWD debug port so it does not interfere with the real-time behavior of applications.

I continue to be pleased with the Nucleo boards. I now program flash by drag and drop of the apps .bin file to the Nucleo folder. This does not interrupt the connection to the serial monitor since there is a second STM32F103 that handles the serial monitor, programming flash, and debug.

There is a new NUCLEO-F411RE ($10.33 from Future Electronics). It is faster, 100 MHz, has more SRAM, 128 KB, and 512 KB of flash. There are three SPI controllers, three I2C controllers, and three UARTs.

I have tested the ADC on these boards and it is at least 50 times faster than the Uno, 2.4 MSPS. The 12-bit ADC seems to be very accurate.

I have almost finished porting a new FAT32/FAT16/FAT12 generic file system to the STM32. I plan to support SD on SPI, SD on 4-bit SDIO, and USB flash drives. 4-bit SDIO should be very fast since it should run at 50 MHz. on the F411.

I also bought a 32F429IDISCOVERY board for $33.60 http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/PF259090. 256 KB internal RAM, 8 MB external SRAM, 2 MB flash, 180 MHz clock, 2.4" TFT touch screen.

The external SRAM has a 16-bit data bus and runs at 80 MHz. Its three 12-bit ADCs can run in interleaved mode to digitize a signal at up to 7.2 MSPS.

Edit: Just checked and Future electronics now sells the 32F429IDISCOVERY for $24.00, about the same as an Uno.

The NUCLEO-F411RE looks to give an awful good bang for your buck and next time I'm ordering from Mouser I will slip one of these in. They work out as cheap or cheaper than a comparable clone Arduino.
The blurb says it's compatible with R3 Arduino shields so I assume the pins are only 3.3V tolerant?

From the STM32F411RE web page http://www.st.com/web/en/catalog/mmc/FM141/SC1169/SS1577/LN1877/PF260049

All I/O ports are 5 V-tolerant

Edit footnote:

5 V tolerant except when in analog mode or oscillator mode (for PC14, PC15, PH0 and PH1).

fat16lib:
From the STM32F411RE web page http://www.st.com/web/en/catalog/mmc/FM141/SC1169/SS1577/LN1877/PF260049

All I/O ports are 5 V-tolerant

Thanks for that, I had started going through the instruction manual but my eyes started to glaze over. Gone are the days I could/would read data sheets and manuals end to end.

Have you tried the debugger yet? I really miss the ability to single step or breakpoint code on the Arduino compared to PIC chips I used to work with on occasions.

Have you tried the debugger yet?

It has SWD over USB which is the modern ARM replacement for JTAG. Here is a link Debugging the STM32F4 using openocd, gdb and Eclipse | Benjamin's robotics.

You can:

Set hardware breakpoints
See variable values when hitting the breakpoints
Change variables, then continue
Many other things…

I don't find breakpoints very useful in complex embedded systems since they totally change the behavior of a system.

I use STM Studio and it works. STM Studio is a run-time variables monitoring and visualization tool for STM8 and STM32 microcontrollers http://www.st.com/web/en/catalog/tools/PF251373.

STM Studio reads elf files to find symbols.

Reads on-the-fly (non intrusive) variables from RAM while application is running
Variable viewer - Real-time waveforms, oscilloscope-like graphs
TouchPoint viewer - Association of 2 variables, one on the X axis, one on the Y axis

You can also modify flash/RAM and view tables of variables.

I am a big fan of the Discovery boards, but it seems the NUCLEO offering is quite large too:

The external SRAM has a 16-bit data bus and runs at 80 MHz.

It is an SDRAM. The r/w access to it is about 6x slower than to the internal on-chip sram.

PS: the 3xx and 4xx chips include an FPU (32bit single precision, +-* 1cycle, MAC-like 3cycles and / sqrt 14cycles) and 1cycle SIMDs.

nucleo..jpg

It is an SDRAM. The r/w access to it is about 6x slower than to the internal on-chip sram.

Still a lot faster than 8 MHz SPI SDRAM on AVR, like 100 times.

I plan on using it as an 8 MB RAM disk.

.. moreover, you can run the code out of the external sdram.. Performance like a desktop PC in '93.. (or better with filesystem on the SDIO sdcard) :slight_smile:

pito,

I am looking at the external SDRAM as a large buffer for fast data logging of ADC data.

The ADC can be triggered by a timer and read by the DMA controller. You can use DMA circular or double buffer mode with the ADC. This will provide low sampling time jitter and avoid loss of data due to buffer management.

An SD on SPI or better, 4-bit SDIO, can run at the same time on a separate DMA channel.

Maybe a million samples per second. That's 2 MB/sec and I have done 3 MB/sec to SD on Due with SPI DMA. The DMA controllers each have 4 by 32 bit fifo to handle memory contention.

If the SDRAM is too slow, It still might work with on chip RAM. Many SD cards have well under 100 ms max latency for streaming multi-block writes. There is 256 KB of on chip RAM.

Wow! The NUCLEO-F401RE is really fast with just polled SPI. I am using a stock Adafruit data logging shield.

I now have a new, not SdFat, file system library running well enough to do a first benchmark.

This is with a simple polled SPI library, not DMA. Here is the first result, no attempt to optimize:

Type is FAT32
File size 10 MB
Buffer size 32768 bytes
Starting write test. Please wait up to a minute
Write 2520.62 KB/sec
Maximum latency: 25258 usec, Minimum Latency: 12206 usec, Avg Latency: 12989 usec

Starting read test. Please wait up to a minute
Read 2159.05 KB/sec
Maximum latency: 15712 usec, Minimum Latency: 15159 usec, Avg Latency: 15178 usec

Here are the SPI send and receive routines:

//------------------------------------------------------------------------------
/** SPI receive multiple bytes */
void SpiNative::receive(uint8_t* buf, size_t n) {
  for (size_t i = 0; i < n; i++) {
    SPI1->DR = 0XFF;
    while (!(SPI1->SR & SPI_FLAG_RXNE));
    buf[i] = SPI1->DR;
  }  
}
//------------------------------------------------------------------------------
// SPI send multiple bytes */
void SpiNative::send(const uint8_t* buf , size_t n) {
  for (size_t i = 0; i < n; i++) {
    SPI1->DR = buf[i];
    while (!(SPI1->SR & SPI_FLAG_TXE));
  }
  while (SPI1->SR & SPI_FLAG_BSY);
  // discard any receive data
  uint8_t tmp = SPI1->DR;
}

What is your SPI clock?

42 MHz so full speed would be about 5 MB/sec.

On my new shiny bonus from a recent gig, an Agilent MSO-X 2202A with all features enabled, the gap between bytes for write is about 50% of time. Read is longer since you must wait for data to shift in.

I am tempted to press on for 4-bit SDIO DMA. I have designed the new library cache scheme for SDIO speeds.

Here is the result of a creating a 100 MB file on this 16 GB microSD www.amazon.com/SanDisk-MicroSDHC-Adapter-Frustration-Free-Packaging/dp/B009QZH7D8. Max write latency for an 32 KB write increases to about 50 ms. I suspect it would be less for writing to an already created contiguous file. My cache is too small for this file's FAT.

Type is FAT32
File size 100 MB
Buffer size 32768 bytes
Starting write test. Please wait up to a minute
Write 2666.36 KB/sec
Maximum latency: 46845 usec, Minimum Latency: 12123 usec, Avg Latency: 12288 usec

Starting read test. Please wait up to a minute
Read 2167.39 KB/sec
Maximum latency: 15768 usec, Minimum Latency: 15052 usec, Avg Latency: 15118 usec

Long time back I did experiments with SDIO on the F407 (@168MHz)under chibios and 5MB/sec was easy to get with 32kB blocks. My experiments were suboptimal, so I guess you may get 4-5MB/sec@84MHz..

I hope 4-bit SDIO DMA is much faster than 4-5 MB/sec.

Here is Due SPI DMA at 42 MHz with the new library:

Type is FAT32
File size 100MB
Buffer size 32768 bytes
Starting write test. Please wait up to a minute
Write 3915.83 KB/sec
Maximum latency: 34022 usec, Minimum Latency: 8190 usec, Avg Latency: 8365 usec

Starting read test. Please wait up to a minute
Read 4261.15 KB/sec
Maximum latency: 8229 usec, Minimum Latency: 7619 usec, Avg Latency: 7688 usec

Notice DMA read gets a big boost.

One of the things that I like about the normal Official Arduino boards is that they are "correctly" priced. If I design a "product" around an Uno core with MSRP of $30, then I know that I can put the relevant components on a board of my own design, and that section of the product can sell for about $30 (or less, because I can leave things out.) With these subsidized Evaluation Boards from Chip vendors, it's a lot harder to get that 'feel' for end product cost. I mean, as a hobbyist or end-user, a $15 board with an ST M4 chip is great. But the chip itself is $10+ in small quantities, and it probably needs a 4-layer board and professional assembly. So there's no way that $15 represents a realistic cost for me to use the same chip in a design, short of something "really big" that will sell in 10k+ quantities.

OTOH, there's an argument that says that in my target quantity (say, 100-1000), I should stop worrying about using chip-level devices in general: just buy the launchpad or Nucleo boards and restrict my part of the design to a "shield"...
(On the gripping hand, it's not clear that the semiconductor vendor boards are allowed (license-wise) to be used in products.)