cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple (more than 3) synchronised data outputs?

John Wickham
Associate
Posted on May 20, 2018 at 19:36

Hi, I'm fairly new both to ARM and to C programming, but I'm attempting to write a library to allow me to interface an STM32F103 with a hub-75 RGB LED panel. I know it's possible as I've seen similar projects, but I want to come up with my own code and learn by throwing myself in at the deep end. 

Predictably, I've gotten stuck fairly early on in the proceedings!

As well as several other control lines, I need to be able to shift different bytes of data out to 6 pins simultaneously. Can anyone describe roughly how I could make this happen? I know I can send an individual byte to a port and have it output across 8 pins, but I need to be able to have 6 separate bytes and output each of them of a different pin simultaneously with a shared clock. Any ideas?

Thanks,

John

#hub75
1 ACCEPTED SOLUTION

Accepted Solutions
Posted on May 21, 2018 at 01:02

Yes, you have to pre-prepare the data table, ( maybe only 1 byte at a time) as suggested by JW

as Clive has suggested, then transfer upto 16 simultaneous data streams by DMA.

so you need clock and data.

you can use one clock signal to serve all 16 channels

but you may need to buffer it, if you have long cables,

you can use a transistor( amplifier) to do that with three parts.

for i = 1 ; i <  9

Table[i-1] = stream[0] & (1^i) + stream[1] & (1^i) <<1 + stream[2] & (1^i) <<2 + stream[3] & (1^i) <<3+ stream[4] &( (1^i) <<4 + stream[5] & (1^i) <<5;

if you have a known stream length ;

streamLength = 20;

for j =0; j < streamLength

   for i = 1 ; i <  9

      Table[i-1 + j * 8] = stream[0][j] & (1^i) + stream[1][j] & (1^i) <<1 + stream[2][j] & (1^i) <<2 + stream[3][j] & (1^i) <<3+ stream[4][j] &( (1^i) <<4 + stream[5][j] & (1^i) <<5;

View solution in original post

4 REPLIES 4
Posted on May 20, 2018 at 23:26

Assemble the first byte to be output from the 0th bits of the input bytes. Output to port. Toggle clock.

Assemble the second byte to be output from the 1st bits of the input bytes. Output to port. Toggle clock.

etc.

JW

Posted on May 20, 2018 at 23:29

You can use DMA+TIM+GPIO to transfer a pattern buffer to a bank of GPIO up to 16 pins at once. You can write to GPIO->ODR or GPIO->BSRR for a subset of pins.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on May 21, 2018 at 01:02

Yes, you have to pre-prepare the data table, ( maybe only 1 byte at a time) as suggested by JW

as Clive has suggested, then transfer upto 16 simultaneous data streams by DMA.

so you need clock and data.

you can use one clock signal to serve all 16 channels

but you may need to buffer it, if you have long cables,

you can use a transistor( amplifier) to do that with three parts.

for i = 1 ; i <  9

Table[i-1] = stream[0] & (1^i) + stream[1] & (1^i) <<1 + stream[2] & (1^i) <<2 + stream[3] & (1^i) <<3+ stream[4] &( (1^i) <<4 + stream[5] & (1^i) <<5;

if you have a known stream length ;

streamLength = 20;

for j =0; j < streamLength

   for i = 1 ; i <  9

      Table[i-1 + j * 8] = stream[0][j] & (1^i) + stream[1][j] & (1^i) <<1 + stream[2][j] & (1^i) <<2 + stream[3][j] & (1^i) <<3+ stream[4][j] &( (1^i) <<4 + stream[5][j] & (1^i) <<5;

Posted on May 21, 2018 at 19:50

Amazing, this is exactly what I needed. I don't fully understand the code but I get the idea, I can go away and get my head around that now!

Thank you all!

John