README.txt 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. README
  2. ======
  3. This README discusses issues unique to NuttX configurations for the STMicro
  4. Nucleo-144 board for STM32L4 chips.
  5. Contents
  6. ========
  7. - Nucleo-144 Boards
  8. - Nucleo L496ZG
  9. - Hardware
  10. - Button
  11. - LED
  12. - U[S]ARTs and Serial Consoles
  13. - SPI
  14. - SDIO - MMC
  15. - SPI Test
  16. - Configurations
  17. nsh
  18. Nucleo-144 Boards:
  19. =================
  20. The Nucleo-144 is a standard board for use with several STM32 parts in the
  21. LQFP144 package. Variants with a STM32L4 MCU include:
  22. STM32 Part Board Variant Name
  23. ------------- ------------------
  24. STM32L496ZGT6 NUCLEO-L496ZG
  25. STM32L496ZGT6P NUCLEO-L496ZG-P
  26. STM32L4A6ZGT6 NUCLEO-L4A6ZG
  27. STM32L4R5ZIT6 NUCLEO-L4R5ZI
  28. STM32L4R5ZIT6P NUCLEO-L4R5ZI-P
  29. ------------- ------------------
  30. This directory supports only the STM32L4 variants of Nucleo-144. For others,
  31. see configs/nucleo-144 configuration.
  32. Please read the User Manual UM2179: Getting started with STM32 Nucleo board
  33. software development tools and take note of the Powering options for the
  34. board (6.3 Power supply and power selection) and the Solder bridges based
  35. hardware configuration changes that are configurable (6.11 Solder bridges).
  36. Also note that UM1727 is not valid for L4 Nucleo-144 boards!
  37. Common Board Features:
  38. ---------------------
  39. Peripherals: 8 leds, 2 push button (3 LEDs, 1 button) under software
  40. control
  41. Debug: STLINK/V2-1 debugger/programmer Uses a STM32F103CB to
  42. provide a ST-Link for programming, debug similar to the
  43. OpenOcd FTDI function - USB to JTAG front-end.
  44. Expansion I/F: ST Zio and Extended Ardino and Morpho Headers
  45. Nucleo L496ZG
  46. =============
  47. ST Nucleo L496ZG board from ST Micro is supported. See
  48. 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-l496zg.html
  49. The Nucleo L496ZG order part number is NUCLEO-L496ZG. It is one member of
  50. the STM32 Nucleo-144 board family.
  51. NUCLEO-L496ZG Features:
  52. ----------------------
  53. Microprocessor: STM32L496ZGT6 Core: ARM 32-bit Cortex®-M4 CPU with FPU,
  54. 80 MHz, MPU, and DSP instructions.
  55. Memory: 1024 KB Flash 320KB of SRAM (including 64KB of SRAM2)
  56. ADC: 3×12-bit: up to 24 channels
  57. DMA: 2 X 7-stream DMA controllers with FIFOs and burst support
  58. Timers: Up to 13 timers: (2x 16-bit lowpower), two 32-bit timers,
  59. 2x watchdogs, SysTick
  60. GPIO: 114 I/O ports with interrupt capability
  61. LCD: LCD-TFT Controller, Parallel interface
  62. I2C: 4 × I2C interfaces (SMBus/PMBus)
  63. U[S]ARTs: 3 USARTs, 2 UARTs (27 Mbit/s, ISO7816 interface, LIN, IrDA,
  64. modem control)
  65. SPI/12Ss: 6/3 (simplex) (up to 50 Mbit/s), 3 with muxed simplex I2S
  66. for audio class accuracy via internal audio PLL or external
  67. clock
  68. QSPI: Dual mode Quad-SPI
  69. SAIs: 2 Serial Audio Interfaces
  70. CAN: 2 X CAN interface
  71. SDMMC interface
  72. USB: USB 2.0 full-speed device/host/OTG controller with on-chip
  73. PHY
  74. Camera Interface: 8/14 Bit
  75. CRC calculation unit
  76. TRG: True random number generator
  77. RTC
  78. See https://developer.mbed.org/platforms/ST-Nucleo-L496ZG for additional
  79. information about this board.
  80. Hardware
  81. ========
  82. < Section needs updating >
  83. GPIO - there are 144 I/O lines on the STM32L4xxZx with various pins pined out
  84. on the Nucleo 144.
  85. Keep in mind that:
  86. 1) The I/O is 3.3 Volt not 5 Volt like on the Arduino products.
  87. 2) The Nucleo-144 board family has 3 pages of Solder Bridges AKA Solder
  88. Blobs (SB) that can alter the factory configuration. We will note SB
  89. in effect but will assume the factory default settings.
  90. Our main concern is establishing a console and LED utilization for
  91. debugging. Because so many pins can be multiplexed with so many functions,
  92. the above mentioned graphic may be helpful in identifying a serial port.
  93. There are 4 choices that can be made from the menuconfig:
  94. CONFIG_NUCLEO_CONSOLE_ARDUINO or CONFIG_NUCLEO_CONSOLE_MORPHO or
  95. CONFIG_NUCLEO_CONSOLE_VIRTUAL or CONFIG_NUCLEO_CONSOLE_NONE
  96. The CONFIG_NUCLEO_CONSOLE_NONE makes no preset for the console. You should still visit
  97. the U[S]ART selection and Device Drivers to disable any U[S]ART remaining.
  98. The CONFIG_NUCLEO_CONSOLE_ARDUINO configurations assume that you are using a
  99. standard Arduino RS-232 shield with the serial interface with RX on pin D0 and
  100. TX on pin D1 from USART6:
  101. -------- ---------------
  102. STM32F7
  103. ARDUIONO FUNCTION GPIO
  104. -- ----- --------- -----
  105. DO RX USART6_RX PG9
  106. D1 TX USART6_TX PG14
  107. -- ----- --------- -----
  108. The CONFIG_NUCLEO_CONSOLE_MORPHO configurations uses Serial Port 8 (USART8)
  109. with TX on PE1 and RX on PE0.
  110. Serial
  111. ------
  112. SERIAL_RX PE_0
  113. SERIAL_TX PE_1
  114. The CONFIG_NUCLEO_CONSOLE_VIRTUAL configurations uses Serial Port 3 (USART3)
  115. with TX on PD8 and RX on PD9.
  116. Serial
  117. ------
  118. SERIAL_RX PD9
  119. SERIAL_TX PD8
  120. These signals are internally connected to the on board ST-Link
  121. Of course if your design has used those pins you can choose a completely
  122. different U[S]ART to use as the console. In that Case, you will need to edit
  123. the include/board.h to select different U[S]ART and / or pin selections.
  124. Buttons
  125. -------
  126. B1 USER: the user button is connected to the I/O PC13 (Tamper support, SB173
  127. ON and SB180 OFF)
  128. LEDs
  129. ----
  130. The Board provides a 3 user LEDs, LD1-LD3
  131. LED1 (Green) PB_0 (SB120 ON and SB119 OFF)
  132. LED2 (Blue) PB_7 (SB139 ON)
  133. LED3 (Red) PB_14 (SP118 ON)
  134. - When the I/O is HIGH value, the LEDs are on.
  135. - When the I/O is LOW, the LEDs are off.
  136. These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is
  137. defined. In that case, the usage by the board port is defined in
  138. include/board.h and src/stm32_autoleds.c. The LEDs are used to encode OS
  139. related events as follows when the LEDs are available:
  140. SYMBOL Meaning RED GREEN BLUE
  141. ------------------- ----------------------- --- ----- ----
  142. LED_STARTED NuttX has been started OFF OFF OFF
  143. LED_HEAPALLOCATE Heap has been allocated OFF OFF ON
  144. LED_IRQSENABLED Interrupts enabled OFF ON OFF
  145. LED_STACKCREATED Idle stack created OFF ON ON
  146. LED_INIRQ In an interrupt NC NC ON (momentary)
  147. LED_SIGNAL In a signal handler NC ON OFF (momentary)
  148. LED_ASSERTION An assertion failed ON NC ON (momentary)
  149. LED_PANIC The system has crashed ON OFF OFF (flashing 2Hz)
  150. LED_IDLE MCU is is sleep mode ON OFF OFF
  151. OFF - means that the OS is still initializing. Initialization is very fast
  152. so if you see this at all, it probably means that the system is
  153. hanging up somewhere in the initialization phases.
  154. GREEN - This means that the OS completed initialization.
  155. BLUE - Whenever and interrupt or signal handler is entered, the BLUE LED is
  156. illuminated and extinguished when the interrupt or signal handler
  157. exits.
  158. VIOLET - If a recovered assertion occurs, the RED and blue LED will be
  159. illuminated briefly while the assertion is handled. You will
  160. probably never see this.
  161. Flashing RED - In the event of a fatal crash, all other LEDs will be
  162. extinguished and RED LED will FLASH at a 2Hz rate.
  163. Thus if the GREEN LED is lit, NuttX has successfully booted and is,
  164. apparently, running normally. If the RED LED is flashing at
  165. approximately 2Hz, then a fatal error has been detected and the system has
  166. halted.
  167. Serial Consoles
  168. ===============
  169. USART3
  170. ------
  171. Default board is configured to use USART3 as console.
  172. Pins and Connectors:
  173. FUNC GPIO Connector
  174. Pin NAME
  175. ---- --- ------- ----
  176. TXD: PC4 CN8-9, A4
  177. RXD: PC5 CN8-11, A5
  178. ---- --- ------- ----
  179. You must use a 3.3 TTL to RS-232 converter or a USB to 3.3V TTL
  180. Nucleo 144 FTDI TTL-232R-3V3
  181. ------------- -------------------
  182. TXD - CN8-9 - RXD - Pin 5 (Yellow)
  183. RXD - CN8-11 - TXD - Pin 4 (Orange)
  184. GND - GND Pin 1 (Black)
  185. ------------- -------------------
  186. *Note you will be reverse RX/TX
  187. Use make menuconfig to configure USART3 as the console:
  188. CONFIG_STM32L4_USART3=y
  189. CONFIG_USART3_SERIALDRIVER=y
  190. CONFIG_USART3_SERIAL_CONSOLE=y
  191. CONFIG_USART3_RXBUFSIZE=256
  192. CONFIG_USART3_TXBUFSIZE=256
  193. CONFIG_USART3_BAUD=115200
  194. CONFIG_USART3_BITS=8
  195. CONFIG_USART3_PARITY=0
  196. CONFIG_USART3_2STOP=0
  197. USART2
  198. ------
  199. USART 2 could be used as console as well.
  200. Virtual COM Port
  201. ----------------
  202. Yet another option is to use LPUART1 and the USB virtual COM port. This
  203. option may be more convenient for long term development, but is painful
  204. to use during board bring-up. However as LPUART peripheral has not been
  205. implemented for STM32L4, this cannot currently be used.
  206. Solder Bridges. This configuration requires:
  207. PG7 LPUART1 TX SB131 ON and SB195 OFF (Default)
  208. PG8 LPUART1 RX SB130 ON and SB193 OFF (Default)
  209. Default
  210. -------
  211. As shipped, the virtual COM port is enabled.
  212. SPI
  213. ---
  214. Since this board is so generic, having a quick way to vet the SPI
  215. configuration seams in order. So the board provides a quick test
  216. that can be selected vi CONFIG_NUCLEO_SPI_TEST that will initalise
  217. the selected buses (SPI1-SPI3) and send some text on the bus at
  218. application initalization time board_app_initialize.
  219. SDIO
  220. ----
  221. To test the SD performance one can use a SparkFun microSD Sniffer
  222. from https://www.sparkfun.com/products/9419 or similar board
  223. and connect it as follows:
  224. VCC V3.3 CN11 16
  225. GND GND CN11-8
  226. CMD PD2 CN11-4
  227. CLK PC12 CN11-3
  228. DAT0 - PC8 CN12-2
  229. DAT1 - PC9 CN12-1
  230. DAT2 PC10 CN11-1
  231. CD PC11 CN11-2
  232. Configurations
  233. ==============
  234. nsh:
  235. ----
  236. Configures the NuttShell (nsh) located at apps/examples/nsh for the
  237. Nucleo-144 boards. The Configuration enables the serial interfaces
  238. on USART6. Support for builtin applications is enabled, but in the base
  239. configuration no builtin applications are selected (see NOTES below).
  240. NOTES:
  241. 1. This configuration uses the mconf-based configuration tool. To
  242. change this configuration using that tool, you should:
  243. a. Build and install the kconfig-mconf tool. See nuttx/README.txt
  244. see additional README.txt files in the NuttX tools repository.
  245. b. If this is the initial configuration then execute
  246. ./tools/configure.sh nucleo-l496zg/nsh
  247. in nuttx/ in order to start configuration process.
  248. Caution: Doing this step more than once will overwrite .config with
  249. the contents of the nucleo-l496zg/nsh/defconfig file.
  250. c. Execute 'make oldconfig' in nuttx/ in order to refresh the
  251. configuration.
  252. d. Execute 'make menuconfig' in nuttx/ in order to start the
  253. reconfiguration process.
  254. e. Save the .config file to reuse it in the future starting at step d.
  255. 2. By default, this configuration uses the ARM GNU toolchain
  256. for Linux. That can easily be reconfigured, of course.
  257. CONFIG_HOST_LINUX=y : Builds under Linux
  258. CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIL=y : ARM GNU for Linux
  259. 3. Although the default console is LPUART1 (which would correspond to
  260. the Virtual COM port) I have done all testing with the console
  261. device configured for USART3 (see instruction above under "Serial
  262. Consoles).