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.

MSP430F5438A I2C Emulating Multiple I2C Slave Devices

Other Parts Discussed in Thread: MSP430F5438A, MSP430F1232

Hello All,

 

I am using the MSP430F5438A device.

 

I am looking to replace 3 I2C Slave Devices with 1 MSP430.  Initially I thought this would be easy but I cannot figure out (if at all possible) how to let the firmware decide if it will answer a slave address.

 

It appears that the MSP430 can only have 1 own address and also respond to general calls.  This seems to be controlled by the hardware peripheral.

 

What I would like is that any address on the I2C Bus would be passed to the Interrupt Vector and allow the firmware to sort out if it should reply.

 

Is this possible?  I hope I am just missing something.

 

Thanks,

TipTop

  • There is no 'promiscuous mode' in theI2C hardware.

    There is a 'broadcast' address, but it can be only used for sending data to the slaves, not for reading from them.

    If you have control over the master, you can do a broadcast with the address of the next slave to be connected. Then the MSP can react to it and change it's own current slave address if the broadcasted address is one of the slaves' it shall replace.

    The only other solution is to implement a software I2C, which isn't that difficult. (we've once done it with the MSP430F1232 and its rather limited resources, as well as on an even smaller PIC)

  • On the '5438A there are four I2C capable ports.  Maybe you could hook them all up to the bus.  That would give you four "easy" emulated devices.

    It's not as scalable as JMG's idea to do SW I2C, but maybe it gets you up and running quickly since you need only 3 for now.

    Jeff

  • Jeff Tenney said:
    On the '5438A there are four I2C capable ports.  Maybe you could hook them all up to the bus. 

    Ah, yes, that's another possibility.
    Once you got one running (with ISR etc.), it's easy to copy the ISR and add the other devices.

    It even separates the code a bit in case the devices require different data handling.

    However, I don't really like the idea of using three hardware modules for one purpose. It's not exactly 'low power'. But then, a software I2C isn't low power too. :)

  • Thanks for your input and verifying that I wasn't missing something.

     

    I am looking to move to a smaller chip in production but I am using the MSP430F5438A because of the dev kit MSP-EXP430F5438.

     

    I thought of trying the software route but I don't think I have enough horsepower.  The I2C Bus would be running at 400 kHz constantly.

     

    I am going to look into the Stellaris line to see the I2C hardware ports have the feature I am looking for.

     

    Appreciate the quick feedback.

     

    Thanks,

    TipTop

  • TipTop said:
    am looking to move to a smaller chip in production but I am using the MSP430F5438A because of the dev kit MSP-EXP430F5438.

    You should work with the same chip (or at lest the same sub-family) as the one you want to use later.

    So if you're testing with the 5438, you should later use the 5436 or 5419 (identical, just less flash and a bit cheaper), or perhaps with the 5437/5435/5418 (less pins, less ports and only two USCI modules, but otherwise identical).

    If you change family or leave the sub family (devices that share the same datasheet), you risk that you already working code won't work anymore because of more or less subtle differences.

    However, there are some MSPs which have an USI module. The USI I2C isn't as sophisticated as the USCI I2C. It is basically a shift register with lock generator and some rudimentary I2C support. No slave address at all. You get a byte, check whether it is the address you expect a,d if so, submit a ACK or else a NACK.

    It is way more complex to program than the USCI, but in your case it might be the better solution.

    There are some 4x devices which have both, an USCI and an USI. So the USCI can still be used for serial connection etc.

**Attention** This is a public forum