cancel
Showing results for 
Search instead for 
Did you mean: 

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

KKIM.6
Senior II

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?

1 ACCEPTED SOLUTION

Accepted Solutions
MM..1
Chief III

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.

View solution in original post

9 REPLIES 9
MM..1
Chief III

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.

Don't the TIM do that?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

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.

Thanks for response.

I'll check the document!!

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 Venmo
Up vote any posts that you find helpful, it shows what's working..

Yes. I'm the only guy involving this project. I'm also making the physical 32x32 flexible image sensor also.

Speed is one of the big concerns. Right now. The problem with my system is the current sense amplifier that is connected to the ADC because its operating frequency is ~20 us (it means about 5 ms required for one sheet image -> I'm using four ADC channel and 4 amplifier components). I'm finding high-speed transimpedenace amplifiers (some product is possible in the texas instruments with ~5 ns but there is no vender.)

I can change some products based on these experiences and I will have a chance to change components. My final application is bioimplant cortex scanner. So, wireless is also essential. That's way I'm choosing this product.

S.Ma
Principal

Which STM32 is being considered?

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.

I'm trying this one now. Is there any example I can follow?