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.

RF430FRL153H: Controlling GPIO with ROM functions

Part Number: RF430FRL153H
Other Parts Discussed in Thread: RF430FRL152H, RF430FRL154H, RF430FRL152HEVM, DLP-7970ABP, TRF7970A, MSP-FET, PCA9306

Hello,

I intend to use the RF430FRL153H for a project. I need to read an analog sensor and, after the reading, send an 1.5 V signal to reset the sensor.

So the sensor output pin would be connected to the ADC, and I would like to send the reset signal using a GPIO.

My question is whether I need a custom firmware for this or I could use the built-in ROM functions.

Thanks. 

  • Hello Delson,

    the functionality you need can not be implemented without custom firmware. This is not very complex. One way to implement this is to use the SensorHub Project from our sample code. Enable in the firmware in addition to the ADC0 also Digital Sensor1 and put the initialization code for the GPIO into DigitalSensorInit() and into the DigitalSensorMeasurement() subroutine put the code to control the GPIO for the reset of your sensor. Most of the code that handles the digital sensors from the SensorHub Project can be removed from these subroutines.

    For example:

    void DigitalSensorInit()
    {
    
        P1DIR |= BIT0;
        P1OUT &= ~BIT0;
    }
    
    
    u08_t DigitalSensorMeasurement ()
    {
    	u08_t sensor_sampled = 0;       // flag to keep track if any sensor was actually sampled
    
    	if (SENSOR_TYPE_MAILBOX == DIGITAL_SENSOR1) // does the ROM code request digital sensor 1 to be sampled?
    	{
    	    P1OUT |= BIT0;
    	    __delay_cycles(100);
    	    P1OUT &= ~BIT0;
    
    		sensor_sampled = 0;     // no sensor sampling was performed
    	}
    	else if(SENSOR_TYPE_MAILBOX == DIGITAL_SENSOR2) // does the ROM code request digital sensor 2 to be sampled?
    	{
            sensor_sampled = 0;     // no sensor sampling was performed
    	}
    	else if(SENSOR_TYPE_MAILBOX == DIGITAL_SENSOR3) // does the ROM code request digital sensor 3 to be sampled?
    	{
            sensor_sampled = 0;     // no sensor sampling was performed
        }
    
    	return sensor_sampled;			// if 1 indicates that a sensor read was performed, the ROM code will only store the value on a non-zero result here
    }

    Best Regards,

    Helfried

  • Hello Helfried,

    Thank you for your prompt response! I think this code will help me a lot.

    But I still have some additional questions:

    1) Just to confirm, is BIT0 = 0x01 ?

    2.1) Would this code work fine with RF430FRL153H despite the fact that it doesn't have serial interfaces (I2C, SPI) for digital sensors?

    2.2) According to the functionality I described, would you say that RF430FRL153H is really the best choice among the RF430FRL15xH devices?

    3) Is it possible for me to download the firmware into the chip using RF programming? If so, what would be the required hardware tools? (I'm currently using a PC with Windows 8 OS)

    Best regards.

  • Hello Delson,

    1. yes BIT0 = 0x01, in the file rf430frl152h.h are defines for every bit.

    2. You are right. Because I only have the EVM with RF430FRL152H it worked for me. After disabling the USCI support in the Firmware Control Register the digital sensors are no more supported. Seems the RF430FRL154H is the right choice in this case.

    3. Firmware can be downloaded by RF programming. The GUI for the RF430FRL152H EVM has this function implemented.

    For more information please see the EVM Users Guide:

    https://www.ti.com/lit/pdf/slau607

    Best Regards,

    Helfried

  • Hi Helfried,

    Thank you for your help!

    I would like to buy the RF430FRL152HEVM and implement my functionality (get a readout from an analog sensor connected to the ADC, send the data via NFC, and afterwards send a HIGH signal to reset the sensor) using RF programming. But I am a bit confused about the equipment required to do so. I couldn't find the MSP-EXP430G2 available for purchase, which is one of the required tools according to the document you provided. 

    Could you please help find the most suitable equipment for me to download the firmware into the EVM?

    Best Regards

  • Hi Delson,

    to use the GUI for the RF430FRL152HEVM you will need the TRF7970A reader which consists of the EXP430G2 Launchpad together with the DLP-7970ABP Booster Pack. The EXP430G2 is meanwhile obsolete but was replaced by the EXP430G2ET which is fully compatible. This should be available from most distributers.

    To load the firmware to the EXP430G2ET Launchpad the debug hardware with USB port is integrated on the board. The firmware for the RF430FRL152HEVM can be downloaded via RF, but I would recommend to buy in addition the MSP-FET which connects to the JTAG interface and can be used with the Code Composer Studio to download and debug your code.

    https://www.ti.com/tool/MSP-FET

    Best Regards,

    Helfried

  • Hi Helfried,

    Thank you for your help!

    I still have a question about the EVM: Will I be able to connect my own sensor to the ADC on this board? I ask this because the user's guide shows that ADC0, ADC1 and ADC2 are already connected to a thermistor and a light sensor. 

    Best Regards

  • Hi Delson,

    that's right, but there is the connector SV1 which is marked DNP and can be soldered to the board to get access to the ADC signals. The resistor R16 has to be removed.

    Best Regards

  • Hi Helfried,

    Let me check if I understood it properly. By removing R16, I would cut the connection between the light sensor and ADC0. So I would be able to connect my own sensor to ADC0 using pin 3 of the connector SV1. Is that right?

    Best Regards

  • Hi Delson,

    that is right. If you plan to use the GPIO P1.0 and the 1.5V signal level is sufficient for your sensor, you can connect it at the resistor R13.

    Best Regards

  • Hi Helfried,

    Thank you for all your help!

    Yes, the 1.5 V signal level is sufficient for my sensor, more specifically it requires a voltage level between 0.9V and 1.65V. I have two further questions about the connection you suggested:

    1) How exactly should I connect the sensor to R13? Must R13 be removed from the board?

    2) According to the block diagram shown in section 2.1 of the user's guide, P1.0 is connected to a level translator. Could this level translator bring me any trouble?

    Best Regards

  • Hi Delson,

    1) I recommended R13 as connection point for your reset signal to solder a wire to your sensor. The resistor is not needed for your application and can be removed to save power.

    2) As long as the 3.3V at the level translator is not supplied it will give you no trouble.

    Best Regards,

    Helfried

  • Hi Helfried,

    Thank you very much for your help! Your answers will be greatly valuable for my project.

    I also would like to know if I will be able to read sensor's data with the GUI even using the custom firmware.

    Best Regards,

    Delson

  • Hi Delson,

    you have to setup the virtual registers with the GUI, meaning enable the digital sensor and the ADC, then the GUI knows the configuration and the sensor data can be read out.

    Best Regards,

    Helfried

  • Hi Helfried,

    I still can't fully understand the reason why I have to enable the digital sensor if I want to sample just an analog sensor. Could you please explain it to me a bit further?

    Best Regards,

    Delson

  • Hi Delson,

    I will try to explain it. The RF430FRL152H ROM firmware works with a scheduler that handles the enables sensors. Your goal is to sample the analog sensor with the ADC, which can be fully handled by the ROM firmware when configured to your needs. After that you want send a digital reset signal to the sensor. For that I proposed to enable a digital sensor. Because digital sensors are specific to the customers needs the software part to handle these sensor must be written by the customer. When digital sensors are enabled the scheduler will also execute this specific code. The code for a digital sensor consists of two parts. One is the initialization of the sensor and the other is the measurement part. In your case it is very simple because the initialization part is just the setup of the port for your sensor reset signal and the measurement part is setting the reset signal for a defined time. When the digital sensor is enabled the initialization part will be executed at startup and then the scheduler will handle first your ADC analog measurement and after that the digital sensor which is in your case only the handling of the reset signal.

    Best Regards,

    Helfried

  • Hi Helfried,

    Thank you for your crystal-clear explanation!

    I believe that I understand it now. I have to implement a digital sensor driver (Init and Measurement functions) to trigger the port, in this case P1.0. Once the chip is powered, ROM scheduler will execute the initialization part, and wait for me to send an Write Single Block command to Block 0x02 (8-Byte block), setting the Gain, Digital Filter, Decimation Ratio and Virtual Ground. Then by sending a Write Single Block command to Block 0x00, I will select which sensors I would like to sample (I have to choose ADC0 and Digital Sensor 1) and set the Start Bit to start the sampling process. Finally I am able to read stored data from my sensor using Read Single Block commands sent to Block 0x09 (no data was logged from the digital sensor 1 measurement, because DigitalSensorMeausurement() returns 0).

    Could you please tell if what I described above is correct?

    Best Regards,

    Delson

  • Hi Delson,

    yes, what you have described is correct.

    Best Regards,

    Helfried

  • Hi Helfried,

    Thank you for your feedback!

    I think that I am ready to start writing code. I have downloaded SensorHub Project from TI's webpage and installed CCS 10.3.0 on my computer. But there is a lot of files in the folder of the project (main.c, main.h, patch.c, types.h, etc) and I am not sure about which files I have to change to make everything work fine. I changed only Init and Measurement functions within main.c, but I don't know if it is sufficient.

    Could you please guide me through this process since this is the very first time I'm doing such a thing?

    Best Regards,

    Delson

  • Hi Delson,

    sorry for the late answer. Seems I missed this one. Is this still an open question or could you make some progress?

    Best Regards,

    Helfried

  • Hi Helfried,

    Yes, my question is still open. I modified the file "main.c", adding the functionality to trigger P1.0 and removing the digital sensor drivers initially included into the SensorHub project. I have built the project on CCS and a txt file was generated in the Debug folder of the project. However I would like to know if this is the right procedure. I'm using the EVM and I want to download the firmware via RF, but I don't want to mess up with the interrupt vectors, since I don't have the MSP-FET. Could you please help me?

    Best Regards,

    Delson

  • Hi Delson,

    if it is possible for you, you can post your project or TXT file here as ZIP File and I will check if the RF download will work without messing up the EVM.

    Best Regards,

    Helfried

  • Hi Helfried,

    Thank you for your help!

    Below you will find the txt binary file generated after compiling.

    RF430FRL152H_SensorHub_Project.zip

    Best Regards,

    Delson

  • Hi Delson,

    I have downloaded your TXT file via RF to the EVM and it is still accessible via RF. I tried to measure the reset signal that you want to use at P1.0 but could not measure a signal when digital sensor 1 is enabled. Is that already implemented in your code?

    Best Regards,

    Helfried

  • Hi Helfried,

    Thank you for your help!

    Yes, I implemented the reset signal at P1.0 when digital sensor 1 is enabled as you suggested before. The only difference is that I used "__delay_cycles(10000)" instead of "__delay_cycles(100)". Could that be the cause of the problem?

    I rebuilt the project using  "__delay_cycles(100)". You can find the txt file below.

    Now I have a question: how can I convert the number of cycles to actual time?

    RF430FRL152H_SensorHub_Project_v2.zip

    Best Regards,

    Delson

  • Hi Delson,

    after executing some measurements I saw that the level-shifter U4 (PCA9306), even it is not supplied, will impact the output signal at P1.0. Using P1.3 is the better choice and you can connect your signal at the resistor R20 (100k).

    The __delay_cycles(n) instruction is based on the CPU clock (MCLK) which is set to 2MHz. A value of 100 gives 100 * 500ns = 50µs.

    Best Regards,

    Helfried

  • Hi Helfried,

    I'm happy to tell you that I managed to program the EVM via RF successfully. I used P1.3 to implement the reset signal, as you recommended, and everything worked perfectly. I also managed to control the width of the pulse changing the number of cycles and it also worked as expected, according to my measurements.

    Thank you very much!!

    P.S.: I just want to know if I can keep P1.0 as the source of the reset signal on the board of my project (since there is no level-shifter there).

    Best Regards,

    Delson

  • Hi Delson,

    good to hear that you could make progress with your project.

    The output P1.0 can also be used on the board of your project. The problem is only caused by the logic implemented on the EVM.

    Best Regards,

    Helfried

  • Hi Helfried,

    I thank you a lot for all your help! I managed to program the EVM via RF as I wanted and I also was able to connect my sensor to ADC0 and P1.3 following all your instructions and everything worked perfectly. 

    I think we can finally mark this thread as closed. Once again: thank you!

    Best Regards,

    Delson

  • Hi Delson,

    thank you for your response. I whish you all the best for your project.

    Best Regards and greetings from Bavaria,

    Helfried