56371 - slow GPIO - SoundBite Board

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

56371 - slow GPIO - SoundBite Board

914 Views
AndyCapon
Contributor II

Hi Guys,

 

I am flipping PF7 from high to low to see what speed I can get with the following code:

 

 

 
 while(1) { __asm("bset #7,y:(%0)" : : "A" (M_PDRF));0x000001fe <FACTest+31>: 68f000 00000c move y:>$c,r00x00000200 <FACTest+33>: 0a6067        bset #$7,y:(r0) __asm("bclr #7,y:(%0)" : : "A" (M_PDRF)); 0x00000201 <FACTest+34>: 0a6047        bclr #$7,y:(r0)0x00000202 <FACTest+35>: 0af080 0001fe jmp >$1fe  }

 

 


When measured with a scope I am only seeing around 1.167 Mhz from high to high.

 

This seems rather slow!

 

Or is it normal?

 

Thanks

 

Andy

 

0 Kudos
2 Replies

397 Views
TomE
Specialist II

Shouldn't this be in the "Other" or DSP forums?

 

Read the Data Sheet for the DSP, specifically the "GPIO Timing" section. The timing is relative to FOSC and XTAL which are slower clocks than your CPU. Port F timing is different to all the other ports too.

 

Check your CPU execution speed. Spin in a loop for 100 cycles, THEN write to the GPIO pin. Make sure the CPU is running at the speed you expect.

 

Write values directly to the GPIO register rather than BSET/BCLR. They probably have to read-modify-write to the port which is slower.

 

The GPIO port is on the other side of a bus switch. Check how it is set up.

 

The GPIO port is probably running from a slower internal clock. See if the Ref Manual tells you which one.

 

I've used an 800MHz ARM core that could only write to its GPIO ports at about 1MHz too, as the port was on the other side of one or two bus gateways and running on a very slow clock. That meant that a simple read of a GPIO port would stall the CPU for 300 instructions, ditto back-to-back writes to a GPIO port. The manual for that chip strongly recommended using timers and DMA-based peripherals for I/O rather than reading and writing the GPIO ports from the CPU.

 

0 Kudos

397 Views
AndyCapon
Contributor II

Hi Tom,

 

Thanks very much for the very useful info, I will look into these things.

 

Yep i have put the post in the wrong place, I saw 68k but my mind said 56K.

 

I will see if I can move it.

 

Thanks for the help

 

Andy

 

 

 

0 Kudos