Go Down

Topic: Bit Banging speeds with Arduino Due (Read 129 times) previous topic - next topic

jacksonlui

hi

Is the DUE capable bit banging 30 square pulses at 50% duty cycle at 20MHz exactly out of two of it's i/o ports from 0 to 1.8v?

I'd prefer to use an UNO but the clock speeds on that uC is a lot slower.


thanks
Jack

dlloyd

#1
Nov 04, 2014, 09:59 pm Last Edit: Nov 04, 2014, 10:01 pm by dlloyd
Quote
Is the DUE capable bit banging 30 square pulses at 50% duty cycle at 20MHz exactly out of two of it's i/o ports from 0 to 1.8v?
With low level programming, 21MHz @ 50% duty cycle, 20MHz @ 50% ± 11.9ns jitter.

jacksonlui

thanks! that's great!

while the two pins are banging at 20MHz, is there a way to create an offset between the two pins?
pin1 will clock at 20MHz while pin2's rising edge will start a between the rising and falling edge of pin1 (while it's high).
I don't think this is possible but I thought I'd ask.
thanks

dlloyd

#3
Nov 04, 2014, 10:22 pm Last Edit: Nov 04, 2014, 10:23 pm by dlloyd
Quote
while the two pins are banging at 20MHz, is there a way to create an offset between the two pins?
Note that you could only approximate 20MHz over time since one clock cycle of the MPU is about 11.9ns. Since 20MHz is 50 ns pulses, each pulse would have ±24% jitter. Any offset would have a minimum resolution of 11.9ns. I would recommend reviewing the SAM3X datasheet as it's quite detailed and something like this may even require some assembly level programming.

It would be much easier to achieve 21MHz exactly, as this is the MCLK/4. If stable 20MHz is a requirement, you may need to research how to use a different main clock with frequency 80MHz.

Go Up