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.

MSP430 conversion to Tiva M4 SPI Issue

Other Parts Discussed in Thread: TM4C123GH6PM, MSP430FG4618

I have a project in which I was using a MSP430FG4618 for to communicate and process data from a SPI slave. However, I wanted to move to something faster and decided to try out the TM4C123GH6PM in the launchpad eval kit. With trying this out, I'm having issues with getting SPI to properly work with my component.

I've followed the example code contained within the Tiva software for SSI0 and modified it to "work" with the W5200. When I run the code, I don't get any data back from the SPI slave. I've made sure that all the pins are properly connected, and the W5200 is supposedly compatible with mode 0 and mode 3 for SPI. I was wondering if someone could give this a second look and see if there's something I'm overlooking.

MSP430 Relevant Code: http://pastebin.com/ZG21arsX

Code for SSI: http://pastebin.com/YpSK6r8h

  • 1. Try to use the Oscilloscope capture the waveform. 2. Check the peripheral clock. 3. Check the communication speed.
  • Hi,

    Two problems with your code:

    a) PD7 is by default a NMI pin so to use it as GPIO you need to unlock it first. See the GPIO chapter in user manual how to do that or search the forum for similar threads or use another pin without this problem.

    b) in MSP code, writing to SPI is done with frame pin low while sending all five bytes, then set high at the end. This means Moto mode 3 rather than 0 as you program it. You may try to change this setting to mode 3 or set SSIFSS as GPIO and manage it manually as in MSP. You may try this because for many devices rising FSS pin means  ending the command (which is an equivalent of only mode 3 allowed).

    Take care for program structuring - see MSP code has some writeto(address, data) routine used many times due to W5200 internal structure - try to do the same, it will be easier to manage whole program later. I know this is your first try, but it matters...

    Petrei

  • Thanks for the responses. I was just able to get the SPI communication working.

    Since I always find it helpful for people to post solutions to their problems, here's a quick writeup on what I did afterwards.

    I realized I had an error with my MSP code, using the TX flag rather than the RX to see if the communication was done. Once that was fixed, I was able to slow the communication down enough to use a spare arduino I had around with Ardulogic (https://github.com/cliffordwolf/ArduLogic) since the Oscilloscope I own is old and I could not figure out how to display a non-repetitive signal. Once I was able to compare the waveforms to make sure I was using the same SPI mode on the TM4, I changed the M4 so it didn't do a UARTprintf during the middle of putting data on the SSITx stack. After that it seemed to work fine, so I sped the SPI speed back up and it continued to work.