cancel
Showing results for 
Search instead for 
Did you mean: 

How to Modify RFAL Library for ST25R3918 Without ST25R3916_CMD_TEST_ACCESS Register

zeynepdicle
Associate III

I am using the ST25R3918 and the 'pollingTagDetect' example from the RFAL library. This chip does not have the ST25R3916_CMD_TEST_ACCESS register.

How can I modify this library?

This discussion has been locked for participation. If you have a question, please start a new topic in order to ask your question
1 ACCEPTED SOLUTION

Accepted Solutions
Brian TIDAL
ST Employee

Hi,

the ST25R3916 RFAL library is designed for ST25R3916 and its derivative (such as ST25R3918). It is not needed to modify the ST25R3916 library for ST25R3918.

Rgds

BT

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

32 REPLIES 32
Brian TIDAL
ST Employee

Hi,

the ST25R3916 RFAL library is designed for ST25R3916 and its derivative (such as ST25R3918). It is not needed to modify the ST25R3916 library for ST25R3918.

Rgds

BT

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Hi again Mr. Brian,
 
My NFC board has an ST25R3918, and this antenna is single-ended. In my code, I added the following function:
 
st25r3916WriteRegister(ST25R3916_REG_IO_CONF1, (ST25R3916_REG_IO_CONF1_single | ST25R3916_REG_IO_CONF1_rfo2 | ST25R3916_REG_IO_CONF1_out_cl_disabled | ST25R3916_REG_IO_CONF1_lf_clk_off_on)); 
rfalAnalogConfigInitialize(); 
rfalInitialize(); 
while (1) { 
rfalFieldOff(); 
platformDelay(500); 
rfalNfcaPollerInitialize(); 
rfalFieldOnAndStartGT(); 
....
 
Also, in the platform.h file, I added:
 
 
#define ST25R3916 
#define ST25R_SELFTEST 
#define ST25R_SELFTEST_TIMER 
#define ST25R_COM_SINGLETXRX /*!< Use single Transceive */ 
#define ST25R_SS_PIN GPIO_PIN_4 /*!< GPIO pin used for ST25R SPI SS */ 
#define ST25R_SS_PORT GPIOA /*!< GPIO port used for ST25R SPI SS port */ 
#define ST25R_INT_PIN GPIO_PIN_5 /*!< GPIO pin used for ST25R External Interrupt */ 
#define ST25R_INT_PORT GPIOC /*!< GPIO port used for ST25R External Interrupt */ #define platformProtectST25RComm() do { globalCommProtectCnt++; __DSB(); NVIC_DisableIRQ(EXTI9_5_IRQn); __DSB(); __ISB(); } while(0) 
#define platformUnprotectST25RComm() do { if (--globalCommProtectCnt == 0U) { NVIC_EnableIRQ(EXTI9_5_IRQn); } } while(0)
 
I am not sure if these definitions are correct. Are they correct?
Brian TIDAL
ST Employee

Hi,

ST25R3916 ,ST25R_SELFTEST , ST25R_SELFTEST_TIMER are usually defined at compiler level (-D) rather than in platform.h.
 
Your st25r3916WriteRegister setting will be overwritten by the analog setting. you should rather modify rfal_analogConfigTbl.h or the custom analog config file:
search for RFAL_ANALOG_CONFIG_TECH_CHIP | RFAL_ANALOG_CONFIG_CHIP_INIT in the table and adjust the ST25R3916_REG_IO_CONF1 register according to your hardware setup.
 
Rgds
BT
 
In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hi again, I am grateful for your help thank you so much.

In the code below, after the ST25R3916_IRQ_MASK_WT interrupt, platformErrorHandle is triggered. However, when I don't activate ST25R_SELFTEST, ST25R3916_IRQ_MASK_GPE does not trigger in st25r3916.c file. But, when I activate the second ST25R3916_IRQ_MASK_GPE, platformErrorHandle is triggered. What could be the reason for this?

Brian TIDAL
ST Employee

Hi,

errors triggered inside ST25R_SELFTEST code are the helpers to debug porting issues. The ST25R_SELFTEST checks first that the SPI communication is operational (write a pattern to a register and read it back) and then causes an interrupt from the device and checks the proper handling of the ST25R interrupt. It seems the ST25R interrupt is not properly handled on your platform. 

Make sure:

  • the ST25R interrupt pin is properly connected to the MCU GPIO
  • this GPIO is properly configured in interrupt mode (i.e. External Interrupt Mode with rising edge detection)
  • the Interrupt Service Routine properly calls st25r3916Isr() (see EXTI0_IRQHandler in stm32f4xx_it.c)
  • platformProtectST25RComm/platformProtectST25RIrqStatus properly protect unique access (on bare metal, it is usually done by temporarily disabling the interrupt)

Rgds

BT

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

I didn't add st25r3916Isr() in EXTI0_IRQHandler(void). I added then ST25R_SELFTEST doesn't error thank you but ST25R_SELFTEST_TIMER has a error. 

Brian TIDAL
ST Employee

Hi,

ST25R_SELFTEST_TIMER checks that platformTimer/platformGetSysTick macros are properly implemented. It starts a 20 ms General Purpose Timer on the ST25R device and checks that the timer expires in 20 ms +/- 2 ms.

It is likely that the SYSTICK on your board is not accurate or does not have the proper 1ms value. Do you use an HSE crystal oscillator or an HSI internal RC oscillator? Just toggle a GPIO inside the SysTick_Handler and probe it with a scope to check the value of the SYSTICK. 

Rgds

BT

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hi,

I use an HSI internal RC oscillator. I check SysTick_Handler and it seems okay.

Rgds

ZD

Hi,

can you connect a logic analyzer on the SPI (CLK/MISO/MOSI/SS) + IRQ_ST25R + SYSTICK GPIO (toggling every 1 ms) and send me the trace? what is the duration between the Start General purpose timer direct command and the IRQ_ST25R  interrupt?

Rgds

BT

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.