2021-07-28 11:20 AM
Hi,
I don't really understand the datasheet of the ST25R3916 IC chip.
At page 53, they show an exemple of a direct write command. As I understand, we need to send 1-1-C5-C4-C3-C2-C1-C0. When I check table 13 to see the command code that go for bits C5..C0, the hexa is something like C1 = 11000001. There is 8 bits on the command code and on page 53 they only send 6 bits. I am confused...
Same thing to read a register for example. We need to send 0-1- the register address. There is no register that are 6 bits long, so how can I write my SPI package?
Sorry if it is not clear, english is not my first language and I am still learning SPI communication, so it may seems easy, but I still don't get it
Thanks for any clarification.
Antoine
Solved! Go to Solution.
2021-07-29 12:50 AM
Hi Antoine,
thanks for using ST25R3916 IC.
For you information, ST provides some firmware packages for the ST3916. This includes an NFC communication stack, full functional examples over SPI and low layer drivers. See The ST25 Embedded NFC library.
Regarding your initial question, the direct commands values in table 13 of the ST25R3916 datasheet include the heading 11b. This simplifies the reading of logic analyzer traces as we have the direct value of the byte being sent.
For example, here is the sending of Set default (C1h) command on SPI
Rgds
BT
2021-07-28 12:28 PM
Hi Antoine,
If you do not understand how works registers/direct command you can check HydraNFC v2 Shield guide (it use a st25r3916)
All is explained with example to read/write registers in Space A, Space B or send direct command over spi
Regards,
Benjamin
2021-07-28 01:32 PM
Hi,
I am sorry, but I do not understand more. I don't understand the syntax he use inside brackets, as it is not like in the ST25R3916 datasheet.
He use letter like r to read, but don't explain what is r... Is the hexa in the left is the MSB or LSB.. Things like that.
Thanks for the help,
Antoine
2021-07-28 01:38 PM
The HydraBus commands for SPI (or any other protocol) are described here
https://github.com/hydrabus/hydrafw/wiki/HydraFW-SPI-guide#protocol-interaction-syntax-description
https://github.com/hydrabus/hydrafw/wiki/Bus-interaction-commands
To summarize
[ Corresponds to Chip select(CS) enable/active (low=state 0/GND).
] Corresponds toChip select(CS) disable (high=state +3.3V).
The value inside is in hexadecimal when it start with 0x
2021-07-29 12:50 AM
Hi Antoine,
thanks for using ST25R3916 IC.
For you information, ST provides some firmware packages for the ST3916. This includes an NFC communication stack, full functional examples over SPI and low layer drivers. See The ST25 Embedded NFC library.
Regarding your initial question, the direct commands values in table 13 of the ST25R3916 datasheet include the heading 11b. This simplifies the reading of logic analyzer traces as we have the direct value of the byte being sent.
For example, here is the sending of Set default (C1h) command on SPI
Rgds
BT
2021-07-29 05:42 AM
Hi Ben,
Thanks for your answer. Now I understand a lot more of the github document you sent me. I think it will help me for advancing on my project.
Antoine
2021-07-29 05:53 AM
Good morning Brian,
Thanks! That should definitely help me. If we talk about only the read and write command. Do we still send 8 bits when reading/writing in block mode ? Can you show me an example of what a reading and a writing looks like ?
For example, if I want to write for example in the register 00h. Do I still write 8 bits ? Because I need to write the 00b to say that I am writing, after the 00h address and the 8 bits of the data.
If I want to read from this register, I only send 01b + the address 00h ?
thanks again !
Antoine
2021-07-29 06:10 AM
Hi Antoine,
If you are interested by full SPI capture of ST25R3916 reading different tags (including init) that I have done with PulseView see all the data here
https://github.com/sigrokproject/sigrok-dumps/tree/master/nfc/st25r39xx
You can load them with latest PulseView (as the st25r3916 decoder is officially integrated since few months now)
Regards,
Benjamin
2021-07-29 06:30 AM
Hi Antoine,
here is an example of reading the IC identity register (3Fh):
here is an example of writing IO configuration register 2 (01b):
Again, I would recommend to use the firmware provided on st.com. This manages the various SPI accesses and provides a user level API rather than a register based programming.
Rgds
BT
Rgds
BT
2021-07-30 11:25 AM
Hi Brian,
Thanks for your answer, I finally was able to communication with the ST25R3916 using SPI.
The next step for me is to be able to transmit an information into a tag and read it back.
In the datasheet of the chip, it say that I need to follow these steps:
Preparation and execution of a transceive sequence:
I did all these steps, but nothing show up in the FIFO register. I don't understand why. I check in the main IRQ register, an I have the bit set on the end of transmission IRQ, which is a good thing, but I still don't have any bits in my FIFO register.
thanks for any help again,
Antoine