cancel
Showing results for 
Search instead for 
Did you mean: 

Generate a very small pulse (STM32L451)

CGren.1
Associate II

Hello,

I need to find a solution to generate a pulse through a GPIO...

To generate a bit 0, I need to send a level HIGH of 300 ns following by a level LOW of 900 ns minimum.

To generate a bit 1, I need to send a level HIGH of 900 ns following by a level LOW of 300 ns minimum.

So, to generate one byte, I need to generate 8 pulses as described before.

I thought to use a output compare, but I generated only a waveform.

Also, to use a timer interrupt, it's too slow to generate x ns pulses.

I would like to use a timer instead of implementing a function: disable global interrupts to send all bits and then re-enable global interrupts.

The system clock runs at 16 MHz.

What do you think?

Thanks

1 REPLY 1
KnarfB
Principal III

Sounds similar to ws2812 neopixels. This has been done in several ways, including DMA driven timer PWM: PWM pulse widths are stored in an array and the next pulse width will be fetched by DMA into timer channel CCR register, triggered by an OC event. No need for bit-banging or interrupt handlers. Not sure if 16 MHz SysClock is sufficient.

hth

KnarfB