Sir or Miss:
When I port the TRF7960EVM Program(MSP430) to cortex m3 (ST's STM32),I have one big problem, the IRQ Register(IRQStatus) will be 0x00.
First I description my hardware and software.
Hardware:
I used the GPIOs as SPI with SS to cummunicate with the TRF7960 , and i directly connect IRQ pin to my MCU without a 1K resistor as a buffer ,the pin of MOD
is connected to GND ,and the ook is floating
Software :
I use uart to trace my program,I just port the MSP430 program,and the key fuctions and structure are the same with TRF7960 EVM's
However , I meet a problem, eveytime I read the TFR7960 IRQStatus, it will be 0x00, then i_reg = 0x02,i do not know why this happen,for example:
when i use the ISO1593 ,Configuration is below
//======================ISO1593Configuration==========
command[0] = ChipStateControl; // turn on RF driver
command[1] = 0x21;
command[2] = ISOControl; // set register 0x01 for ISO15693 operation
command[3] = 0x02;
WriteSingle(command, 4);
delay_ms(6);
flags = 0x06; // 16 slots
// flags = 0x26; //1 slot
command[0] = 0x00;
InventoryRequest(command, 0); // send Inventory request
delay_ms(5);
command[0] = ChipStateControl; // turn off RF driver //
command[1] = 0x01;
WriteSingle(command, 2);
delay_ms(5);
command[0] = IRQStatus;
command[1] = IRQMask;
ReadCont(command, 2);
printf("\r\n After finding the ISO15693 Card \r\n");
printf("\r\n the command[0] is 0x%x",command[0]);
printf("\r\n the command[1] is 0x%x",command[1]);
}
send_cstring("\r\n Over find ISO15693 Card! \r\n");
//====================================================
You can see I keep the style of EVM's program
in IRQ PIN InterruptHandler,i read the IRQStatus and IRQmask ,then pulse string output to UART
//====================Part of IRQ PIN InterruptHandler==========================
do
{
irqCLR(); /* PORT2 interrupt flag clear */
Register[0] = IRQStatus; /* IRQ status register address */
Register[1] = IRQMask; //Dummy read
// ReadSingle(Register, 2); /* function call for single address read */
ReadCont(Register, 2);
/* IRQ status register has to be read */
if(*Register == 0xA0)
{ /* TX active and only 3 bytes left in FIFO */
goto FINISH;
}
printf("\n\r --------------- \n\r");
printf("\n\r IRQStatus's Register[0] is 0x%x!\n\r",Register[0]); // Show the IRQStatus to UART
printf("\n\r IRQStatus's Register[1] is 0x%x!\n\r",Register[1]);
printf("\n\r --------------- \n\r");
InterruptHandlerReader(&Register[0]); //
} while((GPIO_ReadInputDataBit(GPIOE,GPIO_Pin_15) & 0x01) == 0x01); // wait for IRQ PIN down,【while((irqPORT & irqPIN) == irqPIN);】
//==============================================================================
in void InterruptHandlerReader(unsigned char *Register),I pulse a string output to UART
//====================Part of InterruptHandlerReader==========================
/* Interrupt register not properly set */
if(!POLLING)
{
/*
* sprintf(phello, "Interrupt error. %x\n\r", *Register);
* *send_cstring(phello);
*/
send_cstring("Interrupt error");
Put_byte(*Register);
}
i_reg = 0x02; // Here !!! !!!!!!!!!!
send_cstring("\r\ni_reg = 0x02; evrytime \r\n"); // show the i_reg = 0x02 here
//==============================================
what does "Interrupt register not properly set" this means???
when I run the porogram ,the UART show this :
//=============== UART OUTPUT =======================
IRQStatus's Register[0] is 0x0!
IRQStatus's Register[1] is 0x3f!
---------------
00
i_reg = 0x02; evrytime
---------------
IRQStatus's Register[0] is 0x80!
IRQStatus's Register[1] is 0x3f!
---------------
80T
---------------
IRQStatus's Register[0] is 0x1!
IRQStatus's Register[1] is 0x3f!
---------------
01N
---------------
IRQStatus's Register[0] is 0x1!
IRQStatus's Register[1] is 0x3f!
---------------
01N
---------------
IRQStatus's Register[0] is 0x1!
IRQStatus's Register[1] is 0x3f!
---------------
01N
---------------
IRQStatus's Register[0] is 0x1!
IRQStatus's Register[1] is 0x3f!
---------------
01N
---------------
IRQStatus's Register[0] is 0x1!
IRQStatus's Register[1] is 0x3f!
---------------
01N
---------------
IRQStatus's Register[0] is 0x1!
IRQStatus's Register[1] is 0x3f!
---------------
01N
---------------
IRQStatus's Register[0] is 0x1!
IRQStatus's Register[1] is 0x3f!
---------------
01N
---------------
IRQStatus's Register[0] is 0x1!
IRQStatus's Register[1] is 0x3f!
---------------
01N
---------------
IRQStatus's Register[0] is 0x1!
IRQStatus's Register[1] is 0x3f!
---------------
01N
---------------
IRQStatus's Register[0] is 0x1!
IRQStatus's Register[1] is 0x3f!
---------------
01N
---------------
IRQStatus's Register[0] is 0x1!
IRQStatus's Register[1] is 0x3f!
---------------
01N
---------------
IRQStatus's Register[0] is 0x60!
IRQStatus's Register[1] is 0x3f!
---------------
60FE
found=1 of ISO15693 stage 1
the UID[3~11] is
[FBA39F41000104E0]
---------------
// UID is here even i_reg = 0x02
IRQStatus's Register[0] is 0x1!
IRQStatus's Register[1] is 0x3f!
---------------
01N
---------------
IRQStatus's Register[0] is 0x1!
IRQStatus's Register[1] is 0x3f!
---------------
01N
---------------
IRQStatus's Register[0] is 0x1!
IRQStatus's Register[1] is 0x3f!
---------------
01N
found=1 of ISO15693 stage 2
After finding the ISO15693 Card
the command[0] is 0x0
the command[1] is 0x3e
Over find ISO15693 Card!
//==============================================
You kan see ,the first read the IRQStatus is 0x00, even in the end I can read the UID ,but when I use IS01443A or ISO1443B,I could not get UID,
take the ISO14443A as an example , when the i_reg = 0x02, the program will go here:
//====================Part of 14443a 's void AnticollisionSequenceA(unsigned char REQA) ====================================================
/*
* UIDsize = ((buf[2] >> 6) & 0x03) + 1;
*/
if(i_reg == 0xff || i_reg == 0x02)
{
for(i = 40; i < 45; i++) buf[i] = 0x00;
AnticollisionLoopA(select, NVB, &buf[40]);
if(POLLING)
{
LEDtypeAON();
send_cstring("\r\n found=1 stage 6 \r\n"); // Show the LED here is light up
}
//============================================================================================================================================
this moment, POLLING =0X01 ,found = 0x00,but i_reg = 0x02, so the LED 0f 14443A will light up alwaysly,I check the i_reg = 0x02 means that collision occured
or something else,but i just do not put any card to antenna,how it could be ?? In fact ,there is no card
//=======The UART output ,When no card around================================
---------------
IRQStatus's Register[0] is 0x80!
IRQStatus's Register[1] is 0x3e!
---------------
80T
---------------
IRQStatus's Register[0] is 0x80!
IRQStatus's Register[1] is 0x3e!
---------------
80T
---------------
IRQStatus's Register[0] is 0x0!
// here is wrong ~~~~~
IRQStatus's Register[1] is 0x3e!
---------------
00
i_reg = 0x02; evrytime
---------------
IRQStatus's Register[0] is 0x80!
IRQStatus's Register[1] is 0x3e!
---------------
80T
found=1 stage 6 // when IRQStatus is 0x0, the i_reg = 0x02 ,then it goes here ,the LED is lighted up
After finding the ISO14443A Card
the command[0] is 0x0
the command[1] is 0x3e
Over find ISO14443A Card!
//==============================================================================
You can see after 2 times IRQStatus = 0x80 ,i_reg becomes 0x02(IRQStatus = 0x00)
When I put one ISO14443A card to antenna ,the output of UART will be :
//=======The UART output ,When one card around================================
---------------
IRQStatus's Register[0] is 0x80!
IRQStatus's Register[1] is 0x3e!
---------------
80T
---------------
IRQStatus's Register[0] is 0x80!
IRQStatus's Register[1] is 0x3e!
---------------
80T
---------------
IRQStatus's Register[0] is 0x0!
IRQStatus's Register[1] is 0x3e!
---------------
00
i_reg = 0x02; evrytime
---------------
IRQStatus's Register[0] is 0x80!
IRQStatus's Register[1] is 0x3e!
---------------
80T
---------------
IRQStatus's Register[0] is 0x42!
// IRQStatus 0x42, it means IRQ set due to RX start and Collision error ,according to datasheet
IRQStatus's Register[1] is 0x3e!
---------------
42
i_reg = 0x02; RX complete,collision error! // here is wrong
found=1 stage 6
After finding the ISO14443A Card
the command[0] is 0x0
the command[1] is 0x3e
Over find ISO14443A Card!
//================================================================
Above all ,
I want to know why the IRQStatus is 0x00, my Process of reading IRQ Register is with dummy read ,I think it's ok.
in my View ,the 0x00 is key to solve the problem of 14443a and 14443B read UID