AnsweredAssumed Answered

Querry regardung clock cycle in stm32f407

Question asked by das.sanjib on Apr 23, 2014
Latest reply on Apr 25, 2014 by das.sanjib
Hi

I am doing a simple thing in C basically witing it to the PORT I register

short int a[1]  = {1,0};
short int *p = &a;

while(1)
  {
         GPIOI->ODR |= *p;
  }
Basically fetching data from memory and writing it to the PORT I . I have to write a very long array but for easier understanding, I have used  small array.  I thought it should take a less clock cycle like 4 max 5 but it is taking so much how can i reduce the clock cycles ...for just writing also it is taking so much clock cycles . what should i do to lessen it

The disassembly for his instruction is
 
 74                   GPIOI->ODR |= *p;
0800042c:   mov.w r3, #8192 ; 0x2000
08000430:   movt r3, #16386 ; 0x4002
08000434:   mov.w r2, #8192 ; 0x2000
08000438:   movt r2, #16386 ; 0x4002
0800043c:   ldr r1, [r2, #20]
0800043e:   movw r2, #56    ; 0x38
08000442:   movt r2, #8192  ; 0x2000
08000446:   ldr r2, [r2, #0]
08000448:   ldrh r2, [r2, #0]
0800044a:   sxth r2, r2
0800044c:   orrs r2, r1
0800044e:   str r2, [r3, #20]
 82         }

Outcomes