dcsimg
Skip to end of metadata
Go to start of metadata

Purpose: 

This article describes how to start developing applications for the TI RF430FRL152H RFID transponder chip using the RF430FRL152HEVM. 

 

Background: 

The RF430FRL152H is a 13.56 MHz passive RFID transponder chip.The RF430FRL152H contains a ISO 15693 and ISO 18000-3 compliant RFID interface as well as a programmable MSP430 16 bit microcontroller with 2 Kb of embedded FRAM, a 14 bit sigma delta ADC, SPI and I2c interfaces. It is capable of being powered either from a coin cell battery or from the RF field of the tag reader. 

The RF430FRL15xH line of RFID transponders also has two other variations. The RF430FRL153H which is identical to the RF430FRL152H, but does not contain the SPI or I2C interfaces,but still contains the ADC. Likewise the RF430FRL154H is also identical to the RF430FRL152H, but it does not contain the ADC, however it still contains the SPI and I2C interfaces. 

The RF430FRL152HEVM is an evaluation module for the RF430FRL152H. In addition to the chip, the module also contains an antenna optimized for 13.56 MHz, a JTAG header for programming and debugging, a coin cell battery holder, light sensor, user LED, user push button, micro USB connector for powering the chip and gpio headers which are compliant with TI's Launchpad series of MSP430 development boards. 

 

RFID, NFC, and ISO 15693:

RFID: 

RFID is a blanket term for a number of technologies for wirelessy identifying and tracking objects via tags either attached to or embedded in the objects. Typically these tags will contain a small amount of information such as a serial number. Some more advanced tags are capable of taking sensor readings and relaying that information to the RFID reader, these tags are referred to as sensor transponders or sensor tags.. Due to it's embedded microcontroller and ADC, the RF430FRL152 is well suited for creating such tags. 

There are two types of tags, active and passive. Active tags contain their own their own power source and transmitter and are typically used for tracking high value assets at long distances. Passive tags are powered by the RF field of the rfid reader and communicate by modulating the reader's RF field rather than transmitting their own signal.They are typically used for inventory tracking of low cost items at short distances. The RF430FRL152h is optimized for passive operation but can also utilize a coin-cell battery for semi-active operation. 

Tags operate on a variety of frequencies from a few hundred KHz up to several GHz and utilize either inductive or propagation coupling. Propagation coupling is only used by passive tags operating in the UHF band (300MHz to 3GHz) which are relatively uncommon. Most RFID tags, including the RF430FRL152H, utilize inductive coupling which serves as the basis for Near Field Communication (NFC) technology. 

With inductive coupling, you can think of the antennas on the reader and tag as being similar to the coils of a transformer. The reader in this case is the primary, the tag is the secondary and instead of the magnetic field being transferred through a magnetic core; it is transferred through the open air.The reader chip generates a voltage signal on it's antenna which in turn creates a magnetic field. This magnetic field then creates a voltage signal on the tag's antenna which can then be modulated by the transponder chip. This is very similar to the process by which a voltage signal on the primary of a transformer creates a voltage signal on the secondary of a transformer. The communication is achieved by the tag changing the load on it's antenna, resulting in changes of the reader's magnetic field. The reader can sense these changes in the magnetic field and demodulate them to obtain the information being sent from the tag. 

NFC: 

NFC is a subset of RFID technology operating in the HF (13.56 MHz) band. Unlike earlier RFID technology, NFC was designed specifically for applications such as contactless payment that require higher levels of security and larger amounts of data to be exchanged. Because of this, the NFC specification allows devices communicate in an ad-hoc fashion in addition to the reader/writer setup employed by traditional RFID. NFC also takes advantage of the limited communication range of this band as a security feature to limit the possibility of eavesdropping and thus typically operates at distances of 10 cm or less. To ensure effective communication, each NFC device must adhere to a data format known as NDEF, the NFC Data Exchange Format.  

There are several different standards for RFID and NFC tags that specify the modulation type, maximum read distance and data rate of the tags. In addition, the standards will also typically have a series of supported standard commands to ensure functionality between compliant readers and tags. One of the more common standards, and the one that the RF430FRL152 supports, is ISO 15693.

ISO 15693

ISO 15693 is the standard for vicinity tags. This standard specifies that tags operate at 13.56 MHz and have a maximum read distance of 1m (3.3 ft). Since ISO 15693 allows for a greater read range than 10 cm it technically doesn't adhere to the NFC spec. However, the NFC spec does support ISO 15693 tags that are formatted according to the NDEF format. In addition, many,(but not all), NFC compliant devices also have the ability to interface with ISO 15693 tags that are not NDEF compliant. Thus it is important to practice due diligence when selecting parts for a ISO 15693 system. It should also be noted that the range for the RF430FRL152 tops out at roughly 50cm (1.6ft).

There are several ISO 15693 standard commands, however tags are only required to support the Inventory and Stay Quiet commands, the rest are optional. A table of the standard commands that the RF430FRL152H supports is shown below. 


ISO 15693 Standard Commands
CommandDescription
InventoryReturns the tag's UID (serial) number
Stay QuietPuts the tag in the "Quiet" state. It will not respond to a reader in this state, except for the "Reset to Ready" command
Read Single BlockReads a single block of the tag's memory
Write Single BlockWrites to a single block of the tag's memory
Read Multiple BlocksReads several blocks of the tag's memory
Write Multiple BlocksWrites to several blocks of the tag's memory
Lock BlockLocks a specified block of memory to prevent editing
SelectPuts tag into the "Selected" state. In this state, a specific tag can be controlled without the reader having to send the tag's UID with each command.
Reset to ReadyTransfers the tag from the "Quiet" or "Selected" state to the "Ready" state
Get System InfoRetrieves technical info about the tag. (chip revision etc......)

 

In addition, the RF430frl152h also supports the several TI custom commands. These commands function exactly the same as their corresponding standard commands except they are used to access the SRAM on chip,(the standard commands access the FRAM), and utilize a 16 bit block number as opposed to a 8 bit one. 

 

TI Custom Commands
CommandDescription
Custom Read Single BlockReads a single block of the tag's memory
Custom Write Single BlockWrites to a single block of the tag's memory
Custom Read Multiple BlocksReads several blocks of the tag's memory
Custom Write Multiple BlocksWrites to several blocks of the tag's memory
Custom Lock BlockLocks a specified block of memory to prevent editing

 

 

Examples:

As noted above, the RF430FRL152 is both a microcontroller and NFC transponder. The first two examples below demonstrate how to use several features of the microcontroller. The other examples demonstrate how to use the NFC interface to relay data gathered from the RF430FRL152 to the NFC reader.

To perform the examples, you will need the following equipment. 

  1. MSP FET In-Circuit Programmer 
  2. Ti TRF7970AEVM (Used for Reading/Writing RF430FRL15x tags) / Not needed for the first two examples. 
  3. We'll also need to the TI TRF7970EVM GUI to use the TRF7970EVM. You can find it on TI's website or download it here: TRF7970A_GUI_WIN7_11_2013.zip
  4. Windows PC with TI's Code Composer IDE installed. 

 Initial Setup and Blinking a LED
  1. Download and unzip the "RF430FRL152h NFC Only" example project, you can find it on TI's website or download it here: RF430FRL152H_ISO15693_Only_Project.zip

  2. Open Code Composer studio. In the getting started screen, select the import project icon.

  3. A "Import CCS Eclipse Projects" window will pop up. In the window, select browse and navigate to where you unzipped the project. Select the RF430FRL152H_ISO15693_Only_Project folder and click open. We won't be using the ISO15693 interface in this example, but this example program does take care of some of the setup for us. Once the project is imported, open main.c.

  4. In the main.c function, comment out the" __bis_SR_register(LPM3_bits + GIE);" line. This function puts the chip in low power mode, which is not needed for this demo.

  5. Next, paste the following code in the main function. It is best to place it right after the DeviceInit() function. This code, initializes and toggles the GPIO pin attached to the alarm led on the evaluation module.

    //Set Ports to GPIO Mode
    		P1SEL0 = 0x00;
    	    P1SEL1 = 0x00;
    //Set pin 1.4 to output
    	    P1DIR = 0x10;
    while(1)
    		{
    		//Toggle Output High
    		P1OUT = 0x10;
    		_delay_cycles(4000000);
    		//Toggle Output Low
    		P1OUT = 0x00;
    		_delay_cycles(4000000);
     
             //Enter Low Power mode
    		//__bis_SR_register(LPM3_bits + GIE);
    		}
  6. Next, build the project by selecting "Build All" from the project menu. Ensure the project builds without errors.

  7. Attach the MSP-FET to the PC via USB, then attach the MSP-FET to the JTAG header on the evaluation module.

  8. Connect the USB connector on the evaluation module to the PC. This is necessary to power the board.

  9. Finally, Click on "Debug" from the "Run" menu in code composer. Once the debug session begins, select "Free Run" from the "Run" menu. You should now see the Alarm LED blinking.

  10. If you were not able to get the project working, you can download a complete version of the project here: LED Blink.zip
 Using the ADC to measure an external sensor

The ADC on the RF430FRL152 is a 14 bit first order sigma-delta with a max sampling frequency of 2kHz and maximum input voltage of 0.9V. The ADC can operate in single ended or differential mode and is capable of both unipolar and bipolar operation. The RF430FRL152 also contains other components needed to make a useful input signal chain such as a mutliplexer, PGA, etc... A block diagram of the ADC interface is shown below:

ADC Block Diagram courtesy of the RF430FRL15Xh family technical reference manual

In this example, we'll use ADC channel 0 to measure a voltage. The evaluation module has a light sensor, (U2) connected to channel 0 and we will use that as our voltage source.

  1. For this project, you can either create a new project as shown in steps 1-4 of example one or you can reuse the previous project by deleting the code you created in step 5.

  2. First we'll set up two variables to hold our ADC reading and voltage value.

    unsigned int ADC_Value = 0;
    volatile float ADC_Volts = 0;
  3. Next, we'll enable the ADC. In addition, we'll also enable the virtual ground to better measure small voltage values. We'll also set the ADC for unipolar operation since we'll only be measuring a positive voltage. Paste the following code inside the main function 

    SD14CTL0 = SD14EN + VIRTGND; 
    SD14CTL1 = SD14UNI;
  4. Next we'll set the multiplexer to channel 0 and perform a conversion. Within the "while(1)" loop of the main function, paste the following code.

    SD14CTL0 |= SD14SC; // Set Mux to channel 0
     
    __delay_cycles(100);
     
    ADC_Value= SD14MEM0; // read ADC value
  5. Now it's time to convert our ADC reading into a voltage. Since the RF430FRL152 is pretty constrained as far as memory is concerned, we'll need to do some scaling to get the appropriate answer. The formula to convert this voltage is shown below, add this code to your main() function. This formula will output the measured voltage in millivolts.

     ADC_Volts = ((ADC_Value >> 8) * 900)/(16383 >> 8); //Convert ADC value to a voltage

    Of course in an actual NFC system, a much better method would be to simply transfer the raw ADC reading to NFC reader and then have the reader's more capable processor convert the reading into a voltage. The point of this step was to simply make it easier to interact with the ADC later in this example.

     

     

  6. Your main function should now look similar to the following.

    void main()
    {
    	WDTCTL = WDTPW + WDTHOLD;                   // Stop watchdog
        // ROM RF13M module setup ** The following three lines are needed for proper RF stack operation
        DS = 1; 									// ROM variable needs to be initialized here
        asm ( " CALL #0x5CDA "); 					// Call ROM function ( Initialize function pointers)
        asm ( " CALL #0x5CAC "); 					// Call ROM function ( Check part configuration)
    	initISO15693(CLEAR_BLOCK_LOCKS);
    	DeviceInit();
    
    	//Configure ADC 
    	SD14CTL0 = SD14EN + VIRTGND;
    	SD14CTL1 = SD14UNI;
    
    	while(1)
    	{
    		SD14CTL0 |= SD14SC; // Set Mux to channel 0
    		__delay_cycles(100);
    		ADC_Value= SD14MEM0; // read ADC value
    
    		ADC_Volts = ((ADC_Value >> 8) * 900)/(16383 >> 8); //Convert ADC value to a voltage
    
    		//Enter Low Power mode
    		//__bis_SR_register(LPM3_bits + GIE);
    
    	}
    }
  7. Build the project and place a break point on the " Volts = ((ADC_Value >>8) * 900)/(16384 >> 8);" line.

  8. 'Connect the MSP-FET to the PC and the evaluation module. Also ensure that switches S4 and S5 are set to the '0' position. Ensure that the evaluation module is located in a relatively well lit place.

  9. Start a debug session. Once the session begins, press "f8" twice so that the ADC records a valid value. Once it hits the breakpoint the second time, mouse over the ADC_Volts variable to see the voltage value. The value should be around 500 mV. If you verify this voltage with a voltmeter, you should see that the voltage reported by the ADC is within a few thousandths of the actual value. Feel free to further test the ADC by adjusting the amount of light hitting the sensor.as you cycle the program. 

  10. As before, if you cannot get the project working, you can download a complete project here: :ADC0.zip

 Sending a ADC value over RFID

 Now to actually utilize the chip's NFC capabilities. In this example we will take samples with the ADC and store them in FRAM so that they can be read by a RFID card reader. Before we start, we need to know a few things about how the RF430FRL152H works internally.

RF430FRL15x Functional Diagram: Courtesy of the RF430FRL15x Datasheet


As can be seen in the figure above, the RF430FRL152 contains 2Kb of FRAM. It is possible to write a custom application entirely in FRAM which controls ISO15693 interface as well as the other peripherals on the chip. However, to make the chip easier to use, TI has included firmware on the chip for controlling various functions. In this example we'll make use of the embedded RF stack to control the ISO 15693 interface and write custom code in FRAM to control the ADC.

Most of the FRAM is divided into ISO compliant "blocks" that can be either 4 or 8 bytes in size depending upon how the user configures the Firmware System Control Register. The blocks start at address 0xF868 and end at 0xFFFF. It is possible to lock blocks to prevent them from being written to via RFID interface however, it is not possible to prevent the blocks from being read via the RFID interface. In this example, the ADC value will be stored in block 9 and then read using a RFID reader.

  1. Start with the NFC example project from TI was used in the first example: RF430FRL152H_ISO15693_Only_Project.zip

  2. Import and setup the project. Once the project is created, open up the main.c file.

  3. The TI example project takes care of configuring the chip to use the RF stack so we'll only need to worry about the ADC portion of the application. We'll begin by configuring a portion of FRAM for storing the ADC value. Add the following code to the main.c file somewhere outside of the main() function.

    //**********************Allocate Memory to Store ADC Reading**********************/
    #define ADC_ADDRESS 0xF88C // Block 9
    #pragma RETAIN(ADC_Read);
    #pragma location = ADC_ADDRESS;
    u16_t ADC_Read[2];
    //********************************************************************************/
  4. Now, configure the ADC like we did in the previous example. This time, we'll also enable a interrupt to trigger once the ADC has completed a conversion. Add the following code to the main() function.

    //Setup ADC
    	SD14CTL0 = SD14EN + VIRTGND + SD14IE; //ADC enabled, Virtual Ground enabled, Interrupt enabled. 
    	SD14CTL1 = SD14UNI + SD14INTDLY0;     // Unipolar mode, Interrupt triggered after first sample. 
  5. Next we'll setup the chip to begin a conversion and then enter low power mode in order to enable the RF stack. Ensure that while() loop in main() contains the following code.

    SD14CTL0 |= SD14SC; //begin conversion
    __bis_SR_register(LPM3_bits + GIE);
  6. Your main() function should now look like the following.

    void main()
    {
    	WDTCTL = WDTPW + WDTHOLD;                   // Stop watchdog
        // ROM RF13M module setup ** The following three lines are needed for proper RF stack operation
        DS = 1; 									// ROM variable needs to be initialized here
        asm ( " CALL #0x5CDA "); 					// Call ROM function ( Initialize function pointers)
        asm ( " CALL #0x5CAC "); 					// Call ROM function ( Check part configuration)
    
    	initISO15693(CLEAR_BLOCK_LOCKS);
    	DeviceInit();
    
    	//Setup ADC
    	SD14CTL0 = SD14EN + VIRTGND + SD14IE; //ADC enabled, Virtual Ground enabled, Interrupt enabled. 
    	SD14CTL1 = SD14UNI + SD14INTDLY0;     // Unipolar mode, Interrupt triggered after first sample. 
    
    		while(1)
    		{
    			 SD14CTL0 |= SD14SC; //begin conversion
    			__bis_SR_register(LPM3_bits + GIE);
    		}
    }
    
    
  7. Next we need to add an ISR to service the ADC interrupt. Outside of main() add the following code.

    #pragma vector=SD_ADC_VECTOR 
    interrupt void ADC (void)
    {
    	switch(__even_in_range(SD14IV,4))
    	{
    		case SD14IV__NONE: // no interrupt pending
    		{
    			break;}
    
    		case SD14IV__RES: //ADC Data available
    		{
    			SD14CTL0 &= ~SD14IFG;   //clear the data available interrupt
    			ADC_Read[0] =  SD14MEM0; //Read the ADC Data
    			__bic_SR_register_on_exit(LPM4_bits);
    			break;}
    		case SD14IV__OV: //Memory Overflow
    	    {
    			SD14CTL0 &= ~SD14OVIFG; //clear the overflow bit
    			 break;}
    	}
    }
  8. Enusre that the MSP-FET is connected to both the PC and the evaluation module. Also ensure that the evaluation module is in a relatively well lit area.

  9. We'll use the TI TRF7970EVM to read the RF430FRL152h. Ensure you have the TRF7970EVM GUI installed on your PC. Plug the TRF7970EVM into your PC and place the antenna of the RF430FRL152hEVM over it as shown in the photo below.



  10. Start a debug session in Code Composer. Once the session begins, select "Free Run" from the "Run" menu. 

  11. Start the TRF7970EVM GUI by opening the "RFIDread.exe" file. 

  12. Under the 15693 tab, ensure that the following options are selected.
    • Inventory
    • Full Power
    • 1 out of 4
    • Main channel AM
    • Enable TRF7970

  13. Click on the "Set Protocol" button. Once the settings are initialized, click on the "Execute" button. This should return the RF430FRL152's UID number



  14. Now select the "Read Single Block" option under "Commands". Enter 09 in the Block Number field and click "Execute". The ADC reading (in hex) should appear in the Data field. 



  15. The code in this example is setup to continuously sample the ADC and update the value in block 9. Therefore every time you hit the "Execute" button, you will retrieve a new value. This program is setup so that each new value will overwrite the previous one, but it can easily modified so that each new value is written to a new place in FRAM.

  16. If you were unable to get the project to function, you can download a complete project here: ADC_NFC.zip

 

 Sending a ADC value over RFID using the embedded sensor application

In the final example, we'll use the embedded firmware on the RF430FRL152 to not only control the NFC interface, but to control the ADC as well. This is actually very simple to do, but can be a bit unintuitive.

The embedded sensor application allocates a series of registers in FRAM that control the RF430FRL152. These registers operate in a similar manner to the chip's working registers. By writing to these registers over the RFID interface, we can control the chip's functions wirelessly. A full description of these registers can be found in the RF40FRL152 firmware user's guide.

  1. Start by downloading and opening this example project:ROM_Example.zip.This program simply sets the value of the Firmware_System_Control_Byte and sets up the interrupt vectors that will be used by the embedded application. Once the project is open, build it and ensure that it builds without errors.

  2. Connect the MSP-FET to both the PC and RF430FRL152HEVM. Also connect the TRF7970EVM to the PC. Then place the antenna of the RF430FRL152HEVM over the antenna of the TRF7970EVM.

  3. Now launch a debug session. Once the session is started, select "Free Run" from the "Run" menu.

  4. Launch the TRF7970 GUI. 

  5. Select "Inventory" then click "Set Protocol" and then "Execute".



  6. Under commands, select "Write Single Block". In the "(First) Block Number" field write the value "04". In the "Data" field write the value "05400505". Then click "Execute". This command will configure the ADC0 so that the virtual ground is enabled, the gain is set 1 and the CIC filter is enabled with a decimation ratio of 32.



  7. Under commands, select "Write Single Block". In the "(First) Block Number" field write the value "00". In the "Data" field write the value "E3040001". Then click "Execute" This command configures the sampling scheduler so that it will sample every five seconds and log a total of 1792 samples. This command also enables ADC0 and starts the sampling process. It is a good idea to always set this block last so that you don't end up trying to adjust the chip's settings as it is sampling.



  8. After about a minute or so the chip will start saving the readings in memory. In four byte block mode, the data begins at block 18. To read this data, simply select " Read Single Block", enter the block number and hit "Execute". Note that since the ADC reading is stored as a 16 bit value (2 bytes), each block will contain two readings. Likewise, each block will store four readings if 8 byte block mode is used.



  9. Unlike my lazily written program in the previous example, the firmware will save each reading in a new register. To access the new readings, simply read the appropriate block. 



     

Contacting the Author:

Hopefully this article helped you get started working with the RF430FRL152H. If you have any questions or comments about this article, feel free to contact me at EEWiki@digikey.com. 

  • No labels