AnsweredAssumed Answered

Time diference betwen using ST libraries and uControler registers directly

Question asked by Ferreira on Mar 13, 2014
Latest reply on Mar 13, 2014 by waclawek.jan
Hi

I'm using STLibraries for programing a STM32F100 in crossStudio. I have my System Clock with 24MHz.
When I set and reset a port pin, using LT Libraries

while(1){
  GPIO_SetBits(DISP_DIGIT1_PORT, DISP_DIGIT1_PIN);
  GPIO_ResetBits(DISP_DIGIT1_PORT,DISP_DIGIT1_PIN);
}
 since the moment of set to the moment of reset the uController spend, more or less, 2.26us (442KHz). On the other hand, if I do the same using the uController register
 
while(1){
  DISP_DIGIT1_PORT->BSRR = DISP_DIGIT1_PIN;
  DISP_DIGIT1_PORT->BRR = DISP_DIGIT1_PIN;  
 }
the this time is only 164ns (6.1MHz).

So, my questions are : This diferences on time is normal? There are any solucion for using LTLibraries and reduce this time?

Best Regards
A Paiva   

Outcomes