NUCLEO-F031K6 - Development Board - Review

Table of contents

RoadTest: NUCLEO-F031K6 - Development Board

Author: noorpuri

Creation date:

Evaluation Type: Development Boards & Tools

Did you receive all parts the manufacturer stated would be included in the package?: True

What other parts do you consider comparable to this product?: null

What were the biggest problems encountered?: 1. The code size difference between online Mbed compliler and Offline Keil Compiler. 2. The alternate conversion of UART Pins

Detailed Review:

REVIEW: NUCLEO-F031K6 AS Prototyping Tool

Mian Ahmed Jehanzeb Anwer Noorpuri

Firstly, I want to thank Element14 for considering me for the review of this amazing product and I am also very thankful to Randall Scasny and Daniel Zima to provide me much additional time to submit my review. I also want to mention that working with miniature gadget also pushed me to interact with Mbed development environment and enhance my knowledge base.



I have already many ARM CORTEX-M Series boards, i.e. Discovery STM32F4, STM32F3 and Clicker 2 of Kinetis K64 series and but I was not expecting such smaller form factor of the NUCLEO-F031K6 board as compared to above mentioned development kits. I started thinking about to develop an idea of NUCLEO-F031K6 based battery power sensor node for a university project related to wireless sensor network.


FIGURE1:  Click-K64, Nucleo-F301, Discovery STM32F4



This ARM-M0 µC mini board has much valuable features those are essential to develop a small scale embedded device. The salient features like size of Flash, i.e. 32 KB, RAM i.e. 4 KB, 22 GPIO's, Serial Communication interfaces i.e. UART, SPI, I2C, and 12-Bit ADC (8- Channel) make this product more appropriate for such Embedded System developer, who has to optimize the constraints related to placement space and feature set of microcontroller. Moreover, this small board can also be used to accommodate the post development requirement with minimal changes in the Hardware and Software of existing system.



It is my first experience to develop a firmware by using the on-line Mbed development tool. But Mbed also provides the facility to export the on-line project with all necessary libraries/framework for the off line development and debugging with the desired IDE i.e. KEIL, GCC, SW4STM32 Workbench or IAR.

I used KEIL MDK-Lite at the start to play with the NUCLEO-F031K6 to evaluate it and also to familiarize myself with the Mbed software development style because it is easy to in-circuit debugging. Each module of the sample application is separately tested and all modules are integrated in a single unified code at the final stage of development by using Mbed online compiler because KEIL generated code of whole application was bigger as compared to online compiler and also flash Size of ST32F031K6.

KEIL has capability to directly download the HEX file by calling the ST-Link utility. But the on-line Mbed compiler generated BIN file is manually downloaded by using the ST-Link utility.

FIGURE 2: Size of Online generated Code




The Reason behind to NUCLEO-F031K6 as prototyping tool is that, I am developing a multi-feature modular embedded system to fulfill an obligatory requirement my current degree and I have to interface many components and modules with an ARM-CORTEX M4 board, like GPS, SD/MMC card, Digital Potentiometer, Analog Switch, RTD-to-Digital Converter and Extremely Accurate Real-Time Clock DS3234.

It is very comfortable for me to use NUCLEO-F031K6 as prototyping platform to develop and test the driver code for each individual digital item before integrating in the actual system because there are all required peripherals and also availability of 3.3 and 5V on this mini card to evaluate the featured and performance of single element.

FIGURE 3:   RTC , RTD to Digital Convertor, GPS, Digital POT and others




The DS3234 is a low-cost, extremely accurate SPI bus real-time clock with an integrated crystal. It maintains seconds, minutes, hours, day, date, month, and year information with Leap Year. The clock operates in either the24-hour or 12-hour format with AM/PM indicator. Two programmable time-of-day alarms, a programmable square-wave output and also Digital Temp Sensor with ±3°C Accuracy are also included in this chip. The RTC can work at Vcc =2.0 V to 5.5V.


The SPI bus operates at maximum frequency of 4 MHz with SPI Mode 1 or Mode3. Normally, a slow frequency can also be set to acquire information about RTC but to it is necessary to configure the SPI frequency up to 4 MHZ to initialize the RTC time and date register with GPS based UTC or PC based System Time.


The Dead-on RTC Breakout board from Sparkfun with 12mm coin-cell battery holder for battery backup is selected for review. All necessary information of this product is available at the following webpage

FIGURE 4:  Schematic Diagram of Sample Application




The sample application is developed to evaluate as much as possible features of Nucleo-F031K6 and also RTC DS3234. It can be divided in the following sub sections for understanding

1.    Hardware Connectivity

a.    SPI Connections

The connection detail of Nucleo-F031K6 board with RTC breakout is following



Nucleo-F031K6  Board


RTC Breakout


CN4    PIN 14: +3V3

2: VCC


CN4    PIN  2: 

1: GND


CN4    PIN  12:  PA0

3: SQW


CN4    PIN  12:  PA4

7: SS


CN4    PIN  12:  PA5

4: CLK


CN4    PIN  12:  PA6



CN4    PIN  12:  PA7


b.    POT Connection

A potentiometer is also attached with Nucleo-board to test ADC functionality by using a GPIO pin with HIGH  logic level as input voltage source  for POT because available +5V is not safe for 3.3V tolerant analog channel. The connection detail is as follow


Nucleo-F031K6 Board




CN3    PIN 5: PA12

1: VCC


CN3    PIN 6:  PB0

1: Vout


CN3    PIN  4: 

3: GND


2.    Firmware Development

The used Nucleo-board peripherals and their associated API, are as UART, SPI, ADC, Hardware Interrupt @Rising Edge, LED.


The RTC information, which is acquired by µC after the each Rising Edge of SQW signal includes Date: DD:MM:YY and Time: hh:mm:ss and information of RTC Temperature register is gathered after each 64 seconds.  The analog value of Potentiometer is also read by ADC after the read the RTC values.

All acquired information without Date is sent on UART in the following way

TIME =    00 49 28  Analog = 1260  TEMP = 24.00


The RTC is initialized with new values of Date and Time those are sent by PC after getting its System time. The LED is toggled with the by the ISR associated with SQW signal for indication.

FIGURE 5:  Complete Setup of Application a) Board with Probes b) PC based Oscilloscope


The following screen shots are captured by the personal PC based Oscilloscope to display the SPI communication. Since Oscilloscope has only 2 channels, so the different screenshots are merged with the tag of signal name for the understanding

FIGURE6:  a) SQW Interrupt causes SPI Communication i.e. CS=LOW

            b)  As CS goes LOW, Start Address =0x00 on MOSI PIN


                    c)  After MOSI=0x00, RTC information is appeared on MISO


1.    MATLAB based  PC- NUCLEO Serial Link for information acquisition and initialization of RTC


A simple code is developed in the MATLAB for serial communication. The information of Nucleo-board board is received by the PC and user has the option to send System Time information to reinitialize the RTC with accurate values.

It has simple flow of the program. First just before the running of the MATLAB code, press the reset button of Nucleo-board and click on the play button of MATLAB. The following string will be displayed on the console

WELCOM TO  DS3234 & NUCLEO-F031 Application


and it is followed by the information string after each second. After the few seconds, the input is taked by the user to Continue, Sync or Exit. The screenshots of MATLAB execution are as follow.


FIGURE7:  a)  Welcome Message and User Option on Console

FIGURE7:  b) Acknowledgement of RTC Synchronization and User Option on Console



1.    The Firmware and MATLAB application code is attached in PDF format.

2.    There should be the option of customization of Mbed framework with respected to the user application to minimize the size of generated code.


3.    A mini base board should also be introduce for Nucleo-F031.