Quantcast
Channel: Forum - Recent Threads
Viewing all articles
Browse latest Browse all 1583

Code execution too slow

$
0
0

Hello,

 

We have found out that processing is too slow on our Renesas RZ A1M target, but we can't figure out what is wrong. For benchmarking purposes the following code is written:

 

#define CPU_FREQUENCY_KHZ 390000
#define NUMBER_OF_INSTRUCTIONS 14

static void Wait1ms(void)
{
  uint32_t count = CPU_FREQUENCY_KHZ/NUMBER_OF_INSTRUCTIONS;
  while ( count > 0 )
  {
    asm( "NOP");
    count--;
  }
}

void main(void)
{
  while ( true )
  {
    TestPinHigh();

    Wait1ms();

    TestPinLow();
  }
}

 

 

The while-loop inside Wait1ms contains around 14 instructions (number of instructions cannot exactly be determined). The counter is set to a value so that the expected duration is around 1ms. The measured duration is, however, more than 7ms. Does anyone have an idea about what our problem is?


Viewing all articles
Browse latest Browse all 1583

Latest Images

Trending Articles



Latest Images