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.

MSPM0G1107: MSPM0G1107TRGER

Part Number: MSPM0G1107

Hello

Could you inform me please how to use MSPM0 SPI  module for "bidirectional" access.

My external peripheral device have 3-wire SPI interface with single bidirectional data line.

-- Regards,

Victor

  • Hi Victor,

    Please see the SPI module of the MSPM0 Academy for a walk through of bidirectional SPI communication using the MSPM0 devices.

  • Hi

    There are no any mentions about bidirectional (single data line) SPI in MSPM0 Academy.

    If you really have some information be more precise, please.

  • Can you tell us what this peripheral is? Since SPI is built on simultaneous transmit/receive, I don't know how a "bidirectional" data line would work.

    3 wire is usually:

    SPI Clock

    SPI from controller to peripheral

    SPI from peripheral to controller.

    With a separate chip select.

  • I haven't seen any provision for 3-pin (bidirectional) in the SPI. I suspect you'll have to swap the IOMUX PF bits in/out yourself.

  • Or write his own "software serial" bit banging functionality. You could use the arduino code as a reference.

  • As Keith mentioned, it would be helpful to see the scheme that the peripheral is using.

    Similarly to what Bruce mentioned, I can say I've worked with a single bidirectional UART line on MSPM0, and as he mentions, you do need to change the IOMUX manually. In my implementation the UART peripheral was only used to detect a start condition, everything else was bit-banged. I imagine that the SPI implementation for the peripheral you mention would need to be done similarly.

  • Thanks to all for answers!

    There are many 3-wire SPI devices. For example, TDA5150

    FYI ... STM32 support such 3-wire SPI mode.

    I know about GPIO "bit-banging", probably this is only right/simplest choice.

    -- Best Regards

  • Hi Victor,

    Thank you for the feedback.

    Yes this isn't natively supported on MSPM0 devices, so you'd need to bit-bang at least part of this functionality. You could implement this starting with SPI with the PICO pin connected to the TDA5150/ other SDIO line. Looking at the TDA5150 datasheet, you could send the device address then the data with the SPI module, or to read - send the device address, then swap the pin to GPIO to read each data bit. We do not currently have collateral available to support this but I'll make note that this is something our customers look for.

  • Hi Dylan

    Thank for answer and support.

    BTW, I think many TI devices have 3-wire SPI-like interface. DAC38RF8x, for example,  support 3- (default) and 4-wire I/F.

    No idea why, but 3-wire often used in RF chips... Tradition? )

  • Too many ground pins taking up real estate. 8^)

  • I don't think you need to resort to software SPI. The cost is one register write at each line turnaround, and you'll have to do this with software SPI as well. The STM32 also requires the master to explicitly turn the line around (also one register write).

    I haven't used TI Mode [Ref TRM (SLAU846A) Sec 17.2.3.2], but I just noticed that it tri-states MOSI (PICO) whenever the SPI goes idle (i.e. Tx FIFO goes empty). This seems like that could be used to ease the (momentary) bus conflicts that one would expect at line turnarounds. It appears TI mode only supports mode=(0,0), which may or may not be an issue. Its /CS also looks a bit odd, but I expect you don't want to use the hardware /CS anyway.

    [Edit: I forgot we're only talking about 1 pin.]