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.

LP-MSPM0G3507:

Part Number: LP-MSPM0G3507
Other Parts Discussed in Thread: MSPM0G3507, BOOSTXL-BASSENSORS, HDC2010

I'm working with the MSPM0G3507 Launchpad with a BOOSTXL-BASSENSORS connected together.

On the BOOSTXL there is a temperature device HDC2010 at I2C address 0x40.

I’m executing code from the examples directory of the mspm0_sdk_1_10_01_05, file name: I2C_CONTROLLER_RW_MULTIBYTE_FIFO_POLL.c

The code is executing and running without errors reading the first 8 locations of the device (HDC2010).  What I'd like to accomplish is to read the final four locations at address 0xFC, 0xFD, 0xFE and 0xFF of the HDC2010 device.  

A code example would be helpful on how to extend this address up to the last four register address locations.

Thanks

  • Hi Lonnie, 

    In the example you're referring to, above the definition of RX packet size, we note that you should refer to the example with interrupts for reading more than 8 bytes. 

    This example can be found here, and it is used in one of our MSPM0 Academies, which I can be found here.

    After you've switched to using interrupts, reading the last four registers should be about the same as the first 8, just with the new addresses.

  • I’ve switch to the file “I2C_controller_rw_multibyte_fifo_interrupts” and I’m still not getting correct data from the last four locations 0xFC – 0xFF of the device HDC2010 located on the BASSENSOR Board.

    These locations are READ only and should display the Manufacture ID and Device ID respectively.  See attached.

  • Lonnie,

    Was there supposed to be an image or link attached to your latest reply? I can not see it.

    You said you have successfully read 8 bytes earlier, have you tried reading address 0xFC-0xFF using the same program? This could help isolate the issue. Looking at the datasheets, I do not see why only these registers would not read properly. Try to see if you can read them in any manner before changing your code to try to read them in an extended block. 

    Could you also detail how the values you are getting are incorrect? What is the device responding with?

  • Using the same program how would I change it to just read the last four locations (0xFC - 0xFF) ?

  • Better yet; how  should I modify the code to read location 0x00 - 0x0F and 0xFC - 0xFF.  That is what I really want to do

  • I am assuming that you have been performing reads according to tables 7-4 and/or 7-5 in the HDC2010 User Guide, is this correct? Based on these tables, you would just change the address you're currently using to the new addresses you want to read (0xFC through 0xFF). 

    I noticed that the multi-byte read assumes consecutive addresses, and increments the address to read the next register, while data registers and device ID registers do not have consecutive addresses. Is this the issue that you are having? You will have to use separate read sequences to read all of these registers.

    To read location 0x00-0x0F, and 0xFC-0xFF, you can perform a multi-bye read as shown in table 7-5, starting with register address 0x00. Then you'd perform an additional multi-bye read similar to before, but starting at register address 0xFC. 

    Please give this a try and let me know how it goes/ if you need additional assistance.

  • Dylan;  can you give me a code example on how to change the I2C address location I want to read or write.  I'm not sorting it.  I did manage to read locations 0xFC - 0xFF and the values are correct, but I'm not sure how I was able to access those four locations.

  • would it be a subroutine inside the file dl_i2c.h

  • Lonnie,

    I am not sure what you mean when you say you are not sorting it.

    I am glad you were able to access these memory locations correctly. 

    In the "i2c_controller_rw_multibyte_fifo_interrupts" project, you can change the I2C address that you are reading from or writing to by changing "#define I2C_TARGET_ADDRESS (0x48)" to a different address. This define is used in the "DL_I2C_startControllerTransfer()" function later on in the program to start a transfer with the selected address. 

    So to read/write a different I2C address in this program, just change the define I mentioned above. You do not need to change anything in dl_i2c.h.

    Keep in mind that this is distinct from the specific address within the HDC2010 register address. Details on HDC2010 register addresses and how to access them are in the HDC2010 datasheet, which I linked above in a previous response.

  • This is still not working or making sense.  The device I2C address is 0x40.  The internal register addresses are 0xFC, 0xFD, 0xFE, 0xFF.  How do I access the device (0x40) and then change the address in order to read a single or multiple (4 locations starting at 0xFC) of the register locations internal to the HDC2010 device.  I don't understand how to do that.  

  • The device address is 0x40 yes. The register addresses are 0xFC - 0xFF. 

    As I mentioned in the link above, the controller can read the registers on the HDC2010 as shown in tables 7-4 and 7-5. 

    First you perform a write to the target address (0x40), with the register address (0xFC) as the written data, then without stopping perform a read on the target address (0x40). The target should respond with the data. Performing a repeated start (no stop condition) can be done using the DL_I2C_startControllerTransferAdvanced() function and disabling the stop. The length of the read, which is another argument to this function, dictates how many bytes the controller will read from the target. Reading 4 bytes should get you all 4 registers 0xFC through 0xFF. When reading multiple consecutive registers on the HDC2010, you only need to write the address of the first one, and subsequent reads with yield the subsequent register values.

**Attention** This is a public forum