355/113 wrote:Now I have the bitbang tutorial code running and out of curiosity, I removed the delays between the bit set and the bit clear commands to see how fast it could toggle a pin as well as how long the goto would take.
I'm seeing about 900ns for the bit set period and around 1.1us for the combination of the bit clear and the goto. Knowing absolutely nothing about the Broadcom Arm chip architecture, does this sound reasonable? I seem to recall seeing a forum topic that suggested 12.5ns might be the fastest pin toggle rate.
Is there anything I might do to speed things up?
Thanks!!!
BTW - having great fun with this! Thank you!
Hi 355/113, Glad you having fun, the code is not optimized at all, i know very little about electrics side and have no test equipment, but i am sure we can get much faster pin toggle with your help.
Too start with can you add the bellow code to see if that speed it up a bit.
Code: Select all
; Start L1 Cache
mov r0,0
mcr p15,0,r0,c7,c7,0 ; Invalidate Caches
mcr p15,0,r0,c8,c7,0 ; Invalidate TLB
mrc p15,0,r0,c1,c0,0 ; Read Control Register Configuration Data (ARM1176JZF-S r0p7 3-44)
orr r0,$1000 ; Instruction
orr r0,$0004 ; Data
orr r0,$0800 ; Branch Prediction
mcr p15,0,r0,c1,c0,0 ; Write Control Register Configuration Data
Add to the code like this
Code: Select all
include 'DexBasic\DexBasic.inc' ; set up everything and stores our macros etc
;
; Start L1 Cache
mov r0,0
mcr p15,0,r0,c7,c7,0 ; Invalidate Caches
mcr p15,0,r0,c8,c7,0 ; Invalidate TLB
mrc p15,0,r0,c1,c0,0 ; Read Control Register Configuration Data (ARM1176JZF-S r0p7 3-44)
orr r0,$1000 ; Instruction
orr r0,$0004 ; Data
orr r0,$0800 ; Branch Prediction
mcr p15,0,r0,c1,c0,0 ; Write Control Register Configuration Data
pinMode GPIO16, OUTPUT
align 4
LetsLoop:
digitalWrite GPIO16, HIGH
digitalWrite GPIO16, LOW
goto LetsLoop
align 4
ProgramSize:
ScreenBuffer:
Thanks.