2

We're working with these very odd driver chips which are sort of like shift registers except rather than latch the data at the end, the latch needs to happen over the last 'n' clock cycles in parallel with the data being shifted out. Depending on the value of 'n', the data is 'latched' into different registers. Like I said, it's an odd protocol.

Here's an example sending six bytes of data (top row) synced to the latch (bottom row). The latch is HIGH for the last two bits of the data as it's being shifted out.

Time-->
11001100 01010101 10011010 11001011 01001010 10010101
00000000 00000000 00000000 00000000 00000000 00000011

In this example, the latch is synced to the fifth and sixth bit of that last frame (as opposed to the 7th and 8th in the first example) which tells the chip to load this data into a different register.

Time-->
11001100 01010101 10011010 11001011 01001010 10010101
00000000 00000000 00000000 00000000 00000000 00001100

Like I said, it's an odd design, but it basically lets you shoot out data non-stop without having to pause to latch.

Because of having to 'sync' the latch with certain clock cycles in the data, we can't use the standard SPI bus and have to use normal GPIO pins, which of course are substantially slower.

BUT... if I could set up the data for a second SPI bus, then use a buffer to define where the latch is high/low accordingly, that would work.

The issue is I don't know how to, or if it's even possible to sync SPI busses together.

Only thing I can think of is to use one SPI bus as the master and another SPI bus (on the same processor) as a slave, then try to leverage the bi-directional nature of it. But this is just a guess.

I was considering looking into DMA too, but I'm starting with SPI since I know my chip has four SPI busses on it. (Update: I'm starting to think DMA is the way to go here since I now know it is possible to sync two DMA controllers to the same clock.)

4
  • 2
    very odd driver chips ... if they do not have a part number and they have no datasheet, then don't use them
    – jsotola
    Oct 19, 2019 at 4:16
  • There from ST and they do have a data sheet, but that's separate from my question as I'm not asking about them. I'm specifically asking if I can somehow sync two separate pins to the same SPI clock. If not, I'll have to give the synced-DMA route a try as I know that can be done. Oct 19, 2019 at 5:56
  • 2
    i am sorry, it is difficult to visualize what you are asking ... can you draw a block diagram that describes what you are asking?
    – jsotola
    Oct 19, 2019 at 6:04
  • I have two buffers of data that I want to send out on two parallel pins on the same clock cycle. Think standard SPI but with two MOSI pins. I've actually found out this is possible with DMA so I think that's the way I'm going to go, but if you can figure out how to do this via SPI, that would be cool too. Oct 21, 2019 at 8:21

1 Answer 1

1

As the Wikipedia page on SPI shows (as introductory material), the SPI main device generates the clock. The SPI sub device waits for the leading edge on its CS (chip select) to start transmitting its data on the following clock edges.

So you can set up one of the senders as main device, and the other sender as sub device. Use MOSI of main as the first data output, and MISO of sub as the second data output, like this:

schematic

simulate this circuit – Schematic created using CircuitLab

You can add more SPI sub devices, if you need more synchronized outputs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.