cancel
Showing results for 
Search instead for 
Did you mean: 

Register settings for st25r3911b for ISO 15693

nicolai geske
Associate II

Posted on June 14, 2018 at 12:50

Hello ST25 community.

Some weeks ago I wrote this thread:

https://community.st.com/0D50X00009XkWIeSAN

I got the coding as in the example and it works. (The bytes are coded as it is mentioned in ISO 15693 datasheet)

I want to use 1 out of 4 coding for transmit from VCD to VICC:

Following register settings are used:

Defined: MSB to LSB ( 7 to 0 )

*-----------------------------------------------------------------------------------------------------------*

*register settings for iso15693*

Mode Definition Register                         (0x03)     : 0 1 1 1 0 0 0 0 - sub carrier stream mode

Bit Rate Definition Register                     (0x04)     : 0 0 1 0 0 0 1 0 - bit rate fc/32

Stream Mode Definition Register            (0x08)     : 0 0 1 1 0 0 0 0 - sub carrier frequency fc/32 , sub carrier pulses 4, time period fc/128

Auxiliary Definition Register                    (0x09)     : 0 0 1 0 0 1 0 0 - set modulation AM

AM Modulation Depth Control Register   (0x24)     : 0 1 1 0 1 1 0 0 - set modulation depth to 29.7

After these settings I use following direct commands:

send_direct_command(RFID_CALIBRATE_MODULATION_DEPTH);

send_direct_command(RFID_CALIBRATE_ANTENNA);

For the st25r3911b power up I use following settings:

IO Configuration Register 2            (0x01)     : 1 0 0 0 0 0 0 0 - set power supply of ST25 to 3.3 volt

Operation Control Register             (0x02)     : 1 1 0 0 1 0 0 0 - enable (set to 1): en, rx_en,tx_en

send_direct_command(RFID_ADJUST_REGULATORS);

*-----------------------------------------------------------------------------------------------------------*

I'm not sure if these settings are right. Hopefully someone could check.

As an attachment I send the communication VCD to VICC on an

oscilloscope. I got this using a different antenna.

Best regards

Nicolai.

1 ACCEPTED SOLUTION

Accepted Solutions
Posted on July 12, 2018 at 08:44

Hi Nicolai,

if you read our source code you will find that for iso15693 the crc needs to be inverted at the end - before coding:

26 01 00 F6 0A -> 21 20 08 20 02 08 02 02 02 02 02 02 02 02 20 08 80 80 20 20 02 02 04

You are going through a lot of hassle for re-implementing what we have already implemented.

Not sure why you would observe modulation on sending 0x00. No picture was attached.

Regards, Ulysses

View solution in original post

14 REPLIES 14
Ulysses HERNIOSUS
ST Employee
Posted on June 22, 2018 at 09:31

Hi Nicolai,

  • Bitrate register is actually a don't care for stream mode. 
  • Stream Mode Definition Register is correctly set for Tx but not for RX, typcially it would be set to 0x38

  • send_direct_command(RFID_CALIBRATE_ANTENNA); this command is not related to the modulation depth. It will try to adjust the trimming caps. This may lead to a change of current draw. So you should do an Adjust regulators before and after.

  • Please use supply 3V only if you really use 3V supply. Our boards are typcially set to 5V.

  • Additionally it is advisable to tweak some analog configs for reception as here (taken from ST25R3911B-DISCO):

0690X0000060LNNQA2.png

Looking at your scope shots the wave shapes look not very nice. Also doesn't look like 30%. But this may also be related to using a second (reader?) antenna to probe. Better to use only the ground wire of the scope to connect it to the tip.

Are you using a custom design or are you basing your work on ST boards?

Are you now facing any issue or this is a general call for review?

Regards Ulysses

Posted on July 04, 2018 at 09:14

Hello,

we use 3.3 power supply.

I use the st25r3911b as reader in combination with a at90can64.

The problem is: I have no idea why the iso15693 does not work all. Thats why I was looking for support if the register settings are correct.

While I got no response from VICC i decided to use an antenna to check whether I'm transmitting data from st25r3911b at all.

Thats what you see in the picture.

I was on vacation so I'm going to realize your points in the next few days.

Best regards, Nicolai.

Posted on July 04, 2018 at 13:16

Hi Nicolai,

rechecking this and the referenced thread: 

Your antenna works for A and B. So it seems it is not totally of and ISO15693 should also work somehow. If now the VICC does not respond it may be that the tag is simply not responding. Using a sniffer coil you should also be able to see the tag response some 300us after the VCD frame (assuming an inventory command with 1 slot).

If you don't find that in the trace then it is most likely the frame you send to FIFO. It needs to include software generated SOF CRC and EOF. Which bytes command (ISO15693 payload) bytes do you intend to send and what are the bytes written into FIFO? Also what are the values written into regs 0e, 0f, 10, 11, 1d and 1e? 

nicolai geske
Associate II
Posted on July 05, 2018 at 14:32

Hey there.Hey there.

Here is what I do:

My defines:

// defines for iso15693

// all values are LSBIT first

// all values inverted

// SOF / EOF 1 of 4

#define ISO15693_SOF_1_4 0x7B

#define ISO15693_EOF_1_4 0xDF // possiable 0x0B

// bit position 1 0f 4

#define ISO15693_00_1_4 0xBF

#define ISO15693_01_1_4 0xFB

#define ISO15693_10_1_4 0xEF

#define ISO15693_11_1_4 0xFE

// command defines

#define INVENTORY_COMMAND 0x80

// flags definnes

#define INVENTORY_ONE_SLOT_LOW_DATA 0x24

#define INVENTORY_ONE_SLOT_HIGH_DATA 0x64

#define INVENTORY_NO_MASK 0x00

#define INVENTORY_MASK_LENGTH 0x00

*******************************************************************************************

This is my function for CRC_16:

static void calculate_crc16(char data[], uint8_t length_of_data, char* crc_16_high, char* crc_16_low){

    uint16_t crc_16;

    uint16_t polynom = 0x8408;

    uint16_t initial_value = 0xFFFF;

    crc_16 = initial_value;

    for(uint8_t i = 0; i < length_of_data; i++){

        crc_16 ^= data[i];

        for(int8_t j = 0; j < 8; j++){

            if((crc_16 & 0x0001) == 0){

                crc_16 >>= 1;

            }else{

                crc_16 = (crc_16 >>1)^polynom;

            }

        }

    }

    (*crc_16_low) = crc_16 & 0xFF;

    (*crc_16_high) = ((*crc_16_high) >> 8);

}

*******************************************************************************************

My function for coding 1 out of 4:

static void RFID_iso15693_1of4_coding(char iso15693_inventory_command[], int length, char fifo_write_data_iso15693[64]){    

    

    uint8_t a = 0;

    fifo_write_data_iso15693[a] = ISO15693_SOF_1_4;

    a++;

    for(uint8_t i = 0; i < length; i++){

        for(uint8_t j = 0; j < 8; j += 2){

            

            uint8_t tmp = (iso15693_inventory_command[i] >> j) & 3;   

            switch (tmp) {

                case 0:

                    fifo_write_data_iso15693[a] = ISO15693_00_1_4;

                    a++;

                    break;

                case 1:

                    fifo_write_data_iso15693[a] = ISO15693_01_1_4;

                    a++;

                    break;

                case 2:

                    fifo_write_data_iso15693[a] = ISO15693_10_1_4;

                    a++;

                    break;

                case 3:

                    fifo_write_data_iso15693[a] = ISO15693_11_1_4;

                    a++;

                    break;

            }

        }

    }

    

     fifo_write_data_iso15693[a] = ISO15693_EOF_1_4;

}

*******************************************************************************************

My function for sending out:

void rfid_search_for_iso15693(void){

    char fifo_write_data_iso15693[64];

    char iso15693_inventory_command[5];

    send_direct_command(RFID_CLEAR);

    iso15693_inventory_command[0] = INVENTORY_ONE_SLOT_HIGH_DATA;

    iso15693_inventory_command[1] = INVENTORY_COMMAND;

    iso15693_inventory_command[2] = INVENTORY_NO_MASK;

    

    // debug

    uart_puts('CALC_CRC\r\n');

    // debug

   

    calculate_crc16(iso15693_inventory_command,4, &iso15693_inventory_command[4],&iso15693_inventory_command[5]);

    // debug

    uart_puts('command\r\n');

    for(int i = 0; i < 5; i++){

        uart_putHex2(iso15693_inventory_command[i]);

    }

    uart_puts('\r\n');

    // debug

    

    RFID_iso15693_1of4_coding(iso15693_inventory_command,5,fifo_write_data_iso15693);

    

    // debug

    uart_puts('coded_iso15693_1of4\r\n');

    for(int i = 0; i < 22; i++){

        uart_putHex2(fifo_write_data_iso15693[i]);

    }

    uart_puts('\r\n');

    // debug

       rfid_write_fifo(22,fifo_write_data_iso15693);

    

    // set number of full transmittet bytes for air-communication

    // number of bytes = 22

    rfid_write_register(0x1D,0x00);

    rfid_write_register(0x1E,0xB0);

    

    send_direct_command(RFID_TRANSMIT_WITHOUT_CRC);

    

    while(TRANS_FLAG_RECIVE != 1){

         Delay_ms(1);

    }

    TRANS_FLAG_RECIVE = 0;

    rfid_read_fifo();

}

The registers  0e, 0f, 10, 11 are not set at all. Do I have to do it ?

Best regards, Nicolai

Ulysses HERNIOSUS
ST Employee
Posted on July 09, 2018 at 09:23

Hi Nicolai,

your source code is hard to follow (reversed payload bytes compared to ISO15693) and reversed and inverted bits compared to ST25R3911B stream semantic. I assume the bytes will be normalized before actually being written into FIFO.

Looking at the timing of your scope shot I think the stx bit are not what you claim in the reg08.

The registers  0e, 0f, 10, 11

  you will need to properly adjust the mask receive timer and the no response timer. The default values may work but are certainly far from optimal for you.

Probably it would be easier if you reuse our existing RFAL code which already handles all those things. If you don't want to do that then I would advise you to at least use a logic analyzer to compare the SPI of RFAL with working ISO15693 to your version.

Regards, Ulysses

nicolai geske
Associate II
Posted on July 09, 2018 at 09:47

Hello,

ok I see that.

The LSBIT first and inverted defines are due to the ISO15693 standard.

For example: the standard say for coding 1 out of 4 : BF , EF , FB, FE

In your RFAL document : 02 , 08 , 20 , 80

How does this work ?

You said 'I assume the bytes will be normalized before actually being written into FIFO.' . The ISO 15693 wants me to send LSBIT first, so I do have to switch ? Meaning 01 (inventory) becomes 80.

Wich value do I use for coding 1 out of 4 now ? 01 or 80 ?

It seems I have a big problem understanding  this standard.

Best regards, Nicolai

Posted on July 09, 2018 at 14:03

Hi Nicolai,

I typically prefer to use the notation in the spec: 0x01 is the Inventory command, I would like to use this also in the SW. The conversion of these bits into a bit stream over RF is up to the chip/ software driver.

ST25R3911B transmits in stream mode using LSB first. A '1' denotes a modulation, a '0' denotes an unmodulated time period. ISO15693 does not define 0 and 1 on the modulation waveforms itself. It seems you read the 'high' in the waveform as a '1'. But that is only your interpretation.

So with sending a stream of 0x00 using stream mode ST25R3911B will send the unmodulated (strong) carrier. In your view a constant 'high'.

If you didn't reverse and invert your bytes on your lowest driver level then the generated modulations will be completely off-spec and not understood by the VICC. Not sure why your scope shot didn't look even worse then.

Regards, Ulysses

nicolai geske
Associate II
Posted on July 10, 2018 at 10:08

Hi Ulysses,

it becomes more clear.

Maybe lets get some little example:

I know the bitstream consists of:  SOF , flag , cmd , mask lenth , (mask value) , crc_low , crc_ high , EOF

Just lets do for cmd 0x01 (inventory)

I want to do 1 out of 4 coding. So coding 0x01 like in your RFAL would become :

0x01 = 0 0 0 0 0 0 0 1 = 0x02 0x02 0x02 0x08

So I write 0x02 0x02 0x02 0x08 to FIFO ?

Or do I have to do something else in addition ?

Best regards, Nicolai.

And thank you very much for your patience

Posted on July 10, 2018 at 14:34

Hi Nicolai,

almost: 

0x01 = 0 0 0 0 0 0 0 1 = 0x08 0x02 0x02 0x02

So you write 0x08 0x02 0x02 0x02 to FIFO.

Regards, Ulysses