Pages: [1] 2   Go Down
Author Topic: Anyone tried ST Nucleo boards?  (Read 5986 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Edison Member
*
Karma: 63
Posts: 1604
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Norfolk UK
Offline Offline
Edison Member
*
Karma: 66
Posts: 2484
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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/
Logged

There is no such thing as a stupid question but there are a lot of inquisitive idiots.

0
Offline Offline
Edison Member
*
Karma: 63
Posts: 1604
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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/
Logged

0
Offline Offline
Edison Member
*
Karma: 63
Posts: 1604
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
http://www.st.com/web/catalog/tools/FM147/CL1794/SC961/SS1743/PF259243

Download and installed ST-Link USB driver and ST-Link utility.
http://www.st.com/web/en/catalog/tools/FM146/CL1984/SC720/SS1450/PF251168

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.15 KB - downloaded 14 times.)
Logged

0
Offline Offline
Edison Member
*
Karma: 63
Posts: 1604
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
Edison Member
*
Karma: 63
Posts: 1604
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: June 27, 2014, 07:47:37 am by fat16lib » Logged

Norfolk UK
Offline Offline
Edison Member
*
Karma: 66
Posts: 2484
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

There is no such thing as a stupid question but there are a lot of inquisitive idiots.

0
Offline Offline
Edison Member
*
Karma: 63
Posts: 1604
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

From the STM32F411RE web page http://www.st.com/web/en/catalog/mmc/FM141/SC1169/SS1577/LN1877/PF260049
Quote
All I/O ports are 5 V-tolerant

Edit footnote:
Quote
5 V tolerant except when in analog mode or oscillator mode (for PC14, PC15, PH0 and PH1).
« Last Edit: June 27, 2014, 08:42:34 am by fat16lib » Logged

Norfolk UK
Offline Offline
Edison Member
*
Karma: 66
Posts: 2484
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

From the STM32F411RE web page http://www.st.com/web/en/catalog/mmc/FM141/SC1169/SS1577/LN1877/PF260049
Quote
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.
Logged

There is no such thing as a stupid question but there are a lot of inquisitive idiots.

0
Offline Offline
Edison Member
*
Karma: 63
Posts: 1604
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Have you tried the debugger yet?

It has SWD over USB which is the modern ARM replacement for JTAG.   Here is a link http://vedder.se/2012/12/debugging-the-stm32f4-using-openocd-gdb-and-eclipse/.

You can:
Quote
    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.
Quote
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.
Logged

Rapa Nui
Offline Offline
Edison Member
*
Karma: 60
Posts: 2066
Pukao hats cleaning services
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Quote
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 (54.88 KB, 659x417 - viewed 19 times.)
« Last Edit: June 27, 2014, 02:10:19 pm by pito » Logged

0
Offline Offline
Edison Member
*
Karma: 63
Posts: 1604
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Rapa Nui
Offline Offline
Edison Member
*
Karma: 60
Posts: 2066
Pukao hats cleaning services
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

.. 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) smiley
« Last Edit: June 27, 2014, 03:14:07 pm by pito » Logged

0
Offline Offline
Edison Member
*
Karma: 63
Posts: 1604
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
Edison Member
*
Karma: 63
Posts: 1604
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
Quote
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:
Code:
//------------------------------------------------------------------------------
/** 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;
}
« Last Edit: June 28, 2014, 12:15:37 pm by fat16lib » Logged

Pages: [1] 2   Go Up
Jump to: