Speed Simple program

03 Dec 2009

Hi everyone, I'm making a project with ARM7TDMI mbed and I have some questions about how the compiler works. I could see that microcontroller its working at 60 MHz, but when I make a simple program doesn't work as I hope.

The program is simple as:

DigitalOut out1(p8)

int main (void)

{

out1.write(1);

out1.write(0);

}

I want to see a pulse wave of 30 MHz or something near, but instead the signal viewed has a frecuency of 1MHz. Why can this be happening?, Does anyone know?, Will the ticker some responsibility?

Thank you very much.

greetings

 

Timossi Gerardo from Argentine

03 Dec 2009 . Edited: 03 Dec 2009

The out1.write function is in the DigitalOut class, the operations within the function are taking 15 clock cycles to execute.

Its working exactly as it should, btw the program you listed will generate only 1 pulse, is this intentional?

If you need to generate a 30Mhz square wave use the pwm.

03 Dec 2009

 

Andrew Harpin wrote:

The out1.write function is in the DigitalOut class, the operations within the function are taking 15 clock cycles to execute.

Its working exactly as it should, btw the program you listed will generate only 1 pulse, is this intentional?

If you need to generate a 30Mhz square wave use the pwm.

Thank you a lot. I forget to put the while. I don't need to generate a 30 MHZ square wave, I was testing how fast a simple instruction could be, because I have to make some DSP processing. I hope not all the operands require so many instruction cycle, because otherwise I couldn't use this plataform.


Again, thank you very much

 

04 Dec 2009

You might try using the raw CMSIS GPIO commands to generate the instructions, but it still depends on the compiler output as to whether it's one instruction to toggle the pin.

-deleted-
14 Mar 2011

Hi Andrew/Anyone else who can elaborate.

You say it depends on the compiler.

How do we see whats going on an how many clock cycles instructions take and all the other bits to make code work faster.

I ask because the fastest I got out of a GPIO was 24MHz on the LPC1768 which said it was taking 2 clock cycles per write.

I would be very much interested in learning some more detail on this for a problem I am currently working on where I need to make the code work as fast as I can because I would like to use the LPC1768 to be manipulating bitmap data in external SRAM for use in a video project.