9 years, 8 months ago.

F401RE - Timer0 low level control

Hi, is possible to use TIMER0 on nucleo F401RE with Mbed online IDE?

I've found this code online:

// LPC_SC->PCONP |= 1<<1; // Timer0 Power On
    LPC_TIM0->MR0 = 3600000;  // Match count for 150ms
    LPC_TIM0->MCR = 3;     // Interrupt and Reset on Match
    LPC_TIM0->TCR = 1;     // Enable Timer0
    NVIC_SetVector(TIMER0_IRQn,(uint32_t)&myIRQ);
    NVIC_EnableIRQ(TIMER0_IRQn);

but is only for LPC chip.

Is there something like this for F401RE?

Thanks

what do u need that timer for?

posted by Martin Kojtal 27 Feb 2015

I know that F401RE has different timer, I want to know if is possible to use them. Timer class use the same timer of Wait, Ticker, ecc. So is possible to setup an interrupt from different timer source?

posted by Gigi Marz 27 Feb 2015

1 Answer

9 years, 8 months ago.

Gian,
Do you still have an interest for low level function for F401 Timer?
If so, please check following my program.
This program does not directly use Timer0 but Timer2(32bit) and Timer3&4 (16+16bit).
/users/kenjiArai/code/Frq_cuntr_full/
/users/kenjiArai/code/Frequency_Counter_w_GPS_1PPS/
It uses IRQ for IC using direct access F401 Timer registers.
Current mbed uses TImer2 for ticker function and no longer cannot use Timer2 with after revision 442 mbed-src library.
In addition, I recommend to use mbed-src library instead of mbed library because they have Target HAL low level functions.
You can check STM's many samples for low level register manipulation.

Hi Kenji, thank you for the code. I have to read it and pay attention.

posted by Gigi Marz 05 Mar 2015