2021-03-01 11:32 PM
STM32L476VG is the MCU we are interfacing with ST25R3911B using SPI.
what we have understood from some search is that we need RFAL (abstraction layer) to interface with RF HAL.
Then once we integrate RFAL and RF HAL in our system workbench(ac6) project we need to build the integration then use SPI calls to read the register from RFID reader ST25R3911B
we wanted to use ISO-14443A standard to be configured and read the values.
where do we get the basic RFAL work space or code flow so that we shall use in our current project?
Kindly guide us and let us know are we in right path?
Solved! Go to Solution.
2021-03-04 04:49 AM
Hi Ravi,
uint8_t globalCommProtectCnt = 0U; has to be defined in your main.c (see the reference main.c used in the polling demo).
I had a look to your main(). Please make sure to read back the ST25R3911_REG_BIT_RATE register value to verify the value has been properly written. Also, as explained in my previous posts, make sure to add the various initializations that are in /* USER CODE BEGIN 2 */ in particular spiInit(&hspi1);. Without those initializations, the SPI communication and the logging in the RFAL will fail.
demo.c and demo.h are needed. Once the SPI will be working, make sure to remove your register write test code and to add the demoCycle() in the main loop.
Rgds
BT
2021-03-04 09:16 AM
Hi BT,
I added uint8_t globalCommProtectCnt = 0U; in main.c and the compiling went well.I will make sure to read back register..and also on initialization.
But why do we require demo.c and demo.h in our custom environment because we do not want to do ant platformledoff, and platformGpioIsLow..
If I add demo.c and demo.h I see lot of places where certain define are not defined..we are seeing these errors
#define PLATFORM_LED_A_PIN LED_A_Pin /*!< GPIO pin used for LED A */
#define PLATFORM_LED_A_PORT LED_A_GPIO_Port /*!< GPIO port used for LED A */
#define PLATFORM_LED_B_PIN LED_B_Pin /*!< GPIO pin used for LED B */
#define PLATFORM_LED_B_PORT LED_B_GPIO_Port /*!< GPIO port used for LED B */
#define PLATFORM_LED_F_PIN LED_F_Pin /*!< GPIO pin used for LED F */
#define PLATFORM_LED_F_PORT LED_F_GPIO_Port /*!< GPIO port used for LED F */
#define PLATFORM_LED_V_PIN LED_V_Pin /*!< GPIO pin used for LED V */
#define PLATFORM_LED_V_PORT LED_V_GPIO_Port /*!< GPIO port used for LED V */
#define PLATFORM_LED_AP2P_PIN LED_AP2P_Pin /*!< GPIO pin used for LED AP2P */
#define PLATFORM_LED_AP2P_PORT LED_AP2P_GPIO_Port /*!< GPIO port used for LED AP2P*/
LED_A_PIN not declared..likewise...
so is demo.c really required??
Kindly let us know
regards
Ravi
2021-03-04 09:54 AM
Hi Ravi
as explained in previous post, for the LED pin you can define fake pin if not used on your custom board (i.e. just assign to an unused GPIO).
demo.c provides the basic steps to communicate with a tag in respect with NFC protocol. This is usually used as a basis for customer applications i.e. this is used as a skeleton where one adds its specific application.
Feel free to share more information about your application that we can support you accordingly.
Rgds
BT
2021-03-04 08:25 PM
Hi BT,
Thanks for your response.Our current application need is ST25R3911 which would be connected to antenna where we want to read RFID cards and ST25R will generate interuppt to STM32L476VG so that we shall read the value through SPI.I was able to compile with demo.c along with the project.
I have also attached main.c where I have made changes in SPI..now can I do a dummy SPI write and SPI read to check whether SPI is working fine.kindly Let me know
regards
Ravi
2021-03-05 12:50 AM
Hi Ravi,
yes you can do a dummy SPI read write to check the SPI communication with the ST25R3911.
For the next step, make sure to
Then I recommend again to call demoIni as part of /* USER CODE BEGIN 2 */ and to add demoCycle in the while (1) loop (/* USER CODE BEGIN WHILE */) to run the various steps of the NFC protocol.
Rgds
BT
2021-03-08 07:28 AM
HI BT,
I have include demoIni() and democycle as part of main.c but I am getting following errors
undefined reference to `rfalNfcGetDevicesFound
undefined reference to `rfalNfcSelect' ..I have include demo.c and in that rfal_nfc.h as #include "..\..\Middlewares\ST\rfal\Inc\rfal_nfc.h" as this is the structure of my project...still did not understand why I got this error.
also once this is integrated can I use st25r3911WriteRegister( ST25R3911_REG_BIT_RATE, ST25R3911_TEST_REG_PATTERN ); so that I can do dummy SPI read and write
is this correct? ..or any other code snippet...this is withour IRQ interrupt pin.Kindly suggest us.
regards
Ravi
2021-03-08 07:50 AM
Hi Ravi
I would suggest that you copy into your project the include paths from the reference project.
Then, also make sure to add the following include in your main.c:
/* USER CODE BEGIN Includes */
#include "demo.h"
#include "platform.h"
#include "spi.h"
#include "usart.h"
#include "logger.h"
#include "st_errno.h"
#include "rfal_nfc.h"
/* USER CODE END Includes */
Rgds
BT
2021-03-08 08:30 AM
2021-03-08 08:54 AM
Hi,
as explained in my previous post, I suggest that you update the include paths of your project from the demo project.
Rgds
BT
2021-03-08 09:44 AM