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.

RF430FRL152HEVM: ADC0 Value Access

Part Number: RF430FRL152HEVM
Other Parts Discussed in Thread: RF430FRL152H, MSP430G2553, , TRF7970A

Tool/software:

Hi 

I successfully built the RF430FRL152H SensorHub Project on the RF430FRLHEVM, but I’m having difficulty accessing the ADC0 value. I also need to read data from a digital sensor that communicates via I2C. I used open-source code from DigiKey (link attached below) to successfully retrieve the ADC0 value, but now I’m looking for a way to achieve the same with the digital sensor.


Digikey code (forum.digikey.com/.../12928)

  • Hi,

      Please follow section 5 in the RF430FRL152HEVM User's Guide for the jumper configuration in order to run the SensorHub demo.  In order to run the demo, you would need to:

     - Change the jumper setting on the EVM as described in the User's Guide.

     - Update the firmware for RF430FRL152H. The firmware can be downloaded from https://www.ti.com/tool/download/SLAC691/01.00.00.0F. The CCS project is called RF430FRL152H_SensorHub_Project. 

    - download the GUI application for the PC side as noted in the User's Guide. 

    - you also need the TRF7970ABP + MSP430G2553 which is the reader for which this demo is setup for.

    - The firmware running on the reader (TRF7970ABP + MSP430G2553) will retrieve the Sensor Hub measurements and display them through the GUI display. If you don't have the TRF7970ABP + MSP430G2553 but rather a different MCU then you can reference the firmware and port to your MCU host. The firmware for the reader can be downloaded from MSP430G2 LaunchPad TRF7970A BoosterPack Host Control Binary

     This application note RF430FRL152H NFC Sensor Tag Application Example With MSP430 Microcontrollers will be also useful. 

  • Hi Charles

    Thank you for your response. I’m not concerned with NFC communication right now. What I need is to view the digital sensor's reading as an expression in the CCS debugging window. For reference, DigiKey’s open-source code shows how to save the converted ADC0 value in mV as an expression, and I’m aiming to do something similar for the digital sensor.

    Thank you so much for your help.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    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();
    SD14CTL0 = SD14EN + VIRTGND;
    SD14CTL1 = SD14UNI + SD14INTDLY0;
    while(1)
    {
    SD14CTL0 |= SD14SC;
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    https://forum.digikey.com/uploads/short-url/4Tlw3wFC34LpQiSNzZsVWTp3uAW.zip

  • The sensors on the sensor hub can only be retrieved from the I2C interface. If you have downloaded the https://www.ti.com/tool/download/SLAC691/01.00.00.0F, you will find the RF430FRL152H_SensorHub_Project. Inside the project, refer to the DigitalSensorMeasurement() function. For example, to read the SHT21 temp sensor on SensorHub, DigitalSensorMeasurement() will call SHT_21_I2C_Master_Measurement(TEMP_MEASURE_HOLD_MASTER, temp_data) to read the the temp sensor. To read the humidity sensor, it will call SHT_21_I2C_Master_Measurement(HUMIDITY_HOLD_MEASUREMENT, temp_data). Inside the SHT_21_I2C_Master_Measurement() function, it will send the I2C command to retrieve the respective sensor measurement. Refer to the source code for details. 

  • Thank you Charles. I’ve tried the following steps, and I hope you can help me resolve the issue:

    1) The Sensor_hub Project cannot be debugged because it lacks a main function (Pease see the 1st attached screenshot for reference).


    2) I tried defining counter1 and counter2 to monitor their values and verify if the code continuously reads sensor data. However, I couldn’t retrieve these values because the suspend and resume options are unavailable (Debug mode isn't active.)(Pease see the 2nd attached screenshot for reference).


    3) I found a thread (link attached) that suggested writing 0x39 to memory address 0xF87D to fix the debugging issue, but it didn’t work (Pease see the 3rd attached screenshot for reference). While I can now use the suspend and resume options, the debugging process is still flawed. The two counters remain unchanged (see the Expressions window), indicating they might be set to constant random values during initialization.

    1st Screenshot

    https://drive.google.com/file/d/1OVwp1jPuqgo2kQms-gIRpbjQTM8Xkwph/view?usp=sharing

    2nd Screenshot

    https://drive.google.com/file/d/1-Xa1mZ7TYtc7er2UBxga79TsY1Zjf8LC/view?usp=sharing

    3rd Screenshot

    https://drive.google.com/file/d/1saLX-SOQwCdQ_OAphh6JgaeFv5L6lrg-/view?usp=sharing

    Thread

    https://e2e.ti.com/support/wireless-connectivity/other-wireless-group/other-wireless/f/other-wireless-technologies-forum/594614/ccs-rf430frl152h-debugging-152h-sensorhub-example-with-ccs-6-2-0-and-msp-fet 

  • I think you need to read the RF430FRL152H Firmware User's Guide. Got to section 6.3 about reading external digital sensor. RF430FRL152H has firmware already stored in the ROM. However, the ROM firmware does not handle reading the external sensors on the Sensor Hub. You will need to add the custom code to read these sensors. This is why I referred you to the  https://www.ti.com/tool/download/SLAC691/01.00.00.0F, the RF430FRL152H_SensorHub_Project. Did you read the comment in the source code? See below comments and also the function like SHT_21_I2C_Master_Measurement and also the associated linker command file. The ROM firmware will call your custom function such as SHT_21_I2C_Master_Measurement to read the temp sensor over the I2C interface from the Sensor Hub. The main function is inside the ROM firmware. 

    /**************************************************************************************************************************************************
    * Code Space
    ***************************************************************************************************************************************************
    * Please check the lnk_rf430frl152h_Driver.cmd file to customize how much code space is used for logging("FRAM")
    * or for code ("DRIVER_CODE").
    * Also for each new function, please use the following line before the function, to put the code in the correct section:
    * #pragma CODE_SECTION (MyFunction, ".fram_driver_code") //also change MyFunction to the function name
    **************************************************************************************************************************************************/

    #pragma CODE_SECTION (SHT_21_I2C_Master_Measurement, ".fram_driver_code") //see .cmd file for details - all new firmware must go into fram_driver_code memory section space
    void SHT_21_I2C_Master_Measurement(u08_t command, u08_t * rxData)
    {
    UCB0CTL1 |= UCSWRST; // Software reset enabled
    UCB0I2CSA = 0x0040; // I2C slave address of SHT21
    //UCBCTL1 &= ~UCSWRST; // exit eusci reset

    UCB0CTL1 &= ~UCSWRST; // put eUSCI out of reset mode
    UCB0CTLW1 = UCASTP_1;
    UCB0TBCNT = 0x0001;
    UCB0CTL1 |= UCTXSTT + UCTR; // start i2c write operation
    while(!(UCB0IFG & UCTXIFG0)); // wait until transmit is needed
    UCB0TXBUF = command; // send the command
    while(!(UCB0IFG & UCBCNTIFG)); // wait until the stop counter
    UCB0CTL1 &= ~UCTR; // read operation
    UCB0CTL1 |= UCTXSTT; // repeated start
    while(!(UCB0IFG & UCRXIFG0)); // wait until read data available
    rxData[0] = UCB0RXBUF; // read the MSB
    while(!(UCB0IFG & UCRXIFG0)); // wait until more data is available
    rxData[1] = UCB0RXBUF; // read the LSB
    UCB0CTLW0 |= UCTXSTP; // send stop after next byte
    while (!(UCB0IFG & UCRXIFG0)); // wait until more data is available
    //end of while loop

    {
    u08_t crc = UCB0RXBUF; // read the crc, currently not checked
    }
    while (!(UCB0IFG & UCSTPIFG)); // Ensure stop condition got sent
    UCB0CTL1 |= UCSWRST; // put I2C in reset mode

    return;
    }

  • Thank you so much for your response.

    I used the Sensor Hub project downloaded from https://www.ti.com/tool/download/SLAC691/01.00.00.0F (the file is attached below), then created a custom function to display the ADC0 value as adc_mV for initial debugging, also modified the cmd file accordingly, resulting in a successful build with no errors (My goal was to display the ADC0 value first, as I expected it to be around 500 mV, providing a reference point to determine whether I'm displaying the correct or incorrect values), as shown here.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    /**************************************************************************************************************************************************
    * Code Space
    ***************************************************************************************************************************************************
    * Please check the lnk_rf430frl152h_Driver.cmd file to customize how much code space is used for logging("FRAM")
    * or for code ("DRIVER_CODE").
    * Also for each new function, please use the following line before the function, to put the code in the correct section:
    * #pragma CODE_SECTION (MyFunction, ".fram_driver_code") //also change MyFunction to the function name
    **************************************************************************************************************************************************/
    // Custom function to read ADC0 value using the SD14 ADC
    #pragma CODE_SECTION(Custom_ADC0_Read, ".fram_driver_code")
    void Custom_ADC0_Read(void)
    {
    // Initialize SD14 settings
    SD14CTL0 = SD14EN + VIRTGND; // Enable SD14, use virtual ground
    SD14CTL1 = SD14UNI + SD14INTDLY0; // Unipolar mode, no delay
    // Start conversion
    SD14CTL0 |= SD14SC;
    while (SD14CTL0 & SD14SC); // Wait for conversion to complete
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Then called this function within the DigitalSensorMeasurement function, as you can see.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    #pragma RETAIN (DigitalSensorMeasurement)
    #pragma CODE_SECTION (DigitalSensorMeasurement, ".fram_driver_code") //see .cmd file for details - all new firmware must go into fram_driver_code memory section space
    u08_t DigitalSensorMeasurement ()
    {
    u08_t temp_data[2];
    u08_t sensor_sampled = 0;
    if (SENSOR_TYPE_MAILBOX == DIGITAL_SENSOR1)
    {
    SHT_21_I2C_Master_Measurement(TEMP_MEASURE_HOLD_MASTER, temp_data);
    RESULT_MAILBOX = (u16_t)temp_data[1] + (((u16_t)(temp_data[0])) << 8);
    sensor_sampled = 1;
    }
    else if(SENSOR_TYPE_MAILBOX == DIGITAL_SENSOR2)
    {
    SHT_21_I2C_Master_Measurement(HUMIDITY_HOLD_MEASUREMENT, temp_data);
    temp_data[1] &= ~HUMIDITY_SENSOR_ID;
    RESULT_MAILBOX = (u16_t)temp_data[1] + (((u16_t)(temp_data[0])) << 8);
    sensor_sampled = 1;
    }
    else if(SENSOR_TYPE_MAILBOX == DIGITAL_SENSOR3)
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    However, during the debugging process, the adc_mV value appears to be incorrect and seems to be constantly stuck at 31 mV (please refer to the first screenshot). I implemented the code from Digikey that was previously shared in this thread, and it correctly displays the ADC0 values as around 520 mV when exposed to light and 85 mV when the light is reduced by covering the sensor with my hand, accurately reflecting the light sensor’s readings (please refer to the 2nd and 3rd screenshots). Could you please help me figure out what’s going wrong?


    Attachments:

    -Sensor Hub project (Zip file)

    https://drive.google.com/file/d/1vYvDl8L-QzYzzcXxbt05-HodOcdBZ9B7/view?usp=sharing


    - Sensor Hub modified (main.c)

    https://drive.google.com/file/d/1SpPMPcfNoPF7TbCfH8oOpMHGGILntdM0/view?usp=sharing


    - Sensor Hub modified (lnk_rf430frl152h_Driver.cmd)

    https://drive.google.com/file/d/1zPe8jnsdXskKH7Wg9SSdi1H7fhtmwLDM/view?usp=sharing


    -first screenshot

    https://drive.google.com/file/d/1x95mzkbnVyPDtO6zm5piGPk3GxwDkiFQ/view?usp=sharing

    -2nd screenshot

    https://drive.google.com/file/d/1umAZFF2O6w1iiIVUi52B39WJCfLt0AeX/view?usp=sharing

    -3rd screenshot

    https://drive.google.com/file/d/1CrxqlRxdX1ChjpsmmyQyXKaCD4svZ5Oo/view?usp=sharing

    Thank you

  • My company blocks us from external share site. You can drag the image/file into the editing window in e2e. 

    The code you download from Digikey disables the ROM and it runs your custom application  entirely off the FRAM with your own main(). In this mode (ROM being disable), The conversion result is saved to address 0x704. 

     Since you base your project off the example project RF430FRL152H_SensorHub_Project, this project runs the firmware from ROM and branches to your custom functions stored in FRAM. When running from ROM, the ADC result as well as the general configuration of the device is done through the virtual register.  In another word, the configuration of ADC0 is done through the virtual registers. Refer to Firmware User's Guide guide. This means the ADC result will be saved to block 9 in FRAM. Block 0-8 are storage for the various virtual registers. 

  • Thank you, I appreciate it.

    Do you have any simple code, similar to the Digikey example, for a digital sensor? I'd like to use it as a starting point (allowing me to debug and view the reading values as expressions during the process), as I’m feeling a bit lost after trying multiple approaches without success.

    Appreciate your help


    Main.c 

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    #include <rf430frl152h.h>
    #include <string.h>
    #include "types.h"
    //*****************************FUNCTION PROTOTYPES********************************/
    void DeviceInit(void);
    void initISO15693(u16_t parameters );
    //********************************************************************************/
    //*****************************ADC Variables**************************************/
    unsigned int ADC_Value = 0;
    volatile float ADC_Volts = 0;
    //********************************************************************************/
    //*****************************DEFINES *******************************************/
    #define CLEAR_BLOCK_LOCKS BIT3
    #define FRAM_LOCK_BLOCK_AREA_SIZE 38
    #define FRAM_LOCK_BLOCKS 0xF840 //Address of ISO15693 lock blocks
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    lnk_rf430frl152h_NFC_Only.cmd

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    MEMORY
    {
    SFR : origin = 0x0000, length = 0x0010
    PERIPHERALS_8BIT : origin = 0x0010, length = 0x00F0
    PERIPHERALS_16BIT : origin = 0x0100, length = 0x0100
    RAM : origin = 0x1C00, length = 0x1000
    //ROM ISRs, starting points, length not correct
    RF13M_ROM_ISR : origin = 0x54D0, length = 0x0002
    //FRAM : origin = 0xF840, length = 0x0790
    FRAM : origin = 0xF868, length = 0x0468
    FRAM_CODE : origin = 0xFCD0, length = 0x0300 // code area, can be increased / decreased with FRAM, FRAM + FRAM_CODE = 0x768
    JTAGSIGNATURE : origin = 0xFFD0, length = 0x0004, fill = 0xFFFF
    BSLSIGNATURE : origin = 0xFFD4, length = 0x0004, fill = 0xFFFF
    INT00 : origin = 0xFFE0, length = 0x0002
    INT01 : origin = 0xFFE2, length = 0x0002
    INT02 : origin = 0xFFE4, length = 0x0002
    INT03 : origin = 0xFFE6, length = 0x0002
    INT04 : origin = 0xFFE8, length = 0x0002
    INT05 : origin = 0xFFEA, length = 0x0002
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Do you have any simple code, similar to the Digikey example, for a digital sensor?

    The only example for Sensor Hub is the one on the web that I asked you to download. We don't have any other example. You can use the Digikey example and then add the Digital Sensor code from RF430FRL152H_SensorHub_Project. Have you tried that?

  • Yes, I did, but I encountered an endless loop of numerous errors, particularly those indicating that the program wouldn't fit into the memory. Fortunately, I successfully addressed these errors, but the load/build process still hasn't been completed.

    I read the manual, wrote my own codes, and even used online resources and AI coding assistance, but I haven't had any luck so far. That's why I'm seeking help to get this done. Attached is the code I worked on yesterday. It built successfully with no errors, but the debug process wasn't fully completed.

    Could you please take a look and make any adjustments needed to ensure that the digital readings are available during the debugging process?

    Modified main.c

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    #include <rf430frl152h.h>
    #include <string.h>
    #include "types.h"
    //***************************** DEFINES **************************************************/
    #define TEMP_MEASURE_HOLD_MASTER 0xE3 // SHT21 Command for temperature measurement
    #define HUMIDITY_HOLD_MEASUREMENT 0xE5 // SHT21 Command for humidity measurement
    #define MASTER_SLAVE_SELECT BIT7
    #define RESULT_MAILBOX *((u16_t *)0x1D02) // Location where digital sensor measurement is stored
    #define SENSOR_TYPE_MAILBOX *((u16_t *)0x1D04) // ROM code sets this address to the current digital sensor to be sampled
    #define HUMIDITY_SENSOR_ID BIT1 // SHT21 humidity sensor ID bit
    #define PORT_I2C_SEL0 P1SEL0
    #define PORT_I2C_SEL1 P1SEL1
    #define SDA BIT0
    #define SCL BIT1
    #define ROM_SENSOR_SUPPORT_DISABLED 0x00
    #define EROM_EUSCI_SUPPORT_DISABLED 0x00
    #define NFC_BRIDGE_DISABLED 0x40
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Modified lnk_rf430frl152h_NFC_Only.cmd

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    MEMORY
    {
    SFR : origin = 0x0000, length = 0x0010
    PERIPHERALS_8BIT : origin = 0x0010, length = 0x00F0
    PERIPHERALS_16BIT : origin = 0x0100, length = 0x0100
    RAM : origin = 0x1C00, length = 0x1000
    // ROM ISRs, starting points, lengths not correct, needed to force correct compilation
    RFPMM_ROM_ISR : origin = 0x5BB8, length = 0x0002
    PORT1_ROM_ISR : origin = 0x59C0, length = 0x0002
    SD_14_ROM_ISR : origin = 0x5A06, length = 0x0002
    USCI_B0_ROM_ISR : origin = 0x488A, length = 0x0002
    RF13M_ROM_ISR : origin = 0x54D0, length = 0x0002
    WDT_ROM_ISR : origin = 0x5E48, length = 0x0002
    TIMER_A1_ROM_ISR : origin = 0x5E2A, length = 0x0002
    TIMER_A0_ROM_ISR : origin = 0x4E76, length = 0x0002
    UNMI_ROM_ISR : origin = 0x5E42, length = 0x0002
    SYSNMI_ROM_ISR : origin = 0x5E44, length = 0x0002
    RESET_ROM_ISR : origin = 0x5012, length = 0x0002
    // Code area, can be increased/decreased
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Here is a few feedback. 

    First, when you purchase RF430FRL152HEVM, it is preprogrammed with code in FRAM to support Sensor Hub. As explained in the past, the ROM firmware will jump to the Sensor Hub code stored in the FRAM. 

    Second, you could have overwritten FRAM with other examples downloaded from Digikey and that is fine. If you reload the RF430FRL152H_SensorHub_Project again, it reverts back to the same firmware that was originally shipped. This is evident when I try to use the TRF7970A reader and the GUI to access the digital sensors BoosterPack that is plugged on top of the RF430FRL152HEVM. See below screenshot. As you can see the three digital sensors are saved to the respective locations.

    I also enable ADC0 on the EVM for light sensor measurement which is saved to 0xF8B0. 

    To use the stock example, you would need to enable them through the virtual registers. 

    Of course, you could use your own Digikey example to do the same. I just don't know what is actually wrong with it. Since your example completely disable the ROM, there is no need to use pragma to force your custom functions to a specific address using the .frame_driver_code. You should be able to use your original .cmd file. You also don't need the RESULT_MAILBOX. This is a mailbox for exchanging data between the ROM and FRAM. 

    I strongly suggest you add a little of bit at a time. For example, do just ADC0 measurement. Next, modify your code to do ADC0 measurement and one digital sensor measurement. If you get what you want, add another digital sensor. Don't put every measurement like ADC0/1/2 plus three digital sensors on the SensorHub all at the same time. You will save yourself time to diagnose the problem doing one step at a time. 

     

  • Hi Charles,

    Thanks for the suggestion. I modified the code to read just one digital sensor measurement. The build process was completed successfully, and the debugging process is working—I can see the expression values and use resume/pause to step through the code. However, the code is getting stuck at the line "while(!(UCB0IFG & UCRXIFG0)); // Wait for the RX buffer to be ready". I’ve checked the hardware connections—3.3V and GND are properly connected, and I’ve tried different pull-up resistors (initially 4.7K for both SDA and SCL, then changed to 2.2K for both). Additionally, I verified the connection and the functionality of the digital sensor (MS5637) with an Arduino Uno. Below is the modified code along with the updated linker file. Could you please take a look?

    Thank you

    Modified Main.c code

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    /*
    * main.c
    *
    * RF430FRL152H NFC Only Example Project
    *
    * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
    *
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    * Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    *
    * Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the
    * distribution.
    *
    * Neither the name of Texas Instruments Incorporated nor the names of
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Modified lnk_rf430frl152h_NFC_Only.cmd

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    /* ============================================================================ */
    /* Copyright (c) 2014, Texas Instruments Incorporated */
    /* All rights reserved. */
    /* */
    /* Redistribution and use in source and binary forms, with or without */
    /* modification, are permitted provided that the following conditions */
    /* are met: */
    /* */
    /* * Redistributions of source code must retain the above copyright */
    /* notice, this list of conditions and the following disclaimer. */
    /* */
    /* * Redistributions in binary form must reproduce the above copyright */
    /* notice, this list of conditions and the following disclaimer in the */
    /* documentation and/or other materials provided with the distribution. */
    /* */
    /* * Neither the name of Texas Instruments Incorporated nor the names of */
    /* its contributors may be used to endorse or promote products derived */
    /* from this software without specific prior written permission. */
    /* */
    /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" */
    /* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, */
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • However, the code is getting stuck at the line "while(!(UCB0IFG & UCRXIFG0)); // Wait for the RX buffer to be ready"

    Can you use a logic analyzer or a scope to capture the waveform on the I2C bus. This will greatly help in debugging. You want to find out if you have provided a correct command on the bus. If you are stuck on UCB0IFG, this means no data has been replied by the slave device. One thing that caught my attention is the slave address you use is 0x76. You wrote  UCB0I2CSA = 0x76; // Set the slave address for the sensor. The SH21 has the address equal to 0x40. The stock example also uses 0x40 for the slave address. 

  • Thanks for your feedback. I measured the waveform using an available oscilloscope, but it seems to be showing noise. According to the MS5637 datasheet, the slave address is 1110110x. I tried changing it to 0x40, but the code got stuck at the line before the while(!(UCB0IFG & UCRXIFG0)); // Wait for the RX buffer to be ready. It seems that 0x76 works as the correct slave address. Could you please help me troubleshoot why no data is being shown?

    Thank you,



    Calibrator signal with an adjusted probe

    SDA

    SCL

    I2C Address

  • I thought you were using the Sensor Hub BoosterPack. Looks like you are using a different I2C device. 

    Is the first waveform showing SCL during command write, or data read? I can't tell.

    I suppose you make the connections between your device and the EVM for the below terminals on the connectors, right?

  • Yes, my bad. I'm using the MS5637 digital pressure sensor (datasheet and Arduino code attached). I assumed that all I2C digital sensors follow the same general connection and coding principles with just minor variations. I used the connections you mentioned: 3.3V, GND, SDA, and SCL.

    The scope images show the square calibrator wave of the adjusted probe (not connected to SDA or SCL). Then, there are two images side by side of the SDA signal (with the right side magnified to show the waveform) followed by the SCL signal.

    The SCL waveform shows the read data because the code gets stuck after switching to receive mode . Was my assumption incorrect? If so, could you please guide me on how to correctly retrieve the pressure value from this sensor?

    Datasheet
    ENG_DS_MS5637-02BA03_B5 (3).pdf

    Arduino Code
    MS5637_Arduino_Library-master.zip

  • Just following up—please take a look at the attached scope images.

    1- RF430FRL152hevm + MS5637(I2C connection)-> Yellow signal is SCL, Green signal is SDA-> code stuck at "while(!(UCB0IFG & UCRXIFG0)); // Wait for the RX buffer to be ready". 


    2-Arduino Uno +MS5637(I2C connection)-> Yellow signal is SCL, Green signal is SDA

      

    ...

  • I'm not familiar with your MS5637 device. You are calling  SHT_21_I2C_Master_Measurement(TEMP_MEASURE_HOLD_MASTER, temp_data) where TEMP_MEASURE_HOLD_MASTER is equal to 0xE3. This is a command for the SH21 device. Are you sure your MS5637 also takes this same command? What is the command sequence for MS5637  to read its sensor? You need to follow the MS5637 datasheet on how to read its sensor?

    2-Arduino Uno +MS5637(I2C connection)-> Yellow signal is SCL, Green signal is SDA

    This Arduino waveform also has no transactions unless you zoom-out too much. I can't tell what it is. It is just showing some blips.