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: MSP432P401R

Part Number: MSP432P401R

Tool/software: Code Composer Studio

Hello everyone,

I'm working with the i2c protocol of the launchpad to communicate with 2 other msp432p401r launchpad. My question is if there is a dynamic way to change the slave address for the launchpad, I know that in the MSP_EXP432P401R.c file of each new project the address is set to 0x48 h. Is there an API that changes this address, without I having to change it manually?

Thanks

  • You could use the push buttons to change the address.
  • Samantha,

     The I2C initializaiton driverlib API can change the slave address. This can be found in the MSP432 Driverlib User's guide.

    I2C_initSlave(uint32_t moduleInstance, uint_fast16_t slaveAddress, uint_fast8_t slaveAddressOffset, uint32_t slaveOwnAddressEnable)

    for example:

    uint16_t slaveAddress= 0x20;

    I2C_initSlave(EUSCI_B0_BASE, slaveAddress, EUSCI_B_I2C_OWN_ADDRESS_OFFSET0, EUSCI_B_I2C_OWN_ADDRESS_ENABLE)

    Note that up to 4 own-addresses can be specified (EUSCI_B_I2C_OWN_ADDRESS_OFFSET0-3). This means the slave can be set up to respond to 4 different I2C addresses. 

    As Mike suggested, you could set up some GPIO and read their state to set slave Addresses. Alternately, you could set up the slave to respond to up to 4 addresses all the time.

    Regards,

      - Bob L.

**Attention** This is a public forum