Skip to main content
KKIM.6
Senior
November 1, 2022
Solved

Is it possible to generate a continuous square wave signal in the GPIO pin without extra order from CPU?

  • November 1, 2022
  • 3 replies
  • 2336 views

I realized that I would need continuously switching the GPIO pin for external MUX.

So, I want to know how to program continuously switching a GPIO pin (with a specific frequency and start timing for synchronizing with other GPIO pins)

However, If I on/off the GPIO pin with a delay, the timing doesn't match well.

So, is there any way to generate a frequency in a GPIO pin without any extra order such as DMA (it means that the GPIO pin just generates some signal without extra on/off control from the processor).

Is it possible? then what code should I use?

This topic has been closed for replies.
Best answer by MM..1

For this purposes is designed timers channels. Read en.STM32L4_WDG_TIMERS_GPTIM.pdf or any other. On your MCU you need use pin with alternate function TIMx CHy. And config ARR period and CCy duty.

3 replies

MM..1
MM..1Best answer
Chief III
November 1, 2022

For this purposes is designed timers channels. Read en.STM32L4_WDG_TIMERS_GPTIM.pdf or any other. On your MCU you need use pin with alternate function TIMx CHy. And config ARR period and CCy duty.

KKIM.6
KKIM.6Author
Senior
November 1, 2022

Thanks for response.

I'll check the document!!

Tesla DeLorean
Guru
November 1, 2022

Don't the TIM do that?

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
KKIM.6
KKIM.6Author
Senior
November 1, 2022

I have to control 35 GPIO pin for the 32x32 photodiode array for the image sensor array. I'll check TIM again but I'm not sure whether I can use TIM for 35 GPIO pin.

Tesla DeLorean
Guru
November 1, 2022

Strikes me you're using the wrong hardware for the task, perhaps you and your team can re-evalutate your approach?

You can use DMA+TIM+GPIO to drive a memory based pattern buffer against a bank of GPIO pins. Perhaps different DMA off alternate channels of one TIM to keep the phase relationships relatively tight.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
S.Ma
Principal
November 1, 2022

Which STM32 is being considered?

KKIM.6
KKIM.6Author
Senior
November 1, 2022

I'm using STM32WB55VGY6TR.

I've already made my custom board and I successfully programmed the microcontroller for wireless data transfer.

The only problem now is measuring part of the sensor such as ADC, amplifier, and MUX for multiple channels.