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.

MSP430G2553: MSP430G2553 use both SPI modules at the same time

Part Number: MSP430G2553
Other Parts Discussed in Thread: ENERGIA

Hey,

I am very new in the field of programming the msp430, so I have a question for you guys. For my project I need to use both SPI modules of the MSP430G2553 (USCI_A and USCI_B) to communicate with two slaves (they need to work in different spi_modes, so I need both SPI modules, right?). Is it possible to use both modules at the same time? How can I initialize this? Can you give me an example?

Additionally, I would really like to use Energia to program the msp. Is it possible to implement the use of both SPI modules in Energia?

I want to thank you for your help!


Best regards,
Simon

  • Hi Simon,

    To clarify, are you trying to use the msp430 as a master to communicate with 2 slave devices? If so you would only need to use one SPI module on the MSP430. Using master mode with 4-wire should allow you to communicate with multiple slaves (please see the users guide for information on using 4-wire mode).

    If you do actually need to use two separate SPI modules, then you would use them both the same as you would in the software examples available on the product page.

    There is Energia support for the MSP430G2 devices so, yes, you can use Energia for this.

    Regards,
    Nathan
  • Hi Simon,

    Did this solve our issue? If so, please mark it as answered. If no response soon, this thread will be closed due to inactivity.

    Regards,
    Nathan
  • Hi Nathan,

    thanks for your help and sorry for the late answer. I have another question about my project. As I wrote earlier, the two slaves need to work with different spi_modes (different clock polarity). I want wo use Code Composer Studio for programming now. Is it possible to use just one SPI module and switch the modes when I have finisehd to communicate with one slave and start to communicate with the other?

    Do you think I will run out of memory when I program the communication between the MSP430G2553 and two slaves? Do I have to use another MSP?

    It would be great, if you could help me!


    Regards,

    Simon

  • Hi Simon,

    You could do what you are describing with either both SPI modules or just one. If you just use one and switch the SPI settings between transmissions, then that should work, but it will introduce some latency. If this is not problem for you application, then you should be fine. As for the memory, this should not be a problem as far as the SPI transmissions are concerned. If you will need to store a large amount of data received over SPI, though, then you may need to look at how much memory you will need and what device would provide that.

    Regards,
    Nathan
  • Hi Nathan,

    thanks for your help. Well, can you tell me how much latency it would cause, if I would just use one SPI module? I want to measure some parameters in the heart cycle, so it's not possible, if I have to wait more than 50ms.
    I want to use the MSP430 to read data from slave 1 and send it to slave 2, so I don't need to store the data, but send it immediately.


    Thanks,
    regards,

    Simon
  • Hi Simon,

    The latency would depend on what exactly you are changing (such as clock polarity and other parameters). I do not know what the latency is, but I would suggest that you measure this, and if it is too large for what you are trying to do you can use both modules, which won't add in the latency of switch SPI parameters.


    Regards,
    Nathan
  • Hey Nathan,

    ok, thank you very much. I think I will use both SPI modules to avoid the latency. Can you help me with the pins? In the datasheet I read the following:

    P1_1: USCI_A0 MISO
    P1_2: USCI_A0 MOSI

    P1_6: USCI_B0 MISO
    P1_7: USCI_B0 MOSI

    I know, that I can choose the pin myself for the ChipSelect, but what about the Clock? Are there pins I have to use?

    Thank you very much for your help!


    Best regards,
    Simon

  • Hi Simon,

    Please see the "Port Schematics" section of the datasheet (not the User's Guide). This will tell you the functions of each pin. The clock pin for USCI_A0 is P1.4, and the clock pin for USCI_B0 is P1.5. Please also see the software examples on the MSP430G2553 product page for examples on configuring and using SPI.

    Regards,
    Nathan

**Attention** This is a public forum