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.

MSP432 8-bit and 16-bit SPI Framing support

Other Parts Discussed in Thread: CC3200

Team,

Lots of other Forum posts on this subject.  Just want to clarify for our customer.

If the MSP432 is the SPI Master but where some SPI Slaves require 16 bits framing and some Slaves require 8bits framing, is this still supported?

Bus speed remains the same in both cases.  The master can adapt the bus speed/framing to what is required for a particular slave, not the other way around obviously. The master needs to be able to support 8bits and 16bits framing for the customer application.

Although the MSP432 SPI implementation is indeed on an 8-bit framing mechanism, we believe that with a SPI Master implementation, both 8 and 16-bit should be possible given One byte after the other…since the Master provides the clock in that case.

Comments welcomed please!

-CY

  • May I also participate?
    Look at SPI implementation on the CC3200.
    It has some significant enhancements:
    - Selection of SPI word lengths at 8, 16, and 32 bits;
    - Multiple SPI word access with a channel using an enabled FIFO (up to 64 bytes);
    - No dead cycle between two successive words in slave mode.
    So, why do not implement this in a new generation of MSP432 (32-bit with FIFO) and MSP430 (16-bit with FIFO)? It will give a significant impact on overall performance characteristic when external SPI displays or DACs are used.
    But specially for DACs (where precise timings is essential) should be good to have additional trigger in SPI FIFO to send TX data controlled by an interrupt trigger from a timer. (In some DACs there is an additional data buffer with interrupt pin, so such specs for SPI are optional or useless for differential analog outputs).

    Thanks,
    Alexey

  • What Alexey said, plus:

    If "framing" is intended to mean "the transaction length supported by the Master-side automated-/CS" (see also: UCSTEM), why limit to 8/16-bits? I've seen very few SPI slaves that really want /CS to wiggle on every (8/16-bit) word, so in my world the Master automated-/CS is mostly useless , and /CS has to be done in software. Most SPI slaves want /CS to frame a whole transaction, which might be 1 or 514 bytes.

    Why not have instead (a) a transaction-length setting (as seen in the eUSCI I2C) or (b) an end-of-transaction indicator (as seen in the [pardon the expression] LPC824 series)?

    Oh yeah, and: Second the motion for FIFOs.
  • All my practical experience gives such results: MSP432 has very large SPI data buffer (which is not documented), but MSP430FR - has only one byte.

  • Chris Yorkey said:
    Although the MSP432 SPI implementation is indeed on an 8-bit framing mechanism, we believe that with a SPI Master implementation, both 8 and 16-bit should be possible given One byte after the other…since the Master provides the clock in that case.

    Yes, that does work fine. Unfortunately it limits throughput because the eUSCI can only be loaded with eight bits per transfer. I wish the USCI supported wider transfer sizes natively. Even the crusty old USI can handle up to 16 bits at a time...

    Alexey Bagaev said:
    All my practical experience gives such results: MSP432 has very large SPI data buffer (which is not documented), but MSP430FR - has only one byte.

    I'm curious... what test conditions reveal the presence of this hidden buffer on MSP432?

  • Thanks Folks,

    We've come to the conclusion that although the MSP432 SPI implementation is indeed on an 8-bit framing mechanism, with a SPI Master implementation, both 8 and 16-bit is certainly possible given that one byte is transferred after the other…since the Master provides the clock in that case, as Robert noted above.  So yes, this should work fine and I appreciate the input from you all.  

     

    From the customer, having an 8bits framing on the Master does not prevent you sending the required numbers of bytes to a particular slave, as long it matches the slave data length. So for a 16bits slave, you just activate the CS, send two bytes, de activate CS. The clock should be maintained for the two consecutive bytes.  And even if the clock pulse is maintained high/low longer between the end of the first byte and the beginning of the second byte, the data is actually sampled on one of the clock edges so it does not really matter.

     

    In summary, the Master is able to support 8bits and 16bits framing for this type of application. 

     

    Thanks,
    CY

  • Chris Yorkey said:
    In summary, the Master is able to support 8bits and 16bits framing for this type of application.

    Why would they have thought otherwise. Seems like they didn't fully understand how SPI works. This interface has been around a long time (I was doing SPI slave designs in ASICs 20 years ago) and is fairly well understood.

    The one thing that does seem to come up often is the "gap" between successive bytes do to the lack of a FIFO on the MSP USCI interface. But this can be mitigated by the use of DMA to load the bytes. Basically in your "transmit" function:

    1. Program DMA for "many to one" starting at 2nd byte.
    2. Optionally program a 2nd DMA channel for "one to many" to handle RX data
    3. Set your chip select GPIO pin appropriately
    4. Kick off the USCI by putting 1st byte into TXBUF
    5. Wait for TX DMA channel complete interrupt, or
    5A. Wait for RX DMA channel complete interrupt
    6. Set CS back to inactive state.

    You should get a continuous stream of bits out of the USCI with no inter-byte gaps. This will work even as SPI clock speed approaches CPU clock speed (for one-way transaction) or 75% of CPU speed (for two-way transaction). (NOTE: Those speed numbers are for MSP430. I have not had an opportunity to learn the intricacies of the MSP432 DMA controller overhead)

  • Robert Cowsill said:
    I'm curious... what test conditions reveal the presence of this hidden buffer on MSP432?

    Pushing a big amount of data (160kB) to SPI in closed loop to external device without waiting for completion and without loosing any single bit of data. (Condition 48 MHz MCLK / 24 MHz SPI clock).

  • Alexey Bagaev said:
    Pushing a big amount of data (160kB) to SPI in closed loop to external device without waiting for completion and without loosing any single bit of data. (Condition 48 MHz MCLK / 24 MHz SPI clock).

    Interesting... I'll have to do some investigation. Did you measure the time delay between the CPU (or was it DMA?) transferring the last byte and the output of that byte on the SPI bus?

  • Nope. But I thought you've already checked my condition. May be in practice MSP432 is not so efficient (ticks per CPU commands) as MSP430. But documentation says opposite.
  • Robert Cowsill said:
    Did you measure the time delay between the CPU (or was it DMA?) transferring the last byte and the output of that byte on the SPI bus?

    It has no delay. So, the answer is no, - there is only one byte SPI buffer on MSP432. (Data is transferring at full speed). The last ticks was spent to complete loop cycle. So after exiting the loop SPI busy flag is cleared.

**Attention** This is a public forum