Using patc's: Time-Bases Generator for the STM32F4


I’m trying to understand how to use the Time-Bases Generator for the STM32F4 in my own project? (

At first i was hoping it was a RLP(lite) thing, but now i’m not so sure anymore. Can i use it for my FEZ Cerbuino Bee Board? When so, what are the step’s to get this working. I already read the PDF but i’m lost with it. On how to install it.


@ NielsNL2 - To use that code you will need to build a new firmware which includes the code from @ patc’s codeshare. Build the custom firmware and load that onto your board.

Note: @ patc project already includes a pre-built firmware, you should just be able to load that onto the board, but note that this is a 4.3 firmware so if you want to use Gadgeteer you will be out of luck since at the time of this post we are still on 4.2 Gadgeteer.

There are a few guys running a community firmware (@ jay I think), I have not taken a look at it yet but it might be worth getting in touch with them to see if they have included this yet so you can hopefully just grab the community firmware to get this.

But I honestly do not know how far they have progressed with this yet so you might have to do it yourself.

Thanks taylorza,

That is not the way i want to go atm. Do you or anyone else a solution that gives me the same results as this? I need something that can give a stable pulse every 50+ microsecond.

Sorry i’m not that good at coding this myself.

Thanks you in advanced

@ NielsNL2 - Do you just need a stable pulse on a pin every 50us?

I do not have anything like this for the Cerberus family boards, but I expect that using RLPLite we could configure one of the timers to generate a pulse every 50us.

If no one has anything ready for this I will gladly take a look at doing this for you.

@ taylorza, thanks again. What i need is something like what Patc made, only i need it just for 3 pins (X, Y, Z -AS). I need to be able the pulse time and the number of pulses per pin. And it would be nice when i got an interrupt when the number.

BTW the 50 Microsecond’s are just the minimum pulse delay

@ NielsNL2 - Getting an interrupt will be a problem, RLPLite does not support raising managed events, for that you will have to go to a custom firmware. You could do some hardware tricks here I guess.

@ taylorza, np. i can find an otherway to finding out when the countdown is finished.

@ NielsNL2 - So, I have not looked at what @ patc’s library is offering, so what is it that you will need.

The possibility to generate regular pulses on multiple pins each with a different frequency. Does that about sum it up?

The other key question is, can this be a blocking call or is it something that you need to have run in the background while running other .NETMF routines?