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.

CCS/MSP432P401R: TMP006 simple link example doesn't work

Part Number: MSP432P401R

Tool/software: Code Composer Studio

Hi,

I have instal the simple link example , but it not work, the program stops after call the function sensorTmp007Init, i don't understand what it's happend..

Can anyone help me?

  • Armando,
    What board are you using? Have you verified that an I2C sensor is present (on a boosterpack or as a separate device connected to the LaunchPad)?
    Regards,
    Bob L.
  • Hi Bob

    I do not even know what to do. I have tried everything,  I mistrusted the sensor ... It's not a boosterpack, it's an adafruit board like this:

  • Armando,

     OK. It's not a problem to have sensors that aren't in a boosterPack!  If you could also steer me to where you got the example. I don't recognize the code snippet or project name as one of the I2C examples that can be found on TI Resource Explorer under the MSP432 SimpleLink SDK examples.

     What may be happening is that you simply aren't using the right combination of LaunchPad pin to Peripheral pin assignment. If you send me the location of the example, then I can help you run down the issue.

    Regards,

      Bob L.

  • Bob Landers

     I am glad to wear that(" OK. It's not a problem to have sensors that aren't in a boosterPack!"), I follow the example that can be fond on TI Resource Explorer in this link boostxl_sensors_sensorgui_msp432p401r . The only modification I made it was on main.c .

    The conections:

    MSP432              TMP006

    5V  ----------------->VCC

    GND---------------->GND

    P6.5---------------->SCL

    P6.4---------------->SDA

    GND---------------->AD0

    GND---------------->AD1

    #include <stdio.h>
    #include "msp.h"
    #include "main.h"
    #include "driverlib/driverlib.h"
    #include "HAL_I2C.h"
    #include "TMP006.h"
    
    // TMP007
    uint16_t rawTemp;
    uint16_t rawObjTemp;
    float    tObjTemp;
    float    tObjAmb;
    bool TMP_on = true;
    
    
    void main(void){
    
        WatchDogHold();
    
        /* Initialize I2C communication */
     
        initI2C();
    
        /* Initialize TMP006 temperature sensor */
        sensorTmp007Init();
        while(1){
    
            /* Obtain temperature value from TMP006 */
            if(TMP_on){
    
             sensorTmp007Enable(true);
            
             sensorTmp007Read(&rawTemp,&rawObjTemp);
             sensorTmp007Convert(rawTemp, rawObjTemp, &tObjTemp, &tObjAmb);
             sensorTmp007Enable(false);
            }
        }
    }
    
    void WatchDogHold(void ){
    
        WDTCTL = WDTPW | WDTHOLD;  /*STOP WATCHDOG TIMER*/
    }
    

  • Hi Bob,

    Do you see any problem in my implementation?

    thank you

  • One immediate question is, do you have the Bosch Sensor Sensor Hub BoosterPack (which has a clear BOSCH on the silkscreen), or do you have the BOOSTXL-SENSORS BPack as shown in this link?  The code required for the 2 will differ, so to use the demo code you reference will require having that boosterpack installed. I just confirmed that the code will go past the sensorTmp007Init(); call for the demo code in question.

    -Bob

  • Bob

    I have already tested both the tmp006 and tmp007 codes, both do not work. I already know what to do. as I mentioned earlier I have an adafruit board, which contains the tmp006, as I have seen that some users also have problems when trying to connect with this sensor, I tried the code of tmp007, and it works until entering the following part:

            sensorTmp007Read(&rawTemp,&rawObjTemp);

            sensorTmp007Convert(rawTemp, rawObjTemp, &tObjTemp, &tObjAmb);

    on the base both codes are similar should it work ... the code hangs on booleans

  • there are some things i don't understand, I have read and study the both type of sensors (BOOSTXL-SENSORS BoosterPack and BOOSTXL-EDUMKII temperature sensor). In both's the approach seams the same. Soo I don't understand why I cant get obtain temperature values. It has any problem with the drivers? What can I do?
    there are anyone who have tested this codes and have get good results ?
  • Armando,

     Were you able to make any more progress on this? I took a look at the base code for sensorTmp007Read and sensorTmp007Convert() and you look to be using them correctly in your code.  From this point the only other thing I would try is to use the sensors BoosterPack along with the boostxl_sensors_sensorgui code you referenced to see if everything works correctly for your board when using the  hardware for which this example was designed.

    For your future reference, here is what else I might suggest to get this working:

    1. Verify that your code is using the correct slave address for your hardware (The default slave addresses for both the Adafruit board and the TMP007 sensor in the Sensors BoosterPack are 0x40, but these can be changed with jumpers or other tie-offs of the ADDR inputs on these parts.

    2. Verify that the register addresses provided to the TMPxxx sensors are correct for that part.  Bot the boostxl_sensors_sensorgui and Adafruit driver seem to have the same register addresses for the TMP007 device, but it would be good to check with a logic analyzer to see what is actually being transmitted.

    3. If the code is still hanging before transmitting and I2C address/request to the sensor, it would be helpful to see the logic analyzer output to see if the peripheral itself is hanging.

    4. Since the APIs in question use call-by-reference parameters, it's possible that the address is incorrect and we are getting a bus hang due to an illegal address. This would appear as a "hang" from outside the board, but you coudl detect this bus fault from within CCS.

    5. Monitoring the SCL line using an oscilloscope may allow you to detect whether its the slave or the master that is holding the bus (if you see in your logic analyzer output that the transaction is hanging). You may have to put a low-value resistor (50ohms?) in the path from the TMP006 in order to detect this.  If you are monitoring directly at the TMP006 SCL pin and the SCL is held at 0v, then it's likely the TMP006 holding the bus. If the value at this pin is instead, say, 0.3v, then it is probably the master that is holding SCL low.

    That's all the help I can provide for now. If you do get this working, or have some additional debugging data, please followup on this post.

    Regards,

      Bob L.

  • Hi Bob Landers, 

    I have implement many other codes, to make the sensor work. But all work is unsuccessful, I dont now what I have to do, to get the goal. i send to you my digital analyzer capture

    I need a code that has already been tested and is working for someone to check if the problem is sensor or implementation. I start to question everything

  • Your diagram looks OK- I can see the START condition and STOP condition in the output. Here's an example pair to use to see if I2C is working on your launchPad. You would need 2 LPads for Master/Slave pair.

    The examples below are in TI Resource Explorer under the MSP432P4 SDK:

    1. i2c_master_w_multibyte-master_code

    2. i2c_master_w_multibyte-slave_code

    An alternative would be to run the TMP007 example from the SENSORS boosterpack while it is attached and see if you get the results mentioned in the SimpleLink Academy (SLA) Module. 

    (NOTE- at this moment the SLA link is down. I'll update this post when that is available). 

    Regards,

      Bob L.

  • Hi Bob Landers

    I've been able to get values, however, the code only runs the first time. After that the read value "freezes". I leave my written function of my I2C code

    void I2C_write16(unsigned char pointer, unsigned int writeByte){
        /**/
        while(EUSCI_B1->CTLW0 & EUSCI_B_CTLW0_TXSTP);
        /*START I2C WRITE OPERATIONS*/
        EUSCI_B1->CTLW0 |= EUSCI_B_CTLW0_TR + EUSCI_B_CTLW0_TXSTT;
        /**/
        EUSCI_B1->IFG &= ~(EUSCI_B_IFG_TXIFG0);
        /**/
        while(EUSCI_B1->STATW & EUSCI_B_STATW_BBUSY_OFS);
        /**/
        EUSCI_B1->TXBUF = pointer;
        /**/
        EUSCI_B1->TXBUF = ((unsigned char)(writeByte>>8));
        /**/
        EUSCI_B1->TXBUF = ((unsigned char)(writeByte&0xFF));
        /**/
        EUSCI_B1->CTLW0 |= EUSCI_B_CTLW0_TXSTP;
        /**/
    }

**Attention** This is a public forum