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.

MSP430FR2422: Switch between I2C master and I2C slave

Part Number: MSP430FR2422


Dear Champs,

I am asking this for our customer.

The user wants to use FR2422 with a physical I2C bus which many other I2C devices, say device A, B, C.

When device A exists (,which is detected by a GPIO) on the I2C bus, then the device A will be I2C master and FR2422 be I2C slave.

When the device A does not exist on the I2C bus, then FR2422 will be I2C master.

1. This be implemented by dynamically switching FR2422 I2C between I2C master and I2C slave depending on the availability of device A (using another GPIO). Is it right?

2. The switching between I2C master and slave can be implemented by modifying UCMST and then resetting the I2C module UCSWRS. Is it right?

Do you have any comment/caution for us to switch I2C master and slave?

Wayne Huang

  • Hi Wayne,

    1. According to your description, the status only changed on FR2422, so the things is to ensure FR2422 know whether device A want to join the communication. If in your design device A can interrupt the communication between FR2422 and other devices, one GPIO is OK. If not, you need another GPIO used as ACK from FR2422. You can use GPIO interrupt and it is higher priority that I2C interrupt.

    2. You first need to set "UCB0CTLW0 = UCSWRST" to enable software reset, after reconfiguration, you need to set "UCB0CTLW0 &= ~UCSWRST" to close software reset. I strongly advise you to refer to our example code.

    3.  Change the status of FR2422 will involve some risks. It depends on how you design the software. Can you send the information to FR2422 which it wants to get from device B and C, through device A? It means FR2422 always be slave, and you move the work to device A. Then you can save 1 GPIO.

    Eason

  • Dear Eason

    I understand. 
    thank you for your information. 

    Wayne

**Attention** This is a public forum