cancel
Showing results for 
Search instead for 
Did you mean: 

GPIO Speed

anil23
Associate II
Posted on September 22, 2006 at 08:53

GPIO Speed

3 REPLIES 3
anil23
Associate II
Posted on May 17, 2011 at 09:30

Hi:

I wrote a simple example to test the maximum speed of the GPIO. All I did was toggle the GPIO pin between 0 and 1. The maximum speed at which the pin was toggling was 400Hz when the MCLK is 32 KHz (RTC oscillator). The code for this example is:

SCU_MCLKSourceConfig(SCU_MCLK_RTC);

for(i = 0; i< 100; i++);

SCU_PLLCmd(DISABLE);

SCU_RCLKDivisorConfig(SCU_RCLK_Div1);

SCU_HCLKDivisorConfig(SCU_HCLK_Div1);

SCU_PCLKDivisorConfig(SCU_PCLK_Div1);

SCU_APBPeriphClockConfig(__GPIO4,ENABLE);

SCU_APBPeriphReset(__GPIO4,DISABLE);

while(1){

*(u8 *)0x5800A010 = 0x00;

*(u8 *)0x5800A010 = 0x04;

}

It’s quite slow to my expectations. Any pointers on this problem would be appreciated.

Regards,

kais
Associate II
Posted on May 17, 2011 at 09:30

Hi Iamanil,

the two code lines inside the while loop takes many cycles, so that the GPIO speed will be quite slow. However if you select the maximum optimization of the IAR tool

your disassembly code will be as follow:

STR R4, [R0, #+0]

STR R6, [R0, #+0]

B 0x000CA4

In this case of optimization, frequency can reach 1.168 KHz.

We can even reach 2.717KHZ if we use the Buffered mode: that means code will be:

while(1)

{

*(u32 *)0x4800A010 = 0x04;

*(u32 *)0x4800A010 = 0x00;

}

Regards.

ktchong22
Associate II
Posted on May 17, 2011 at 09:30

Hi eris,

I am first time using ARM9.

Do you do the same test when running the MCU under the PLL mode (96MHz), and what is your results?

Does it able to perform 96MIPS?

Regards