Other Parts Discussed in Thread: TRF7960A
Hello,
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello,
Hello Ralph,
Thanks for your reply. Answering your questions:
Is the software being used TI example code? Is the processor an MSP430?
The software is based on the example code, but it's not exactly the same as you will see in the samples below.
We are using a arm cortex-m3 from NXP as the processor and SPI with SS to control the TRF.
From a software standpoint, how is the initial device configuration being handled?
Sometimes the TRF would not take default values during initialization (as stated on the Firmware Design Hints), so the init code is as follows:
buffer[0] = 0x83; // RESET command
buffer[1] = 0x80; // IDLE command
trf7970a_write_raw_data(buffer, 2);
delay_ms(100); // Wait for TRF7970A initialization
// Init registers
buffer[0] = 0x20; // Continuous write from register 0x00
buffer[1] = 0x21; // Reg 0x00: RF on and 5V mode
buffer[2] = 0x88; // Reg 0x01: ISO14443A without CRC
// Default values for ISO14443A protocol
buffer[3] = 0x00; // Reg 0x02
buffer[4] = 0x00; // Reg 0x03
buffer[5] = 0xC1; // Reg 0x04
buffer[6] = 0xBB; // Reg 0x05
buffer[7] = 0x20; // Reg 0x06
buffer[8] = 0x0E; // Reg 0x07
buffer[9] = 0x07; // Reg 0x08
buffer[10] = 0x21; // Reg 0x09
buffer[11] = 0x20; // Reg 0x0A
buffer[12] = 0x87; // Reg 0x0B
trf7970a_write_raw_data(buffer, 13);
// Init NFC Target Level reg to avoid reading holes
trf7970a_write_single_reg(TRF_NFC_TARGET_LEVEL, 0x00);
The values of the registers are read before moving on to make sure they are exactly as I wrote them.
Next, are there any attempts to re-configure the device and re-issue the 'failed' READ command? If so, what steps are taken to achieve this?
Currently, everytime I write to the ISO Control Register the device is 'reconfigured'. When I need to toggle between ISO14443A with and without CRC on RX I use the trf7970a_write_iso_control(uint8_t iso_control) function. This function sets the default values of the registers again:
buffer[0] = 0x20; // Continuous write from register 0x00
buffer[1] = 0x21; // Reg 0x00: RF on and 5V mode
buffer[2] = iso_control; // Reg 0x01: ISO14443A with or without CRC
// Default values for ISO14443A protocol
buffer[3] = 0x00; // Reg 0x02
buffer[4] = 0x00; // Reg 0x03
buffer[5] = 0xC1; // Reg 0x04
buffer[6] = 0xBB; // Reg 0x05
buffer[7] = 0x20; // Reg 0x06
buffer[8] = 0x0E; // Reg 0x07
buffer[9] = 0x07; // Reg 0x08
buffer[10] = 0x21; // Reg 0x09
buffer[11] = 0x20; // Reg 0x0A
buffer[12] = 0x87; // Reg 0x0B.
// Send buffer data
trf7970a_write_raw_data(buffer, sizeof(buffer));
The NFC tag reading procedure is called inside a loop that tries to poll for tags constantly. The Reading procedure always follows these steps when it is called:
- Turn on RF and wait 6 ms to power tag up.
- Send REQA.
- Anticollision Loop.
- READ block 4.
- READ block 8.
- READ block 12.
- Turn RF off.
If any of these steps fail, the procedure is interrupted, turns the RF off and returns a fail code. Thats why there is no READ block 8 and READ block 12 on the defective board's oscilloscope capture.
This procedure fails everytime it is called on the defective boards and suceeds everytime on the working ones.
Lastly, in general when sending and receiving data whether it is for the REQA, through the Anticollision loop, or with the READ command, is the FIFO being reset at the end of every transmissions and reception of data?
Yes, it is. I also reset the FIFO before I send any of these commands (REQA, Select, READ) following the same pattern of the code on my first post (buffer[0] = (1 << 7) | 0x0F; // FIFO Reset (Direct command))
Best regards,
André
Hello Andre,
Overall the software process looks pretty solid. There are a couple things I would like you to try and if either of these suggestions do not resolve the issue then I think hardware will be the next area to investigate.
1) The TRF7970A actually doesn't have an issue with setting the registers to correct values (the Firmware Design Hints should specify that applies for the TRF7960A, I will see that is fixed), so just write to the following registers and leave the others alone and let the ISO Control automatic settings handle that:
2) Each time you configure the ISO Control Register, start by doing a Soft Init and Idle (0x83, 0x80) sequence and then write the registers as needed. This ensures the device starts in a clean known state before getting re-configured for the current protocol. Also remember to clear Register 0x18 each time you do a Soft Init. Edit: per below comments, this method does not work for reconfiguring the TRF79xx ISO14443A settings between anticollision and Read.
Hello Ralph,
I made the changes suggested in 1 on both the init and the write_iso_control function. The code looks cleaner now but the behavior is the same.
There is a problem with suggestion 2. Doing the Soft Init and Idle sequence turns off the RF signal for about 60us everytime I call the write_iso_control function and it seems to be enough to turn off the Tag.
When the REQA command is sent right after the write_iso_control there is no response from the Tag. If I put a 6ms delay before returning from write_iso_control the tag responds the REQA, but do not respond the anticollision, probably because it rebooted to its initial state.
Best Regards,
André
Hello Andre,
Thanks, I received your schematic and have reviewed it.
There is one point of large concern for me is that you have a +5V signal tied straight to the EN line. The datasheet specifications for EN is that it's max voltage is determined by VDD_IO which is tied to VDD_X and will be far below +5V. This connection could result in damage to the IC and this could explain the behavior you are seeing. For reference, the I/O tolerances are in Section 5.2 Recommended Operating Conditions on Page 9.
You should modify a board (or multiple) to either tie EN to an MCU GPIO or some 3.3V source (VDD_X will be 3.4V in your configuration). Then test with a suitable sample of devices to see if this issue comes up again or not. You will need to use new devices as any currently failing devices now should be suspected of having the potential to have been damaged.
One more issue I noticed is that on the TRF7970A 50 ohm match, there is a component with the wrong value used. C319 should be 680pF, not 1.2nF. This won't cause an issue like stopping the device from transmitting the CRC, but it could affect RF performance in general as now the impedance for the antenna matching would not be at 50ohms. This is an important fix in the grand scheme of your application even if it isn't directly related to the current issue.
Hello Ralph,
Thanks for your reply,
We made the corrections on the boards and bought new transceivers to test. We will test them as soon as they arrive and report back here with news.
One thing that I noticed is that the datasheet is not very clear with the maximum value of the EN pin. The table you mentioned don't actually specifies a maximum value for the EN pin. It specifies a maximum value for logic low threshold (0.2 x VDD_I/O) and a minimum value for the logic high threshold (0.8 x VDD_I/O). Even though it uses the VDD_I/O as reference, I couldn't find anything about maximum value.
The EN2 pin is in the same table and the datasheet mentions it can be directly connected to VIN. The EN2 pin affects the VDD_X output, so it makes sense not to tie them together, but this can be a bit misleading.
Best Regards,
André
Hello Andre,
I am going to check with design about if there is a max level for EN based on VDD_IO. In all previous applications I've worked with, I haven't seen EN tied to +5V but I do agree that the maximum value isn't stated and it is unclear if that could have a negative effect.
Hello Ralph,
It is configured to 2 MHz, but I just measured it with the oscilloscope and it is running close to 1.8 MHz.
The 'DATA_CLK time high or low' is lower than the MIN value specified at '5.6 Switching Characteristics'.
I'll have a look at that to make sure it is within the specified range.
Best Regards,
André
Hello Ralph,
I raised the SPI clock to 2.05 MHz and I found another problem. The MISO line sometimes just hangs at high level and the communication fails.
The TRF is able to read the tag sometimes (even the ones that had the CRC problem) but the MISO error is happening very often in all the boards, even the working ones.
I tried raising the SPI to around 3 MHz and it just got out of control. Then I lowered it to around 1 MHz and it was working just as before (the ones that worked previously kept working and the ones that didn't send CRC kept not sending it).
Here are a some oscilloscope captures from a working board (one with no CRC issue) showing the spi lines:
Yellow line is clock, pink line is MOSI and blue line is MISO.
Best Regards,
André
Hello Andre,
That doesn't sound right. I haven't seen that sort of behavior with our MSP430 devices. For example, our main NFC stack uses 4MHz and it runs great like that, no issues at all. It's been tested like that on a lot of devices over time too.
I'm going to attach a screen capture from my Logic State Analyzer showing the full communication cycle from setup through reading multiple blocks of data from a Type 2 tag. See if this helps at all with your debugging: Type2_Read_Blocks.logicdata
You will need to download the Saleae Logic program from: https://www.saleae.com/downloads
I used version 1.2.2 to take the capture but the newer versions will open it just fine.
Hello Ralph,
2 differences between the SPI trace you sent and our firmware caught my attention:
- There is no dummy read on the IRQ Status Register to clear it. Since this register is not read 2 times in a row I think it makes sense.
- The ISO Control Register is only configured once in 'ISO14443A with no CRC on RX' mode. The CRC bytes are present in the trace when the FIFO is read.
Is the CRC verified on FW?
I changed the software to not reconfigure the ISO Control Register after initialization, just like the trace, and now all the boards I tested work without CRC issue on transmission. We still need Marcelo's workaround to calculate the CRC on the RX side though.
Best Regards,
André
Hi Andre,
Actually I had forgotten that was the setup for the firmware which actually in hindsight I need to further adjust. Anyways I went ahead and added in the write register to configure for 14443A with CRC check on RX (which is 0x08) before reading blocks of data.
See the new attached capture which shows this doesn't change the results: Type2_Read_Blocks_New.logicdata
Hello Ralph,
We debugged the SPI problem. It was caused by interruptions happening during SPI FIFO writes. This condition could toggle the Slave Select pin OFF and ON again for a very short time between bytes at higher speeds. It is fixed now.
We are running the SPI at 2.5 MHz but the CRC problem is unchanged (Also tested with SPI running at 5 MHz).
Best regards,
André
Hello Ralph,
Sorry for the (very) late reply. I was just able to come back to this issue.
I'm sending you the logic captures of a working board and a defective one.
Best regards,
André
captures.rar (the site wont let me insert .logicdata files, how you did it?)
Hello Ralph,
Thanks for the input.
I modified the software with the suggestions. It is cleaner now but the problem persists.
I'm sending the new logic captures.
Best regards,
André
Hello Ralph,
Good news! It did work! I could only test it with one defective sample for now, but I'll try the rest as soon as I can.
I'm sending the latest captures comparing the behavior with and without the 'stop decoders' command on successful reads, both from the same board which was defective.
We did swap the chips between boards. I was only able to track the issue down to the chip because of this test (since it was a brand new prototype with other issues and all). I tried reporting this on the very first post.
When I say 'defective board' I actually mean 'board with failing chip'. Sorry for the misleading choice of words.
I kept the 'failing' chips separated from the rest and the behavior is consistent no matter the board they are tested on.
We even bought new chips to make sure it wasn't a 'bad lot' or something. The new ones presented the same behavior: some worked and some failed. Not sure about the exact numbers right now, but failure rate was very high (close to half tested chips). I think one of the chips we sent you came from the 'new batch'.
Best regards,
André
Hi Andre,
That's great!! Sorry it look so long to track it down. Thanks for confirming the solution, gives me something else to keep in mind moving forward.