Skip to main content
Associate II
September 25, 2023
Solved

ST25R3918 Read Register Shift Right

  • September 25, 2023
  • 4 replies
  • 1687 views

Hello,

I'm working on a project where I'm using the ST25R3918 with RFAL libraries. Initially, I read the IC identity register and performed a right shift. Why did I perform this right shift?

I modified the read register function, added a right shift, and successfully read the correct registers. However, my code is now not functioning correctly.

What steps should I take to resolve this issue?

This version maintains the same information while improving the clarity and correctness of the sentences.

This topic has been closed for replies.
Best answer by Brian TIDAL

Hi,

as explained by Ulysses, make sure your SPi is properly configured. See chapter §4.3.3 Serial peripheral interface in the datasheet. If using CPOL = Low then  CPHA should be 2 Edge.

Rgds

BT

4 replies

Brian TIDAL
Technical Moderator
September 25, 2023

Hi,

do you mean you have modified the st25r3916ReadRegister function inside the RFAL? I would recommend to not modify the RFAL source.

For your information, the IC identity register is checked during the RFAL initialization. Can you share more details on why you need to read it ?

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.
Associate II
September 25, 2023

yes, when I modified st25r3916ReadRegister it read like this
modiRead.PNG


when I didn't modified st25r3916ReadRegister it read like this
notModiRead.PNG


Brian TIDAL
Brian TIDALBest answer
Technical Moderator
September 25, 2023

Hi,

as explained by Ulysses, make sure your SPi is properly configured. See chapter §4.3.3 Serial peripheral interface in the datasheet. If using CPOL = Low then  CPHA should be 2 Edge.

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.
Ulysses HERNIOSUS
Technical Moderator
September 25, 2023

Hello zeynepdicle,

reading shifted values from registers is typically an effect of using an incorrect SPI mode in your driver. Please check this. 

If still not consistent then also share scopeshot / logic analyzer trace of the read of the IC identity register.

BR, Ulysses

Associate II
September 28, 2023

Hi again,

I have another question. I am using the ST25R3918 and the 'pollingTagDetect' example from the RFAL library. I added the 'st25r3916WriteRegister' function for my hardware, but this code doesn't work. The 'switch case' in the 'rfalWorker' doesn't get executed. How can I resolve this issue? When I examine the debugging steps, I noticed that 'gRFAL.state' doesn't enter any case.


spiInit(&hspi1);

if(!demoIni()) {
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_12, GPIO_PIN_SET);
}

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 ));

while (1) {
demoCycle();
}

Brian TIDAL
Technical Moderator
September 28, 2023

Hi,

I would suggest to create a new thread rather than posting a question on an already answered one.

Rgds

BT

P.-S. it is likely that demoIni() returns false. Make sure to enable the selftest feature (ST25R_SELFTEST and ST25R_SELFTEST_TIMER) and check the return code of the st25r3916Initialize

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.