2019-09-13 09:00 AM
I'm working on a project that involves NFC communications, so I bought the two product listed in the title to start prototyping. The first step in my plan was to get some sample code running, so I downloaded the X-CUBE-NFC5 package. However, it's unclear to me how to import the source code into a project. I'm using the STM32CubeIDE. Since I'm not using one of the Nucleo dev boards with a pre-built binary, I can't just flash a .bin file, but even if I was, I would still need the example code working to base my application off of.
So far, I've tried bringing in source and header files one folder at a time to resolve "file/path not found" errors on "include" lines. It's a slow process, but after fixing a few typos and mysterious errors, I ran into an issue I can't fix: the assembly (*.s) files in the Startup folder are written in the armasm syntax, but the arm-none-eabi-gcc assembler only accepts GNU syntax, so each line comes up as an error (including comments). I tried transplanting a startup file from a working project to no success; I could work on this more but I feel I'm on the wrong track. This was in a new, empty C project, but I had similar results in an STM32 project.
My main point of confusion is that the X-CUBE-NFC5 package is described as a "software expansion"--is there a straightforward way to "install" it into STM32Cube? NFC4 is available for download from the graphical configurator, but I assume this is the wrong version.
Any guidance/pointers appreciated.
Solved! Go to Solution.
2019-09-23 09:43 PM
Hello,
Regarding the point of confusion related to CubeMX. Only NFC4 source code ie for (X-NUCLEO-NFC04A1) is generated with CubeMX .NFC5 is not integrated ,Hence not generated with CubeMX .
For NUCLEO-L433RC, you may take reference of NUCLEO-L476RG over X-NUCLEO-NFC05A1 (available in X-CUBE-NFC5) using SW4STM32 as SW4STM32 is provided as one of the toolchain of GCC similar to STM32CubeIDE.
1.Startup file for CubeIDE or SW4STM32 should point to Drivers\CMSIS\Device\ST\STM32L4xx\Source\Templates\gcc\startup_stm32l433xx.s
Also the CMSIS Device Peripheral Access Layer Header File should be replaced with stm32l443xx.h instead of stm32l476xxh, present in ->(Drivers\CMSIS\Device\ST\STM32L4xx\Include)
2.Linker file for L433RC can be generated with CubeMX
3.The main difference between NUCLEO-L476RG and NUCLEO-L433RC, while using X-NUCLEO-NFC05A1 is the SPI Instances and its pinout
NUCLEO-L476RG NUCLEO-L433RC
SPI1 SPI2
PA5->SCLK PB13->SCLK
PA6 -> MISO PB14--> MISO
PA7-->MOSI PB15--> MOSI
SS_MCU-->PB6 SS_MCU-->PA11
PA8-->TX-LED06) PC7--> TX-LED06
PB5-->LED5 PB5-->LED5
PB4-->LED4 PB4-->LED4
PA1-->LED1 PA1-->LED1
PA4-->LED2 PC3-->LED2
PB0-->LED3 PC2-->LED3
IRQ--> PA0 IRQ--> PA0
2019-09-15 04:52 PM
One weekend of trial and error, and I've got it working. I found success by creating a new STM32 project, configuring the ports/pins for my device, then hand-merging the source files from the "Project" directory in the downloaded zip. This allowed me to use the correct SPI peripheral, for instance (SPI2 on my chip, not SPI1), and permitted use of the graphical configurator. Putting the correct pins in "platform.h", copying the interrupt handler function into the interrupt table, and setting up the main function were the main steps; "spi.c" and others work as-is. I also had to copy the rfal and ST25R3911 board-support folders into the project and add them as include/source paths.
My only issue now (besides the serial-link logging not working) is that every time I generate code from the graphical configurator, removes the 3911 and rfal folders from the list of includes. I have to re-add them by hand each time I change the peripheral setup; this won't work for development. Is there a way to add the rfal middleware and the 3911 board support package to STM32CubeIDE? The built-in package manager doesn't work for this (zip file in the wrong format, NFC5 not in the online repo). Failing that, a way to persistently/permanently add an include/source directory would work as well.
2019-09-23 09:43 PM
Hello,
Regarding the point of confusion related to CubeMX. Only NFC4 source code ie for (X-NUCLEO-NFC04A1) is generated with CubeMX .NFC5 is not integrated ,Hence not generated with CubeMX .
For NUCLEO-L433RC, you may take reference of NUCLEO-L476RG over X-NUCLEO-NFC05A1 (available in X-CUBE-NFC5) using SW4STM32 as SW4STM32 is provided as one of the toolchain of GCC similar to STM32CubeIDE.
1.Startup file for CubeIDE or SW4STM32 should point to Drivers\CMSIS\Device\ST\STM32L4xx\Source\Templates\gcc\startup_stm32l433xx.s
Also the CMSIS Device Peripheral Access Layer Header File should be replaced with stm32l443xx.h instead of stm32l476xxh, present in ->(Drivers\CMSIS\Device\ST\STM32L4xx\Include)
2.Linker file for L433RC can be generated with CubeMX
3.The main difference between NUCLEO-L476RG and NUCLEO-L433RC, while using X-NUCLEO-NFC05A1 is the SPI Instances and its pinout
NUCLEO-L476RG NUCLEO-L433RC
SPI1 SPI2
PA5->SCLK PB13->SCLK
PA6 -> MISO PB14--> MISO
PA7-->MOSI PB15--> MOSI
SS_MCU-->PB6 SS_MCU-->PA11
PA8-->TX-LED06) PC7--> TX-LED06
PB5-->LED5 PB5-->LED5
PB4-->LED4 PB4-->LED4
PA1-->LED1 PA1-->LED1
PA4-->LED2 PC3-->LED2
PB0-->LED3 PC2-->LED3
IRQ--> PA0 IRQ--> PA0