Getting Started with X-CUBE-NFC4

Sep 1, 2020 11:23 · 1391 words · 7 minute read 1 interrupt lines component nfc4

Getting Started with X-CUBE-NFC4 In this webinar we will see an introduction to STM32Cube the list of the required hardware and software tools how to install an STM32Cube Expansion Package in STM32CubeMX how to get started with the X-CUBE-NFC4 in STM32CubeMX Introduction to STM32Cube STM32Cube is the Software Ecosystem for STM32, made and supported by STMicroelectronics, and proposed to all STM32 developers for free. It combines a set of PC software development tools and a set of embedded software bricks. STM32CubeExpansion packages provides an easy and powerful way to integrate additional components to the project, such as drivers for other ST components (sensor for instance) or middleware components. The latest STM32CubeExpansion specifications offer the ability to configure and integrate these components directly into the project from STM32CubeMX and STM32CubeIDE. The embedded software environment for STM32 offers the standard STM32Cube MCU packages (such as STM32CubeF4, STM32CubeH7 or STM32CubeL5…).

01:38 - STM32Cube Expansion packages extend it with additional software components enabling high-level application solutions. Those packages can come: - from STMicroelectronics, to support digital or high-level software component from ST portfolio (eg : NFC, MEMS, Bluetooth or even AI). - from ST Partners or third parties - from communities and education programs, or from your own, personal or professional, to share embedded software components with each other or just within restricted groups. The STM32Cube Expansion guidelines are publicly available on www.st.com/stm32cube Required hardware and software You need an ST Nucleo board or any evaluation board equipped with an STM32MCU on the ST Nucleo board you have flexible board power supply through USB or external source integrated ST-Link/V2-1 for mass storage device flash programming 2 push buttons and 2 color LEDs the Arduino connectors to easy access to add-ons the STM32 MCU the Morpho extension headers to directly access the MCU pinout In this webinar we will use a Nucleo-F401RE You need the ST X-NUCLEO-NFC04A1 expansion board equipped with the ST25DV04K On this board you have also the Arduino connectors to easy access to add-ons The X-NUCLEO-NFC04A1 embeds ST25DV04K, NFC Type V/RFID tag IC with a dual interface 4 Kbits EEPROM.

03:32 - A NFC enabled Android™ or iOS™ device ,connected to an internet is required for the demo Finally, you need the latest STM32CubeMX tool, available on st.com, installed on your PC. How to install an STM32Cube Expansion Package in STM32CubeMX Launch the STM32CubeMX on your PC Click the INSTALL/REMOVE button Go to STMicroelectronics tab Expand the pack you need to install (e.g. the X-CUBE-NFC4 or the X-CUBE-GNSS1 etc) Click the Refresh button to retrieve all the available pack versions Select the version you want to install (it is suggested to install the latest one) Click the Install Now button to install the selected pack version To successfully complete the installation process, accept the license terms and click Finish The green box indicates that the pack has been successfully installed Close the window. Getting Started with X-CUBE-NFC4 in STM32CubeMX To set up a new project, the user can start either selecting an MCU or an ST board As previously said, in this webinar we will use the ST Nucleo-F401RE board To easily find it in the ST board list, use some filter Check the Nucleo-64 box in the board Type list and the STM32F4 box in the MCU Series list Once you find your board, double click on it start the project Click Yes to initialize all peripherals with their default mode From the Pinout view it is possible to Configure the MCU pins Enable the Peripherals Clicking the Software Packs menu it is also possible to include additional software components to the project Just expand the line of the STM32 Expansion Package components you want to add And start to select the components The best way to get familiar with an STM32Cube Expansion Package is generating one of the included sample applications For example, select the NDEF_URI sample application Double clicking the Application row, some useful information are displayed You can open the the Getting Started Guide containing all the information on how to set up a project using the X-CUBE-NFC4 components. You can find, for instance, the sample application descriptions and the Configuration Steps with the information on the pins, the peripherals and the middlewares to use for generating one of the sample applications or your own project using either an ST board or a custom board equipped with any STM32 MCU.

06:16 - After selecting the sample application all the required software components can be easily detected from the Component dependencies window. Clicking each row with the yellow icon, you can solve all the component dependencies. select the Basic component variants with the default implementation. When all the dependencies are solved, a green icon appears close to the each component. Click Ok to save your component selection. Now the pinout configuration can start using the information contained in the Getting Started guide. Open it and take note of the pins, peripherals and middlewares that must be enabled and configured From this picture, in particular, you can get the information on how to configure the pins and the I2C bus used by the STM32 MCU to communicate with the ST25DV device. Hence, on your Nucleo 64-PINs board, you’ll have to use the PA_8 and PA_9 pins for the I2C SCL and SDA, the PA_6 for the GPO pin, the PA_8 for LPD pin the PB_4, PB_5 and PA10 for the Green, Blue and Yellow LED So, after getting all the useful information, you can start the pinout configuration. Set PB_8 and PB_9 as I2C1 SCL and SDA Set PA_6 as GPIO_EXTI6 and PA_8 as GPIO_Output Set PA_10 as GPIO_Output for YELLOW LED Set PB_5 as GPIO_Output for BLUE LED Set PB_4 as GPIO_Output for GREEN LED Now enable the I2C1 from the Connectivity list Check that the I2C Speed Mode is set to Fast Mode, and I2C Clock Speed (Hz) is set to 400KHz Going back to the Pinout & Configuration we can move to configure the NFC components clicking on Software Packs and then on STMicroelectronics.X-CUBE-NFC4 pack. Select all the NFC components and associate peripherals and pins to their proper function: - the YELLOW LED to the PA_10 - the BLUE LED to the PB_5 - the GREEN LED to the PB_4 - the NFC4 GPO PIN to the PA_6 - the NFC4 LPD PIN to the PA_8 - and finally NFC04A1 BUS IO Driver to the I2C1 Clicking the System View the user can access the NVIC section to enable the interrupt lines.

08:52 - Hence, enable the EXTI line6 for the GPO external interrupt For any further check on all other settings, the sections in System View (System Core,…, Connectivity,…) can be accessed. Now click the Project Manager tab Insert your project name. Set the Project Location on your file system. You can also select the folder structure of the generated project: using Basic all application files are generated under Src and Inc folders, while with Advanced the generated files are grouped in different folders (App, Target, Core). Select your preferred toolchain among the list of the supported ones.

09:35 - In this example we use the STM32CubeIDE (without the Under Root option). Now we are ready to generate the code clicking the GENERATE CODE button. Wait few seconds… … and click Open Project to open the generated STM32CubeIDE project. The STM32CubeIDE will start opening… Once the STM32CubeIDE is open, a pop-up will show the project import status. Close the pop-up expand the project structure and browse the generated code (where you can find the application, the driver and the middleware files).

10:55 - Build the project to generate the binary file. The Console output in the IDE shows the logs of the build process Wait until the build process finishes… After connecting your STM32 development board to your PC, flash it with the generated binary file Right-click on the project name and select the Run As –> STM32 Cortex-M C/C++ Application Accept the default settings in the Edit Configuration clicking OK The flashing process will start (its progress is shown in the Console output) Once the flashing process has successfully terminated Enable NFC on your phone and make sure it is also connected to the internet, Bring the phone close to the X-NUCLEO-NFC04A1 Antenna You are directly redirected to www.st.com. For more information, please, visit www.st.com/stm32cubemx .