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.

MSP430FR5739 4 wire SPI Master

Other Parts Discussed in Thread: MSP430FR5739

Firstly...I am fairly new to chip level programming.

I am trying to port a library that was written for the TI CC85XX device SPI interface using the MSP-EXP430F5438. We were handed the MSP430FR5739 experimenter board to do the interface with.  The only problem I am running into at this point is porting the setup that is used to the new board.

Here is the setup for the F5438:

     // The pin mapping is as follows
    // - RESETn at P5.0
    // - EHIF interrupt at P5.1
    // - SCLK at P10.0
    // - CSn at P10.3
    // - MOSI at P10.4
    // - MISO at P10.5

    // Setup SPI interface: Synchronous master mode, MSB first, MOSI/MISO updated on falling edge of
    // SCLK, MOSI/MISO sampled on rising edge of SCLK
    UCA3CTL0  = UCMSB | UCMST | UCSYNC | UCCKPH;

    // Setup SPI interface: Use SMCLK divided by 4, normally 4 MHz
    UCA3CTL1  = UCSSEL1;
    UCA3BR0   = EHIF_MCU_SPEED_IN_MHZ / 4;
    UCA3BR1   = 0x00;

    // Configure SCLK, MOSI and MISO as peripheral mode pins with pull-up, CSn as GPIO mode with pull-up
    P10SEL    = 0x31;
    P10DIR    = 0x19;
    P10OUT   |= 0x38; // SCLK

    // Start with RESET_N activated
    P5OUT    &= 0xFE;
    P5DIR     = 0x01;

My problem in porting to the MSP430FR5739 is that it does not use the same registers. I am confused with the settings for PxSEL0 & PxSEL1. I could not find the definitions for the primary and the secondary port functions.  Therefore I am unsure what to set that to.

Thanks for any information in this matter!

  • First, use 3-wire SPI mode. (the CS signal isn't part of theis wire count). 4-wire mode is only if you are slave in a multi-slave system or master in a multi-master system. And it still requires you to use one (or more)  separate CS lines controlled as GPIO by the software.

    About PxSELy: these registers switch individual physical pins from GPIO mode to secondary or tertiary function. Since every MSP has a different amount of port pins and different peripherals for secondary pin funcitons, the mapping is different for every MSP.

    See the device datasheet, on which port pins (Px.y) the required fucitonality is available (sometimes it is even mappable). YOu can locate the pins on the pinout drawing or the pin funciton list, and the proper combination of PxSELy bits (and maybe otehrs) can be found in the port schematics for this port at the end of the datasheet.

    Note that the 5438 has an USCI module while the FR devices have an enhanced eUSCI. The two are similar but not fully identical. I'm not sure whether the eUSCI is 100% backwards compatible to the USCI.

  • Jens-Michael,

    Thanks for the help!  I now see the pin mapping function at the back of the data sheet.  I was unaware that this was defined back there.

    I guess being a newby, these are things I will pickup as I go.

    Thanks again!!!

  • Chris McDaniel1 said:
    I guess being a newby, these are things I will pickup as I go.

    Yes, getting used to where information is found across users guide, datasheet and errata sheet (and even within these documents) is one of the challenges when starting with the MSP. However, if you use more than one MSP, you'll soon see the benefits.

  • Hi Jens-Michael,

    Is it possible to use MSP430FR5739 4-Pin SPI master with DMA? I know how to use 3-pin SPI master with DMA to transfer 1K bytes from FRAM to a peripheral, but I have no idea of setting up 4-Pin SPI master with DMA.

    Thanks.
    Ming
  • The USCI can be operated with DMA. The 4-wire mode requires software interaction (as well as selecting the slave before and after the transfer), DMA can only handle the plain consecutive data transfer. For SPI master receive, there also must be an SPI transmit DMA that sends dummy data in order to receive something.
    However, there is an erratum on the eUSCI that under certain circumstances the DMA might miss a trigger and cease operation. I'm not sure whether this applies to SPI or only UART or only USCIA and not USCIB. Please check the most recent errata sheet.
  • Thanks, Jens-Michael.

**Attention** This is a public forum