ARMmbed

Mix MBED libraries with HAL or low level register access

Initially I need to make one function run periodically with high precision without interuption.
I use the template for DISCO-F746NG named “Basic demo showing how to use touch screen”.
My user code is the following:

DigitalOut TESTO(PF_8);
Ticker TickReg;

void Regulate(void) {
    TESTO = 1;
    for(int i=0; i<1000; i++);
    TESTO = 0;
}

void main(void)
{
  TickReg.attach_us(&Regulate, 105);
....

Signal on PF_8 is looks like this:


(the upper signal in red)

As you can see this routine is interupted from time to time.

I think that the solution can be one of the folowing:

  1. Make the timer responsible for this Ticker higher priority. But as I know MBED library don’t have this functionality from the box. By the way: I can not figure out which hardware timer taking this particular Ticker.
  2. Configure any available timer (which I can pick basing on the STM32CubeMX configuration for this board) to run my ISR with needed period and with a high priority. I know that this code will not be portable anymore and I will need to go deep into the CPU datasheet…

Question:

  1. What I can really do in this case?
  2. Does MBED provide any solution?
  3. Is there any posibility to find out which TIM associated with the given Ticker?
  4. Any thought on the subject?