cancel
Showing results for 
Search instead for 
Did you mean: 

How to send additional bit?

John Doe1
Associate III
Posted on February 06, 2017 at 18:09

Hello,

I'm trying to implement a software that will allow me to send additional one pulse (on the data wire and clock wire). After one pulse I should send data (32 bits) over spi.

Frame should look like:

1 bit + 32 bit

clock pulse every bit

I tried to send 0x80 over SPI and USART but no luck - for 0x80 i have 8 clock pulses. How to implement one clock pulse? PWM? Timers? Dma? 

I would be grateful for every idea !

John

#solution-needed #idea-needed
12 REPLIES 12
howard n2wx
Senior
Posted on February 06, 2017 at 18:18

Momentarily flip the data and clock lines into GPIO mode and as outputs, start a timer for one bit time, flip them back when the timer runs? 

John Doe1
Associate III
Posted on February 06, 2017 at 18:33

I would like to mention that SPI is not required. It's about synchronized data send (one bit per one clock pulse)

Posted on February 06, 2017 at 18:28

Thanks, that's a good idea but using that solution i'll propably lose on performance for a larger sets of data.

John Doe1
Associate III
Posted on February 06, 2017 at 19:41

Is there no solution to generate synchronized PWM with clock pin?

Posted on February 06, 2017 at 18:55

Does your part's USART support 9 bit mode?

Posted on February 06, 2017 at 18:56

Yes, it does. Currently working on stm32f10x.

Posted on February 06, 2017 at 19:24

It wouldn't be a performance win either but perhaps send the first byte of the 32 bit transmission in 9 bit mode with the leading bit set the way you want it?  Or externally gate clock and data with a timer output?

Posted on February 06, 2017 at 22:30

No, the peripherals are of pretty simple and limited functionality. Want to do odd things, use an FPGA/CPLD

Want to send 8x 33-bit values, have the SPI DMA 33x 8-bit values where your 32-bit data is slewed across the buffer.

Use TIM1/8 in One-Pulse, 33x Repetition (or x66 for transitions), and DMA to GPIOx->BSRR, from a pattern buffer.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on February 08, 2017 at 20:18

8x33-bit? You mean 33 bytes?