Good morning,
I am using the evaluation board TRF7960ATB to apply it to my design. My goal is to communicate with the STM32F101RB MCU.
The problem is that I can not initialize the reader and I do not know if the reason is I have damaged the evaluation board or I do not use correctly the command codes of the TRF7960.
Firstly, I think the evaluation board has been damaged because pin one, VDD_A, should give a regulated voltage of 3.4Vmax, and gives a voltage of 5V. Another reason is the antenna does not emit signal. I think it is due to improper initialization of the evaluation board.
About the command code, my question is as follows: on page 36 of the datasheet in Table 5.31 we can find a difference between ADRESS MODE and COMMAND MODE. As I understand it, the COMMAND MODE is used to send commands from the PC using communication software between the evaluation kit TRF7960ATB + MSP430F5384A and contains the following structure:
| BIT 7 | BIT 6 | BIT 5 | BIT 4 | BIT 3 | BIT 2 | BIT 1 | BIT 0 |
1 0 0 x x x x x
Where "x" are bits 0 through 4, corresponding to the commands given in the document "Using the SPI interface with TRF7960" table 2 (page 6). Therefore, for example, I would like to reset the TRF, the command should be use is 0x0f, and forming the previous structure that would be sent by the SPI would be 0x8F.
The case is that I initialize the TRF directly from my MCU, therefore, I should use the ADRESS MODE, right? Whose structure is as follows:
| BIT 7 | BIT 6 | BIT 5 | BIT 4 | BIT 3 | BIT 2 | BIT 1 | BIT 0 |
0 R / W R / W x x x x x
Where bits 0 through 4 correspond to the commands given in the document "Using the SPI interface with TRF7960" table 1 (page 5). Therefore, for example, I would like to reset the TRF, the command should be use is 0x0f, and forming the previous structure that would be sent by the SPI would be 0x2F,if continius adress mode is used, if not, it would be 0x0F. Another question is when I must use R = READ and when W = WRITE in ADRESS MODE?
I have tried both formats and I couldn´t with any. Then I show part of the code that I use to communicate the MCU and the TRF and initialize the second
//////////////////////////code
BYTE readTagArray[]={
0x8F, // Reset FIFO
0x91, // Send with CRC
0x3D, // Write continous from register 1D
0x00, // Data for register 1D
0x30, // Data for register 1E
0x02, // ISO15693
0x20,
0x00};
const unsigned char commandArray[]={
// Register # Command:
0x21, // 00 State control register Turn ON RF driver
0x02, // 01 ISO control register ISO15693 protocol selection
0x00, // 02 Select TX options register Default setting
0x00, // 03 High bit rate options register Default setting
0xC1, // 04 TX Timer H-Byte register ????
0xBB, // 05 Timer L-Byte register ????
0x00, // 06 TX Pulse Length Control register ????
0x0E, // 07 No Response Wait Time register Default setting
0x1F, // 08 RX Wait Time register Default setting
0x21, // 09 Modulator and SYS_CLK Control ????
0x40, // 0A RX Special Setting Register Default setting
0x87}; // 0B Regulator and I/O Control Default setting
// static U64 cmd_stack[400]; /* A bigger stack for command task */
// static U64 rs485_stack[100]; /* A bigger stack for command task */
// static U64 menu_stack[100]; /* A bigger stack for command task */
os_mut_init(SemDatos);
os_mut_init(SemSPI1);
os_mbx_init(mboxComandos, sizeof(mboxComandos)); // Inicialización del mailbox
_init_box (msgpoolComandos, sizeof(msgpoolComandos), sizeof(COMANDO_MBX_MSG)); // Inicializacion de la memoria pool
SPI1_Init();
SPI_Cmd (SPI1, ENABLE);
SPI1_Select();
os_dly_wait(10);
SPI1_Deselect();
os_dly_wait(10);
SPI1_Select();
for(i=0x00; i<=0x0B; i++)
{
SPI1_Write(i); // Send register address
commandByte=commandArray[i];
SPI1_Write(commandByte); // Send command
os_dly_wait(10);
}
SPI1_Deselect();
os_dly_wait(10);
// ISO15693 READ TAG command
SPI1_Select();
for(i=0; i<8; i++)
{
commandByte=readTagArray[i];
SPI1_Write(commandByte);
}
SPI1_Deselect();
////////////////////////END CODE
In this case I use the COMMAND MODE, is it correct, or should I use the ADRESS MODE? On the other hand, could you tell me the order of hardware initialization commands, if I use the COMMAND or ADRESS MODE, and how read the target please?
On the other hand, when communicating directly from the MCU, should I do a DUMMY READ?
Thank you, and I await your response.
Joseba Arginzoniz