Hello,
When I toggle a GPIO on my MSP430 processor I have (or at least I think I have :) a clean understanding of what happens. I can relate the frequency of the toggling to the instructions used and the clock speed of the CPU. Nothing strange happens.
The MSP430 runs the instructions below:
/* Put 0xAA in the r15 register. */ mov.b #-86, r15
/* Write the contents of r15 on port 4, that acts as an 8-pin output port. */ mov.b r15, &0x001d /* XOR the r15 register. */ xor.b #-1, r15 /* Jump to the 'write the contents...' instruction. */ jmp $-6
The last three instructions take care of the toggling and cost 8 cycles total. A full period takes two runs of 8 cycles each, hence 16 cycles. With a scope I nicely see a frequency of 1/2 MHz, exactly what I expect with my 8 MHz clock speed.
But when I try to do the same thing on my Au1100 Alchemy processor, it's a completely different world. The Au1100, a ferocious beast compared to the MSP430, is not able to toggle the GPIO that much faster. With my 400 MHz clock speed I can only toggle the GPIO at 6 MHz with the instructions below:
/* I will toggle GPIO3. */ li t9, 0x00000008 loop: /* First we output a high level on GPIO3. */ li t7, 0xB1900108 sw t9, 0(t7) /* Next we output a low level on GPIO3. */ li t7, 0xB190010C sw t9, 0(t7) /* continue up untill the end of time. */ b loop nop
Of course I am comparing two completely different architectures and that's probably where I screw up. But how exactly does the Au1100 work? I can't seem to find any information about it in the data book or anywhere else, but suspect that the Au1100 has some internal mechanism that samples the registers to set and reset the GPIO at a certain frequency. And that this frequency is the maximum toggle frequency I get.
Does anybode got more insight in this and is willing to share? Thanks in advance!
1 groet, Freddy Spierenburg