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.

SPI on any GPIO?

Other Parts Discussed in Thread: MSP430F2619

Simple question: Can I use the SPI interface on any GPIO pins? Or does the clock only go on SCLK pin, and the data on SDO/SDI pins? The reason being is that I am trying to output a word to a DAC but on my PCB I have the DAC connected to some other GPIO pins and not to the SCLK and SDO/SDI pins.

I'm using Grace on CCS v5.1 to help set up the USI.

Thanks!

  • Hello,

    Using the USCI module, it is only possible to use the dedicated pins that are selectable with Grace. If you want to use other GPIO ports, the only way to do this is by having a SPI software emulation via bit banging. There are some examples for this available on the web. You would not be able to use Grace for configuring the USCI then.

    Regards,

    Michael 

  • Thanks for the information. This is helpful. Any bit banging SPI emulation code you recommend? Are there any code examples with bit banging? I didn't see any included in CCS. I'll look around on the web for some too.

    Thanks,

    Pradeep

  • Pradeep,

    Sorry, I don't have any specific application notes available. I found some examples on the web, but none of them MSP430 specific.

    Regards,

    Michael 

  • Pradeep Shenoy95552 said:
    Any bit banging SPI emulation code you recommend

    If you're SPI master, you control the timing. So it is very, very simple to implement. Just pushing the data to the port pin and toggling the clock pin.
    The only reason why there is dedicated SPI hardware, is the speed. The USCi can sed/receive one bit per clock cycle. In software you'll need some 20 cycles at least.

  • You forgot to specify which MSP430 chip you are using. Some MSP430 chips have a port mapping function which may allow you to re-map the SPI signals to other I/O pins.

  • If you would just like to see a MSP430 based bit-banging SPI example, look here: https://github.com/GWDeveloper/MSP430-WS2801-RGB-LED-Strip/blob/master/main.c

    Different device but the concept of bit-banging is still the same. Look at the 'display' function. It shifts out 24 bits.

  • Hi,

    Greg Whitmore said:
    MSP430 based bit-banging SPI example

    Thanks greg, i was searching for such an example for quite some time now. My application/project

    requires me to send ADC sampled data to PC via the FT2232D chip. I have connected only GPIO pins

    to the FT2232D. I am using the MSP430F2619 MCU

    best wishes

    janmay

  • janmay b c said:

    My application/project

    requires me to send ADC sampled data to PC via the FT2232D chip. I have connected only GPIO pins

    to the FT2232D. I am using the MSP430F2619 MCU

     Janmay, FT2232 is not an SPI device, is a general purpose dual interface, on your project I remember you used out two SPI, you have both serial USI free and the best way is to connect one to FT2232 serial rxd txd.... This permit you use standard driver: COM on win or serialtty on *nix environment.

     GPIO from FT2232 require to write some device driver or access raw stream @ pc side and this is not a simple task.

     Please try finish a good basic digital and probably analog electronic course to grasp everything you need to start also a simple task like this one otherwise your learning curve can be on the wrong side.

     Regards

  • Dear Sir,

    Roberto Romano said:
    Please try finish a good basic digital and probably analog electronic course to grasp everything you need to start also a simple task like this one otherwise your learning curve can be on the wrong side.

    OUCH !! Yes sir, the truth hurts :-).

     

    Roberto Romano said:
     GPIO from FT2232 require to write some device driver or access raw stream @ pc side and this is not a simple task.

    Unfortunately, i have to do just that, that is use GPIO pins to send data because now changing my

    PCB is like climbing Mt. Everest all over again !!. Fortunately device drivers are available at the FTDI site.

    Thanks once again for the quick response

    best wishes

    janmay

  • janmay b c said:

    OUCH !! Yes sir, the truth hurts :-)

     This is different, is what on term of time cost to you and who try help you get out of wrong see next.

    janmay b c said:

    Unfortunately, i have to do just that, that is use GPIO pins to send data because now changing my

    PCB is like climbing Mt. Everest all over again !!. Fortunately device drivers are available at the FTDI site.

     Cutting two traces and solder two wire costo no more than few minutes or best remaking all PCB than wasting some mount of your time and community too.

     Learning from mistakes help find the right path to even more than driving more far away on wrong way to hell.

     What the best solution?

     Regards

  • Dear Sir,

    Here's my schematic:

    Sir, what i have understood is that, i need to connect the UCA1/0 CLK pins to the FT2232D, for SPI transfer, am i right sir??

**Attention** This is a public forum