Home
STM32CubeL4 demonstration firmware for 32L476GDISCOVERY
Contents
1. 54 const tMenuItem ConstMainMenuItems Bt 0 9 SEL MODULE MODULE IDDMEASURE NULL NULL NULL NULL 0 0 SEL MODULE MODULE BATTERYMEASURE NULL NULL NULL NULL 5 H 0 0 SEL MODULE MODULE AUDIORECORDER NULL NULL NULL NULL 5 70 0 SEL_MODULE MODULE_AUDIOPLAYER NULL NULL NULL NULL CC 0 9 SEL MODULE MODULE COMPASS NULL NULL NULL NULL 8 0505 SEL MODULE MODULE SOUNDMETER NULL NULL NULL NULL AF 40 0 SEL MODULE MODULE GUITARTUNER NULL NULL NULL NULL OPTION 0 0 SEL SUBMENU MODULE NONE NULL NULL const tMenu amp OptionMenu NULL 49 0 SEL NOTHING MODULE NONE NULL NULL NULL NULL Y Ky DoclD028080 Rev 1 35 37 Revision history UM1919 8 36 37 Revision history Table 13 Document revision history Date 17 Jul 2015 Revision 1 Initial release Changes DoclD028080 Rev 1 2 UM1919 IMPORTANT NOTICE PLEASE READ CAREFULLY STMicroelectronics NV and its subsidiaries ST reserve the right to make changes corrections enhancements modifications and improvements to ST products and or to this document at any time without notice Purchasers should obtain the latest relevant information on ST products before placing orders ST products are sold pursuant to ST s terms and conditions of sale in place at the time of order acknowledgement Purchasers are solely responsible for the choice
2. 4 DoclD028080 Rev 1 15 37 Demonstration functional description UM1919 4 3 16 37 Menu navigation The UP DOWN RIGHT and LEFT joystick directions allow to navigate between items in the main menu and the submenus To enter a submenu and launch Exec function press the SEL pushbutton The SEL pushbutton designates the action of vertically pressing the top of the joystick as opposed to pressing horizontally UP DOWN RIGHT and LEFT The basic joystick key functions are defined as follows Table 2 Joystick key functions Joystick Key Function DOWN Go to next menu submenu item UP Go to previous menu submenu item RIGHT SEL Select the demonstration application submenu item LEFT Stop and exit the demonstration application submenu item 2 DoclD028080 Rev 1 UM1919 Demonstration functional description 4 4 Modules 4 4 1 IDD Overview 4 The IDD module application measures and displays in real time the MCU current consumption depending on the selected power mode The current is measured and calculated using a second microcontroller from the STM32L1 Series on the board Figure 9 IDD application menu structure display Value is the Idd measurement result displayed for 2 5 seconds either in milliampere mA microampere uA or nanoampere nA Features Run mode at 24 MHz voltage range 2 PLL Off RTC LSE Off Flash ART On Sleep mode at 24 MHz voltage range 2
3. Cor UM1919 y life augmented User manual STM32CubeL4 demonstration firmware for 32L476GDISCOVERY discovery kit Introduction The STMCube initiative was originated by STMicroelectronics to ease developers life by reducing development efforts time and cost STM32Cube covers the STM32 portfolio STM32Cube Version 1 x includes e The STM32CubeMNX a graphical software configuration tool that allows to generate C initialization code using graphical wizards e A comprehensive embedded software platform delivered per series such as STM32CubeL4 for STM32L4 Series The STM32CubeL4 HAL an STM32 abstraction layer embedded software ensuring maximized portability across STM32 portfolio A consistent set of middleware components such as RTOS USB STMTouch and FatFs All embedded software utilities coming with a full set of examples The STM32CubeL4 discovery demonstration platform is built around the STM32Cube HAL BSP and RTOS middleware components With a LCD glass display a microphone a joystick ST LINK V2 debugger programmer and microcontrollers from the STM32L1 and STM32L4 Series this discovery kit is ideal to evaluate STM32 ultra low power solutions and audio capabilities The architecture was defined with the goal of making from the STM32CubeL4 demonstration core an independent central component which can be used with several RTOS and third party firmware libraries through several abstraction layers inserted between
4. In WI if PowerSupplyMode SUPPLY MODE BATTERY 69 E 4 270 kModule Add MODULE AUDIOPLAYER ModuleAudioPlayer 274 kModule Add MODULE AUDIORECORDER ModuleAudioRecorder 272 kModule Add MODULE GUITARTUNER ModuleGuitarTuner A module is a set of function and data structures that are defined in a data structure that provides all the information and pointers to specific methods and functions to the kernel This later checks the integrity and the validity of the module and inserts its structure into a module table Each module is identified by a unique ID When two modules have the same ID the Kernel rejects the second one The module structure is defined as follows 6 typedef struct n wi J 58 uint8_t kModuleld i KMODULE RETURN kModulePreExec void 60 KMODULE RETURN kModuleExec void 61 KMODULE RETURN kModulePostExec void 62 KMODULE RETURN kModuleResourceCheck void K ModuleItem Typedef Id unique module identifier Name pointer to the module name e kModuleld module identifier e kModulePreExec pre execution function to allocate resources prior to the execution kModuleExec execution function kModulePostExec post execution function to release resources kModuleResourceCheck function to check the resource requirements after the module was added to the kernel DoclD028080 Rev 1 2 UM1919 Kernel description 7 6 Backup and settings configuration The
5. p OZ Error Handler 1203 L DoclD028080 Rev 1 29 37 Demonstration firmware settings UM1919 5 6 5 6 1 5 6 2 30 37 Programming firmware application First of all install the ST LINK V2 1 driver available on ST website There are two ways of programming the STM32L476G discovery board Using binary file Upload the binary STM32CubeDemo STM32L476G Discovery VX Y Z hex from the firmware package available under Projects STM32L476G Discovery Demonstrations Binary using your preferred in system programming tool Using preconfigured projects Choose one of the supported tool chains and follow the steps below e Open the application folder Projects STM32L476G Discovery Demonstrations e Chose the desired IDE project EWARM for IAR MDK ARM for Keil e Double click on the project file for example Project eww for EWARM e Rebuild all files Go to Project and select Rebuild all e Load the project image Go to Project and select Debug e Run the program Go to Debug and select Go The demonstration software as well as other software examples that allow the user to discover the STM32 microcontroller features are available on ST website at www st com stm32l4 discovery 2 DoclD028080 Rev 1 UM1919 Demonstration firmware footprints 6 2 Demonstration firmware footprints This section provides the memory requirements for all the demonstration modules The aim is to have an estimation of me
6. selection and use of ST products and ST assumes no liability for application assistance or the design of Purchasers products No license express or implied to any intellectual property right is granted by ST herein Resale of ST products with provisions different from the information set forth herein shall void any warranty granted by ST for such product ST and the ST logo are trademarks of ST All other product or service names are the property of their respective owners Information in this document supersedes and replaces information previously supplied in any prior versions of this document 2015 STMicroelectronics All rights reserved 2 DoclD028080 Rev 1 37 37
7. STM32CubeL4 demonstration firmware saves the kernel and module settings in the bank2 of the internal Flash memory address 0x08080000 typedef struct zt IDD application 100 IddBackupData TypeDef idd 0 Compass application 102 CompassBackupData_TypeDef compass 103 Global settings 104 SettingsBackupData_TypeDef settings 105 DemoBackupData TypeDef 109 gt Exparted constante 55525 O 7 110 fdefine DEMOBACKUP AREA ADDRESS 0x08080000 Backup data in first section of Bank2 typedef enum 1 71 BACKUP IDD 0x00 IDD application backup data ef 72 BACKUP_COMPASS 0x01 Compass application backup data 7 BACKUP_SETTINGS 0x02 Kernel settings backup data Ef 14 DemoBackupId The following APIs allow to save or restore it from the backup area 123 uint32 t SystemBackupRead DemoBackupId Id void Data 124 void SystemBackupWrite DemoBackupId Id void Data 7 7 Adding a new module Once the module appearance and the functionality are defined and created based on the constraints described above only the module is left to be added 1 Define unique ID of the new module in k config h file 2 k_ModuleAdd function should be called in k Modulelnit from KDemo_Initialization with unique ID defined in step1 3 Modify main module in main app c file to add the call to this new module in ConstMainMenultems table Main Menu
8. The first task of the kernel is to initialize the hardware and firmware resources to make them available to its internal processes and the modules around it The kernel starts by initializing the HAL system clocks and then the hardware resources needed during the middleware components LEDs and buttons e LCD e Backup area e External Quad SPI Flash memory e Audio codecs e MEMS Upon full initialization phase the kernel adds and links the system and user modules to the demonstration core waiting to execute a menu entry point Kernel processes and tasks The kernel is composed of a main task managed by FreeRTOS through the CMSIS OS wrapping layer e Start thread this task initializes the OS resources required by the demonstration framework and then starts the demonstration 2 DoclD028080 Rev 1 UM1919 Kernel description 7 4 7 5 2 B brief Start task param argument pointer that is passed to the thread function as start argument retval None L 185 static void StartThread void const argument osMutexDef_t mutex_lowpower Create mutex to handle low power mode DemoLowPowerMutex osRecursiveMutexCreate amp mutex_lowpower Start Demo kDemo_Start ll Kernel event manager The kernel provides services to manage events mainly here user key input k_menu h file void kMenu SendEvent uinti6 t JOY Pin 91 JOYState TypeDef kMenu GetEvent u
9. the STM32CubeL4 demonstration core and the several modules and libraries working around The STM32CubeL4 demonstration firmware supports STM32L476xx devices and runs on 32L476GDISCOVERY discovery kit July 2015 DoclD028080 Rev 1 1 37 www st com Contents UM1919 Contents 1 STM32Cube overview 000 cece eee 6 2 Getting started with demonstration oooooooooooo 7 2 1 Hardware requirements o oooooooo llle 7 2 2 Hardware configuration llle 9 2 3 Power supply modes 10 2 3 1 USB S pply g22de cornea d A e Mead des 10 2 3 2 Battery supply ooooooccrocrro eR hn 10 3 Demonstration firmware package llle 11 3 1 Demonstration repository n asuaan aaaea 11 3 2 Demonstration architecture overview 00000000000s 12 3 2 1 Kernel core files 222i ees 13 3 3 STM32L476G discovery board BSP csckca nce bene RR 14 4 Demonstration functional description 15 4 1 Overview sens 15 4 2 Main menu 0 cc eas 15 4 3 Menu navigation uses rne EXE FR Eu exu ERR QE CER PEE 16 4 4 Modules 5 sik cR ERE RR ARE S Roi AER CR Kee Rx er RIA RC Res 17 4 4 1 jp CERES 17 4 4 2 NOD iia ri de a at ee we 18 4 4 3 Audio record coco 19 4 4 4 Audio payo Sci tica ada aa irc 20 4 4 5 COMPASS aa ede uber hebes ed toa oU eben de eee dene 21 4 4 6 Sound meter o 21 4 4 7 Guitar tuner Lo 22 4 4 8 Option 2soshi rd a heey Sx eU Wa ds
10. 1476g_discovery h stm321476g discovery audio c stm321476g discovery audio h stm321476g discovery compass c stm321476g discovery compass h stm321476g discovery glass lcd c stm321476g discovery glass lcd h stm321476g discovery gyroscope c stm321476g discovery gyroscope h stm321476g discovery idd c stm321476g discovery idd h stm321476g discovery qspi c stm324476g discovery qspih E STM32L476G EVAL STM32L4 amp xx Nucleo VEE EE VE EE UNODE NNE if The components present on the STM32L476G discovery board are controlled by dedicated BSP drivers These are e The L3GD20 gyroscope in stm32 476g discovery accelerometer c h e The CS43L22 audio codec in stm32 476g discovery audio c h e The LSM303C e Compass in stm32 476g discovery compass c h e The LCD glass 8x40 in stm321476g discovery glass lcd c h e The MFXSTM32L 152 for Idd measurement in stm32 476g discovery idd c h e The 16 Mbytes Micron N25Q128A13 Quad SPI Flash memory in stm32l476g discovery qspi c h 2 DoclD028080 Rev 1 UM1919 Demonstration functional description 4 Demonstration functional description 4 1 Overview After powering the STM32L476G discovery board the welcome message STM32L476G DISCOVERY DEMO is displayed on the LCD and the first main menu application items is displayed 4 2 Main menu Figure 8 shows the main menu application tree with navigation possibilities Figure 8 Demonstration top menu
11. 23 45 Audio player control 2222 sxokesuema kA downed NE REG EE ene EK ORARE 23 5 Demonstration firmware settings llle 25 5 1 Clock control o 25 5 2 Peripherals o 26 2 37 DoclD028080 Rev 1 Ly UM1919 Contents 5 3 Interrupts wakeup pins 0000s 26 5 4 Low power strategy utu esate aed bee eae io c oe ecb kee dew ss a 27 5 5 FreeRTOS resources iris da eR ORNA te veh A Roe ROB CER ek A 27 5 5 1 DICl cR I PEE 28 5 5 2 Message queues o cocooccoccro eee hh 28 5 5 3 MUS i2 ete tx EIER IE RA ele ERES C EEG LE oct 28 5 5 4 zia TTD ere 29 5 6 Programming firmware application cece eee 30 5 6 1 Using binary file liess RII 30 5 6 2 Using preconfigured projects 0 0 0 cee eee 30 6 Demonstration firmware footprints LL 31 7 Kernel description sic 32 7 1 OVEIVICW i aa otau gonen gok aa dps eda ane a al Gp pee aiaa ecos 32 7 2 Kernel initialization a na anaana 32 7 3 Kernel processes and tasks 0 ccc eee 32 7 4 Kernel event manager ooooooconoocrnrrra ee 33 7 5 Module manager 322159624 er x eee ewe ve ABS he mb dx n mea eels 33 7 6 Backup and settings configuration 0 00 ce eee eee 35 1 7 Adding a new module 2 0 00 cee eee 35 8 Revision history essa arre eee XE oe eed Hoehne ee 36 Ky DoclD028080 Rev 1 3 37 List of tables UM1919 List of tables Table 1 Table 2 Table 3 T
12. PLL Off RTC LSE Off Flash ART On Low power run mode at 2 MHz PLL Off RTC LSE Off Flash ART On Low power sleep mode at 2 MHz PLL Off RTC LSE Off Flash ART On Stop 2 mode RTC LSE Off Flash ART Off Standby mode RTC LSE Off Flash ART Off RAM retention Off Shutdown mode RTC LSE Off Flash ART Off DoclD028080 Rev 1 17 37 Demonstration functional description UM1919 Functional description The selection of an Idd measurement with the joystick RIGHT key executes the following sequence e Clear the LCD e Enter HW components in low power mode e Enter MCU in low power mode e Wait for automatic wake up through an external event on EXTI 13 This event is the end of the Idd measurement done on the STM32L1 MCU side e Display the measured current value on the LCD The measured Idd value could be for example Figure 10 IDD mode selection and result value 4 4 2 VDD Overview The VDD module measures the voltage supply with the 12 bit ADC single conversion Figure 11 VDD application menu selection and result value 2 18 37 DoclD028080 Rev 1 UM1919 Demonstration functional description 4 4 3 Audio record Overview The audio record module application Record allows to demonstrate the audio recording capability of the STM32L476G discovery board thanks to the MP34DT01 embedded digital microphone Figure 12 Audio record application menu selection Recording Fea
13. able 4 Table 5 Table 6 Table 7 Table 8 Table 9 Table 10 Table 11 Table 12 Table 13 4 37 Kernel core TS 34 248 vache ston dev Rd el x ERE RV TS ae d aaa 13 Joystick key functions lisse m men 16 Frequencies per string liliis nh 22 Audio player control joystick key functions lille 23 Clock configurations eissernir iaae RR rr 25 Oscillators and PLL description liliis 25 Used peripherals 0 0000 c tenes 26 Demonstration firmware interrupts 20000 0c cece eee eee eee 26 Task description miii PR Le eee ues verde a NUR VE 28 28 Message queues ooocoo ehh Rm 28 Heap USADO C 29 Modules footprint 0 0000 eee 31 Document revision history 0 000 ee eee 36 2 DoclD028080 Rev 1 UM1919 List of figures List of figures Figure 1 Figure 2 Figure 3 Figure 4 Figure 5 Figure 6 Figure 7 Figure 8 Figure 9 Figure 10 Figure 11 Figure 12 Figure 13 Figure 14 Figure 15 Figure 16 Figure 17 Figure 18 Figure 19 Figure 20 2 STM32Cube block diagram ooooccooccco eee 6 STM32L476G discovery board top view 0 0 cee eee 8 STM32L476G discovery board bottom view 0 eee ee eee 8 STM32L476G discovery kit jumper presentation liliis 9 Folder Structure gt bis d pA By de a has ERRARE RECEN Et 11 Demonstration architecture overview liliis 12 Discovery BSP st
14. d in the firmware demonstration are listed hereafter As a reminder FreeRTOS configuration is described in FreeRTOSConfig h file DoclD028080 Rev 1 27 37 Demonstration firmware settings UM1919 5 5 1 5 5 2 5 5 3 28 37 Tasks Table 9 Task description Function Stack size Task entry point Description Priorit we P File words StartThread S application Main c 2 128 osPriorityNormal AudioPlayer_Thre Audio player AudioPlayer Init 4 128 osPriorityHigh ad application Audioplayer c AudioRecorder T Audio recorder AudioRecorder Ini x P ru htead application t 4 128 osPriorityHigh Audiorecorder c Implement Idle Idle task hook application vApplicationldleHo vApplicationldleHo 0K 128 osPriorityHigh FreeRTOS ok used to enter Main c low power mode Stack size 128 is the value defined for configMINIMAL STACK SIZE in FreeRTOSConfig h Message queues Table 10 Message queues Queue depth Queueld Description Function File Word ive i kM Init JoyEvent Queue to receive input enu Init j key event K_menu c AudioEvent Audio player input event AudioPlayer_Init 1 Audioplayer c osMsdld part of ef structure Mutex AudioRecorder_ContextTypeD event Audio Recorder input AudioRecorder_Init Audiorecorder c A mutex DemoLowPowerMutex is defined to control the main application entry in low power mode by first insuri
15. dded debug tool interface Idd current measurement Quad SPI Flash memory an audio codec with 3 5mm connector LCD segment display 8x40 LEDs a joystick and a USB mini B connector DoclD028080 Rev 1 7 37 UM1919 Getting started with demonstration gc 3 Q 5p E Figure 2 STM32L476G discovery board top Figure 3 STM32L476G discovery board bottom OISIO D9LVIZEWIS ER E ov ety oe ro 0 NNn 1S 8SN q Hp B DoclD028080 Rev 1 8 37 UM1919 Getting started with demonstration 2 2 Hardware configuration The STM32Cube demonstration supports STM32L476xx devices and runs on STM32L476G DISCO demonstration board from STMicroelectronics Several jumpers are used to configure the hardware mode of operation as shown in Figure 4 Figure 4 STM32L476G discovery kit jumper presentation 2 CN3 jumpers JP3 ME X XM M E M MM M MM M E JP5 JP6 Ly DoclD028080 Rev 1 9 37 Getting started with demonstration UM1919 2 3 2 3 1 2 3 2 10 37 Power supply modes The demonstration firmware provides two modes of operation depending on the power supply mode The richest power supply mode is the USB powered where all the applications can run at a maximum clock speed whereas an alternative mode consists in running from the battery The battery mode allows to demonstrate the low power consumption of MCU but also the HW itself The demonstration firmware implements thus some clock reduct
16. e ensuring maximized portability across STM32 portfolio A consistent set of middleware components such as RTOS USB TCP IP graphics A All embedded software utilities coming with a full set of examples Figure 1 STM32Cube block diagram Evaluation Discovery STM32 Nucleo Utilities Touch FAT file TCP IP Graphics system CMSIS Middleware level Utilities Board Support Package BSP Hardware Abstraction Layer HAL HAL level STM32FO STM32F1 STM32F2 STM32F3 STM32F4 STM32L0 STM32L1 STM32L4 Hardware MSv37250V1 2 DoclD028080 Rev 1 UM1919 Getting started with demonstration 2 2 1 2 Getting started with demonstration Hardware requirements The hardware requirements to start the demonstration application are as follows e STM32L476G discovery board Figure 2 and Figure 3 refer to UM1879 for the discovery kit description e One USB type A to Mini B cable to power up the discovery board from the USB ST LINK USB connector CN1 and to run in USB powered mode e One CR2032 battery to run in battery mode The STM32L476G discovery kit helps to discover the ultra low power features and audio capabilities of the STM32L4 Series It offers everything required for beginners and experienced users to get stared quickly and develop applications easily Based on an STM32L476VGT6 MCU it includes an ST LINK V2 1 embe
17. e 3 Joystick UP key 15 0 EXTI Line 5 Joystick DOWN key 15 0 2 DoclD028080 Rev 1 UM1919 Demonstration firmware settings 5 4 5 5 2 Table 8 Demonstration firmware interrupts continued Priority SubPriority Interrupts Application module highest 0 0 IDD application Interrupt from MFXSTM32L152 MCU SysTick CortexM4 System Timer for OS Tick 15 0 EXTI Line 13 15 15 The wakeup pin 2 is used to wake up the MCU from Standby and Shutdown modes Low power strategy The STM32CubeL4 demonstration firmware is designed to highlight the low power consumption capabilities of both the STM32L476VG MCU and the STM32L476G discovery board The Figure 20 illustrates the low power strategy put in place in the STM32Cube demonstration firmware based on no running application and user activity monitoring Figure 20 Low power scheme MCU consumption RUN or LPRUN RUN or LPRUN Running Wake up IT Running application application 1 LPRUN TUR user activity user activity key inputs key inputs Kernel menu handler Kernel waits for user event km kMenu GetEvent in handler kMenu HandleSelection key DemoEnterLowPower RESET DemoEnterLowPower RESET DemoEnterLowPower SET gt Idle task allows entry to low power mode FreeRTOS resources The STM32L476G demonstration firmware is designed on top of CMSIS OS drivers based on FreeRTOS The resources use
18. igure 15 shows the different audio player parts and their connections and interactions with the external components Figure 15 Audio player architecture DoclD028080 Rev 1 2 UM1919 Demonstration functional description 4 4 5 4 4 6 q Compass Overview The Compass module application allows to demonstrate the integration of the LSM303C 3 axis electronic compass embedded on the STM32L476G discovery board Figure 16 Compass application menu structure and display EORPAS EN bu Features e Areal time display in degree of the direction versus the magnetic north e Acalibration step is required in X Y Z axis to get the motion data from the application It consists in rotating the board by 360 degrees in all 3 axis The calibration data are saved in backup area Sound meter Overview The sound meter module demonstrates the perfect integration of a sound meter audio library It uses the audio recording capability of the digital microphone embedded on the STM32L476G discovery board Figure 17 Sound meter application menu selection and display Features e 16 bits PCM data input with a sample rate at 48 kHz mono e A weighting pre filter e Real time display of the sound level every 250ms with average done every 100ms DoclD028080 Rev 1 21 37 Demonstration functional description UM1919 4 4 7 22 37 Guitar tuner Overview The Guitar tuner module a
19. int32 t Delay kMenu SendEvent is called from the interrupt IRQ callback HAL GPIO EXTI Callback to send the event message to the Kernel event mailbox kMenu GetEvent is called by either the kernel event manager in kMenu HandleSelection or directly by the running module application expecting user input keys Module manager The main demonstration menu is initialized and launched by the Start thread The modules are managed by the kernel this later is responsible of initializing the modules initializing hardware resources relative to the modules and initializing the system menu Each module should provide the following functionalities and properties Graphical component structure Method to startup the module Method to manage low power mode optional The application task The module background process optional Specific configuration 7 Error management oak wn gt The modules can be added in run time to the demonstration and can use the common kernel resources The following code shows how to add a module to the demonstration DoclD028080 Rev 1 33 37 Kernel description UM1919 34 37 260 void kModule Init void 261 Bf 262 kModule_Add MODULE_MAIN_APP ModuleAppMain 263 kModule Add MODULE_IDDMEASURE ModuleIddMeasure 264 kModule Add MODULE_BATTERYMEASURE ModuleBatteryMeasure kModule_Add MODULE_COMPASS ModuleCompass kModule_Add MODULE_SOUNDMETER ModuleSoundMeter
20. ion mechanisms enters automatically in low power modes in case of inactivity and wake up in case of end user interaction with the joystick USB supply The following jumper setup is mandatory for running the demonstration powered by the USB ST LINK e Jumpers RST JP3 ST LINK CN3 present e Jumper JP5 on IDD e Jumper JP6 on 3V3 Battery supply The following jumper setup is mandatory for running the demonstration powered by the battery see Figure 4 e Jumpers RST JP3 ST LINK CN3 removed e Jumper JP5 on IDD e Jumper JP6 on BATT And of course it insures that a CR2032 battery is present at the rear of the board 2 DoclD028080 Rev 1 UM1919 Demonstration firmware package 3 3 1 2 Demonstration firmware package Demonstration repository The STM32CubeL4 demonstration firmware for 32L476GDISCOVERY discovery kit is provided within the STM32CubeL4 firmware package as shown in Figure 5 Figure 5 Folder structure STM32Cube_FW_L4_VXY Z B _htmresc 6 Documentation Gy Drivers pp BSP fp CMSIS G8 J STM32L amp x HAL Driver E Ji Middlewares g ST Beds Third Party E Ji Projects d STM32L476G Discovery E Lj Applications JE PO j D Demo folder jo ij Be EEl Jj STM32L476G EVAL Bj STM32L476RG Nucleo meg WIN32 4 STM32CubeProjectsList html El J Utilities i 6 CPU 4 1s Fonts Hj Log Jj Media Ey PC Software Re
21. lease_Notes html DocID028080 Rev 1 11 37 Demonstration firmware package UM1919 3 2 12 37 The demonstration sources are located in the projects folder of the STM32Cube package for each supported board The sources are divided into five groups described as follows e Binary demonstration binary file in Hex format e Config all middleware components and HAL configuration files e Core contains the kernel files e Modules contains the sources files for main application top level and the application modules e Project settings a folder per tool chain containing the project settings and the linker files Demonstration architecture overview The STM32CubeL4 demonstration firmware for 32L476GDISCOVERY discovery kit is composed of a central kernel based on a set of firmware and hardware services offered by the STM32Cube middleware discovery board drivers and a set of modules mounted on the kernel and built in a modular architecture Each module can be reused separately in a standalone application The full set of modules is managed by the Kernel which provides access to all common resources and facilitates the addition of new modules as shown in Figure 6 Each module should provide the following functionalities and properties Display characteristics The method to startup the module The method to close down the module for low power mode The module application core main module process The specific configuration The er
22. mory requirement in case of suppression or addition of a module or feature The footprint information is provided for the following environment e Tool chain IAR 7 40 1 e Optimization high size e Board STM32L476G discovery Table 12 shows the code memory data memory and the constant memory used for each application module file and related libraries Table 12 Modules footprint Module Code Byte Data byte Const byte IDD 832 237 264 VDD 324 142 68 RECORD 1112 68 PLAYER 1212 68 COMPAS 1052 108 124 SOUND 638 3932 508 SoundMeter library 4338 12 8 GUITAR 592 12416 236 GuitarTuner library 6704 248 Main application Top menu 274 276 376 Option submenu DoclD028080 Rev 1 31 37 Kernel description UM1919 7 7 1 7 2 7 3 32 37 Kernel description Overview The role of the demonstration kernel is mainly to provide a generic platform that controls and monitors all the application processes with minimum memory consumption The kernel provides a set of friendly services that simplifies module implementation by allowing access to all the hardware and firmware resources through the following tasks and services e Hardware and modules initialization BSP initialization LEDs joystick keys LCD audio Quad SPI and compass e Main menu management e Memory management e Storage management Quad SPI Flash memory e System settings Kernel initialization
23. ng the board components with their respective lOs in low power mode and then setting the MCU in low power consumption The mutex DemoLowPowerMutex is released upon wake up from an EXTI lines associated to joystick buttons DoclD028080 Rev 1 2 UM1919 Demonstration firmware settings 5 5 4 2 Heap The Heap size is defined in FreeRTOSConfig h as follows define configTOTAL HEAP SIZE size_t 40 1024 Heap usage in the firmware demonstration is dedicated to e OS resources tasks queues mutexes memory allocation e Application memory allocation requirements Table 11 Heap usage Memory requirements Applications Description Function File bytes AudioRecorder Start Audio Record Record buffer 1024 Audiorecorder c GuitarTuner Run Guitar tuner Record buffer Guitartuner c 4096 Guitar tuner Processing buffer used GuitarTuner Init 16 Kbvtes Guitar tuner library by Guitar tuner library Guitartuner c y Soundmeter Record buffer SoundMeter_Run 960 Soundmeter c Soundmeter Processing buffer used SoundMeter_Init lt 6 Kbytes Soundmeter library by Soundmeter library Soundmeter c y The demonstration firmware implements a hook in main c to control the memory allocation in the heap E brief Application Malloc failure Hook 119 param None 1198 retval None iz Lie Le 2 void vApplicationMallocFailedHook void
24. on Features e Low power mode selection Stop2 the MCU enters automatically into Stop2 mode after X seconds of inactivity Disable the MCU never enters in low power mode except in IDD demonstration The disable mode is available when running in USB powered mode and not in battery mode to not empty the battery e Demonstration version about Display STM32L476G discovery firmware version and copyright Audio player control Within the audio player application the joystick key functions are enhanced and are described in the following Table 4 Table 4 Audio player control joystick key functions Joystick key Function Brief description Changes the audio player state to AUDIOPLAYER PLAY Reads the wave file from the storage Flash memory Sets the frequency RIGHT Play Starts or resumes the audio task Starts playing audio stream from a data buffer using BSP AUDIO OUT Play function in BSP audio driver Pause Suspends the audio task when playing and pauses the audio file SEL R stream TE Resumes the audio task and the audio file stream when suspended DoclD028080 Rev 1 23 37 Demonstration functional description UM1919 Table 4 Audio player control joystick key functions continued Joystick key Function Brief description Closes the wave file from storage flash memory ds th dio task LEFT Stop amp Exit auspende Mando tas Stops a
25. ons Compass PLLSAI1 Player PLLSAI1_VCO 8 MHz PLLSAMN 8 43 Record VCO_344M SHAH meter Sound meter SAI CK x PLLSAI1_VCO PLLSAI1P 344 7 Cui 49 142 MHz uitar tuner DoclD028080 Rev 1 25 37 Demonstration firmware settings UM1919 5 2 5 3 26 37 Peripherals The following peripherals are used in the demonstration firmware Table 7 Used peripherals Used peripherals Application module ADC VDD application CRC Audio applications DFSDM Audio record applications DMA Audio player and record applications EXTI Menu navigation joystick low power mode audio applications Storage in Audio player application FLASH System settings Low power mode application GPIO All applications 12C Low power mode application IWDG Internal Watchdog FW reset in case of error LCD LCD glass display PWR Low power mode application RCC All applications QSPI Audio player and record applications SAI Audio applications SPI Compass application Interrupts wakeup pins The following interrupts are used in the demonstration firmware Table 8 Demonstration firmware interrupts Interrupts Application module PIU TUE NONY highest 0 0 DMA1 Channel1 Audio applications SAI1 5 0 DMA1 Channel4 Audio applications DFSDMO 6 0 EXTI Line 0 Joystick SEL key 15 0 EXTI Line 1 Joystick LEFT key 15 0 EXTI Line 2 Joystick RIGHT key 15 0 EXTI Lin
26. pplication allows to demonstrate the perfect integration of an acoustic Guitar tuner audio library It uses the audio recording capability of the digital microphone embedded on the STM32L476G discovery board Figure 18 Guitar tuner application menu selection and display Status Status Status could be any of the following display outputs audio sample invalid Ensure that STM32L476G discovery board is close to the guitar e OK string in tune e string needs to be tightened e string needs to be tightened but close to be in tune e string is too tightened e string is too tightened but close to be in tune Features e Standard tuning type of 6 acoustic guitar strings e Input 16 bits PCM data with a sample rate at 8 kHz mono e Precision lower than 0 5 Hz e Realtime display every 256ms The standard tuning method is based on the following expected frequencies per string Table 3 Frequencies per string String 1 Hz String 6 Hz the thickest String 2 Hz String 3 Hz String 4 Hz String 5 Hz the thinnest string string E1 82 41 A1 110 D2 146 83 G2 196 B2 246 94 E3 329 63 DoclD028080 Rev 1 Ly UM1919 Demonstration functional description 4 4 8 4 5 2 Option Overview The option menu level provides the system control and information about the demonstration firmware Figure 19 Option menu selection and display Versi
27. ror management Oa kPwN gt Figure 6 Demonstration architecture overview Kernel Module System Module Audio Player Sound Meter manager manager Input and HMI Storage manager manager Guitar Tuner RTOS FreeRTOS Middleware Hardware Abstraction Layer Boards Support Packages Drivers i s STM32 hardware Demo specfic components DoclD028080 Rev 1 Ly UM1919 Demonstration firmware package 3 2 1 Kernel core files Table 1 lists the kernel core files covering the startup interrupts management and kernel core services Table 1 Kernel core files Function Description main c Main program file stm32l4xx it c Interrupt handlers for the application k menu c Kernel menu and desktop manager k module c Modules manager k startup c Demonstration startup windowing process startup stm32l476xx s Startup file Ky DoclD028080 Rev 1 13 37 Demonstration firmware package UM1919 3 3 14 37 STM32L476G discovery board BSP The board drivers available within the stm321476g discoveryXXX c h files see Figure 7 implement the board capabilities and the bus link mechanism for the board components LEDs buttons audio compass glass LCD Quad SPI Flash memory etc Figure 7 Discovery BSP structure iJi BSP J Adafruit_Shield 5 15 Components STM32L476G Discovery m STM32L476G Discovery BSP User Manual chm i stm32476g discovery c stm32
28. ructure 2 0 hr 14 Demonstration top menu o 15 IDD application menu structure display oooooocooooor eee ee 17 IDD mode selection and result value oooooooocoo ee 18 VDD application menu selection and result value 2 020000 cece eee 18 Audio record application menu selection 0000 0c eee eee eee eee 19 Audio recorder architecture 0 000 cece eee 19 Audio player application menu selection 000 00 cece ee 20 Audio player architecture 2 00 teens 20 Compass application menu structure and display 000000 eee oo 21 Sound meter application menu selection and display 22 20000e 21 Guitar tuner application menu selection and display 02000e0 eee 22 Option menu selection and display l l 23 Low power scheme o 27 DoclD028080 Rev 1 5 37 STM32Cube overview UM1919 6 37 STM32Cube overview The STMCube initiative was originated by STMicroelectronics to ease developers life by reducing development efforts time and cost STM32Cube covers the STM32 portfolio STM32Cube Version 1 x includes e The STM32CubeMNX a graphical software configuration tool that allows generating C initialization code using graphical wizards e A comprehensive embedded software platform delivered per series such as STM32CubeL4 for STM32L4 Series The STM32CubeL4 HAL an STM32 abstraction layer embedded softwar
29. tures e 48 kHz audio recording in wav format e Audio file stored in the Quad SPI Flash memory N25Q128A13 The LED LD5 blinks continuously during the recording Press the joystick LEFT key to stop recording and exit from the application mode Use player application to playback the audio recording samples Architecture Figure 13 shows the different audio player parts and their connections and interactions with the external components Figure 13 Audio recorder architecture DoclD028080 Rev 1 19 37 2 Demonstration functional description UM1919 4 4 4 20 37 Audio player Overview The audio player module application allows to demonstrate the audio capability of the STM32L476VGT6 MCU with earphones plugged in the 3 5mm audio output jack mounted on the STM32L476G discovery board Figure 14 Audio player application menu selection PLAYER Select the audio source to start up the playback Features e Audio is played in wav format e The audio file selection is done either from the internal Flash memory or Quad SPI Flash memory Internal Flash memory Download file at address 0x08020000 with ST Link Utility Quad SPI Flash memory Audio source available after execution of the audio Record application e Volume up down is controlled with the joystick UP DOWN keys e Playback may be paused resumed with the joystick SEL key Architecture F
30. udio playing Changes the audio player state to AUDIOPLAYER_STOP UP Volume Up Increases the volume DOWN Volume Decreases the volume Down 24 37 DoclD028080 Rev 1 Ly UM1919 Demonstration firmware settings 5 Demonstration firmware settings 5 1 Clock control 2 The demonstration firmware takes benefit of the STM32L476VGT6 clock tree by selecting dynamically the clock configuration required by the running application module when running in low power mode The following clock configurations are used in the demonstration firmware Table 5 Clock configurations Clock configuration SYSCLK 2MHz MSI LPRUN voltage range 2 Application module USB powered Application module battery Demonstration startup IDD application SYSCLK 16MHz PLL from MSI 16MHz RUN voltage range 2 Sound Meter Compass SYSCLK 80MHz PLL from MSI 8MHz RUN voltage range 1 Demonstration startup All applications The following oscillators and PLL are used in the demonstration firmware Table 6 Oscillators and PLL description Oscillators MSI from 2MHz to 16MHz Application module USB powered Demonstration startup Application module battery Demonstration startup IDD application Sound meter Compass LSE LCD glass display LCD glass display Internal Watchdog LSI for automatic FW reset E error management Demonstration startup Sound meter PLL main Lr All applicati
Download Pdf Manuals
Related Search
Related Contents
DELL Precision T1700 86 tlg. Minibohrmaschinenset 86 pcs. Mini drill set Set de mini Technik-Informationen / Funktionsweise / Parameter Visio-Manuel Pro Misermatic Installation & User Manual Navigationssystem VP-12S3 Downloading - CERT-TRAK Copyright © All rights reserved.
Failed to retrieve file