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.

Interrupt driven SPI slave

Other Parts Discussed in Thread: MSP430F2471

I am trying to implement an interface between a main controller board and an msp430f2471 via the SPI bus where the msp430 is the slave. I would also like this interface to be interrupt driven.

I have already read through the user guide and have set up everything to the best of my knowledge according to the datasheet. I am currently using the Grace software to set up the peripherals  and I have verified most everything that has been set up by Grace. However, communication between the main board and the uC doesn't seem to work.

Currently I have the msp430 set up to transmit 0xAA each time the data transmit iterrupt is triggered, but the main board randomly gets the wrong bytes back. I have connected an oscilloscope to observe the signals  and I can see that the main board gets random garbage back (eg. 0x87 0x49), but the signals look fairly clean and are what one would expect to see when observing spi signals, except the SOMI signal should look very similar to the SCK and it doesn't.

From past experience with SPI, I am suspecting that I have set up some hardware wrong or don't truely understand how interface should opperate (I am very familiar with how SPI busses typically operate but I am unsure of how interrupt driven SPI slaves work specifically with the MSP430).

Does any one have any good leads on where I could find some example code for this? (I've already checked the app notes, searched these forums, and done several google searches)

Also please let me know if you have any good ideas of things to try or look out for.

Thanks so much for your help,

Michael

[sorry no idea why I can't put this in an appropriate forum. Mods please move to appropriate forum thanks]

  • Hello,

    i am not so much into SPI yet, i would say i know less than you, but what i would do is check the SEND Register in Debug mode and look what is in there right before sending.

     

    Because then you can proof if it is exactly the same you can then watch with your oscilloscope.

     

    MSP430 as a slave, i did not think of this yet, how i san send interrupt triggered? You read the Recieve flag and trigger an Interrupt on this flag?

    Can it be that once youre MSP430 send-register is sent out it wont refill with 0xAA but with the previous recieved data  from the master, or you have to refill it manually ( software) with some new data.

     

    Hope somethgin will help you.

    Greetings Seb.

  • did you try the different phase and polarity settings? These affect on which clock edge the bit values are output and captured.

    I found the USCI quite reliable for SPI. I only used it in master mode, but slave mode isn't much different except for the CS handling and the critical timing when stuffing the I/O registers.

    To check whether your code has a problem, we'd need to know it :)

**Attention** This is a public forum