Greetings,

this is my first post here, so I'll start with some background information. My name is Jan and I've been working with the STM32 F407 for a few month now. This forum really helped me a lot and so far I was able to solve any problems I had with your help, for which I'd like to thank you all! :)

I'm currently trying to add a bitbanging function for a rgb LED. I already wrote a 1wire connection, which was no problem, so I thought this is an easy thing, but I'm struggling with the required speed.

All I needed is a different timer config, because the given period length is 1.25us in which I need a high and low signal. Since the GPIOs need about 100ns to reach the steady state, I was aiming for a timer tick frequency of 10MHz, however I can't get above 2,5MHz.

For the prescaler calculation I use the formula

prescaler = (timer default frequency (168MHz) / (period * frequency)) - 1

The formula works for every lower frequency, so probably it's a hardware limitation I'm not aware of.

I would provide the code, but it's really just a simple timer, so it probably wouldn't help.

I'm aware that there are other solutions like PWM or inline assembler, but I still wonder why it doesn't work.

Thanks in advance, I appreciate every help that I can get!

Edit: To clarify, my prescaler for 2,5MHz is 33, which is correct, but if I go down to 0 the frequency doesn't get higher than 2,8MHz, so the 2,5MHz is the last value were my formula works.

I'm measuring the frequency with an GPIO Pin, which is toggled each time the timer update interrupt occurs, could that be a problem?

this is my first post here, so I'll start with some background information. My name is Jan and I've been working with the STM32 F407 for a few month now. This forum really helped me a lot and so far I was able to solve any problems I had with your help, for which I'd like to thank you all! :)

I'm currently trying to add a bitbanging function for a rgb LED. I already wrote a 1wire connection, which was no problem, so I thought this is an easy thing, but I'm struggling with the required speed.

All I needed is a different timer config, because the given period length is 1.25us in which I need a high and low signal. Since the GPIOs need about 100ns to reach the steady state, I was aiming for a timer tick frequency of 10MHz, however I can't get above 2,5MHz.

For the prescaler calculation I use the formula

prescaler = (timer default frequency (168MHz) / (period * frequency)) - 1

The formula works for every lower frequency, so probably it's a hardware limitation I'm not aware of.

I would provide the code, but it's really just a simple timer, so it probably wouldn't help.

I'm aware that there are other solutions like PWM or inline assembler, but I still wonder why it doesn't work.

Thanks in advance, I appreciate every help that I can get!

Edit: To clarify, my prescaler for 2,5MHz is 33, which is correct, but if I go down to 0 the frequency doesn't get higher than 2,8MHz, so the 2,5MHz is the last value were my formula works.

I'm measuring the frequency with an GPIO Pin, which is toggled each time the timer update interrupt occurs, could that be a problem?

Frequency = TIMCLK / (P * Q);

Where Prescaler = P - 1; and Period = Q - 1; and P is 16-bit and usually the smallest value.

If TIMCLK = 150 MHz, P = 1, and Q = 15, you have a timer with a 10 MHz update (rollover) frequency.

800 KHz is divisible into 168 MHz, as is 2.4 MHz