Programming Your Nucleo Board: Updated:Wednesday, March 14, 2018
Programming Your Nucleo Board: Updated:Wednesday, March 14, 2018
Nucleo Board
Updated:Wednesday, March 14, 2018
Outline
• Download the provided Zip file on the web!!
• What is Nucleo Board?
• Programing the development board
STM32F401
Board IO Pins
Ardunio Compatible
Morpho connector
Nucleo Board Pinouts
Comparing Arduino and Nucleo Board
Expansion Shields for Nucleo Board
Driver boards
CO Sensor
STM32 Nucleo Ecosystem
http://www.st.com/en/evaluation-tools/stm32-mcu-nucleo.html?querycriteria=productId=LN1847
STM32 Nucleo Ecosystem STM32F401RE MCU –
STM32F401RET6
Flash
Size
http://www.st.com/en/evaluation-tools/stm32-mcu-nucleo.html?querycriteria=productId=LN1847
STM32F401RE MCU –
STM32F401RET6
• ARM Cortex-M4 @ 84 MHZ
• 512-KB Flash & 96KB SRAM
• 64-Kbyte of CCM (core coupled memory) data RAM
• LCD parallel interface, 8080/6800 modes
• Timer with quadrature (incremental) encoder input
• 5 V-tolerant I/Os
• Parallel camera interface
• True random number generator
• RTC: subsecond accuracy, hardware calendar
• 96-bit unique ID
http://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-eval-tools/stm32-mcu-eval-tools/stm32-mcu-nucleo/nucleo-f401re.html#design-scroll
STM32F401RE MCU
Zooming in
Programmer
STM32
http://www.st.com/content/ccc/resource/technical/document/user_manual/98/2e/fa/4b/e0/82/43/b7/DM00105823.pdf/files/DM00105823.pdf/jcr:content/translations/en.DM00105823.pdf
System View
• The ST-LINK Programmer
allows us to
program the
board
STM32
Board Schematic
https://www.arrow.com/en/reference-designs/nucleo-f401re-stm32-nucleo-development-board-with-
stm32f401ret6-mcu-supports-arduino-and-st-morpho-connectivity/e9173db0f3c486986faab9dbea5b2a9b
Board Schematic
Use the bush button
https://www.arrow.com/en/reference-designs/nucleo-f401re-stm32-nucleo-development-board-with-
stm32f401ret6-mcu-supports-arduino-and-st-morpho-connectivity/e9173db0f3c486986faab9dbea5b2a9b
Board Schematic
https://www.arrow.com/en/reference-designs/nucleo-f401re-stm32-nucleo-development-board-with-
stm32f401ret6-mcu-supports-arduino-and-st-morpho-connectivity/e9173db0f3c486986faab9dbea5b2a9b
Answer the following questions:
You need to use the board schematic. Make sure you have the board.
[2]
Start A New Project-2
• The Select Device window pops up
• In the search type: STM32F401RETx
• Click on the device (STM32F401RETx)
that showed up and then click OK
Start A New Project-3
• At this point the Manage Run
window pops up
• CHECK CMSIS à CORE and
DEVICEàSTARTUP boxes –
note that the color changes
• Then click OK
[6]
[7]
[8]
Start A New Project-5
• In the PROJECT window click on Source Group 1 and
select ADD NEW ITEM….
• In the new window select ASM files
• Then type the name of the ASM file:
ASM_NewProject.s
• Click on ADD
Start A New Project
• In the project window click on ASM_NewProject.s
under the Source Group 1 folder
• Open the file
• Type in the following code
• Save the file
• Press F7 and make sure there are no errors (as
shown below) – Note: If you do not see the TIME
ELAPSED then you need to make sure you BUILD ALL
assembling startup_stm32f401xe.s...compiling
system_stm32f4xx.c...linking...Program Size: Code=300 RO-data=404
RW-data=0 ZI-data=1536 ".\Objects\workingProject.axf" - 0 Error(s),
0 Warning(s).Build Time Elapsed: 00:00:01
Also, make sure you build the entire project. You should see
Build Time Elapsed to ensure the project was properly built
(see next slide):
assembling startup_stm32f401xe.s...compiling
system_stm32f4xx.c...linking...Program Size: Code=300 RO-
data=404 RW-data=0 ZI-data=1536 ".\Objects\workingProject.axf"
- 0 Error(s), 0 Warning(s).Build Time Elapsed: 00:00:01- 0 \
Modify the program….
1. Change the delay value and see how the blinking LED changes
2. In Keil, which the program is running, click on System View button
and see how the registers change
3. Change the program such that the LED ON time is much shorter
than the OFF time – in this case we are creating different delays for
__ON and __OFF
Programming GPIO Ports in STM32F411xC/E
• Table 1 gives the boundary
addresses of the peripherals
• See Section 2.3 of the
Reference Manual
where the 'x' in each register name acronym represents the port i.e. the GPIOx_MODER associated with port A is called
GPIOA_MODER.
16 PINS on the PORTS 15 3 2 1 0
; 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
16 PINS on the PORTS 15 3 2 1 0
PC13
PA5
Configure the GPIOA
STEP 2: Clock Setting
for GPIOx
• RCC AHB1
peripheral clock Bit 0 GPIOAEN: IO port A clock enable
enable register Set and cleared by software.
0: IO port A clock disabled
(RCC_AHB1ENR) 1: IO port A clock enabled
• Section 6.3.9
RCC_AHB1ENR
Configure the GPIOA
STEP 2: Clock Setting for GPIOx
• RCC AHB1 peripheral clock enable register (RCC_AHB1ENR)
• Section 6.3.9 Bit 0 GPIOAEN: IO port A clock enable
Set and cleared by software.
• Loading 0000 0000 0000 0001 0: IO port A clock disabled
1: IO port A clock enabled
RCC_AHB1ENR
Answer the following questions:
You need to use the reference manual.
Also, make sure you build the entire project. You should see
Build Time Elapsed to ensure the project was properly built
(see next slide):