I don't think the AVR does what I want
May. 2nd, 2014 09:00 pmSo BBC Econet. Let's say it runs at 400Khz. (It varies from 200 to 800; let's say 400khz). There is a clock+/clock- signal and a data+/data- signal.
At 400Khz I have 2.5uS to determine if the balanced signals match, and if the data bit coming in hasn't collided with the clock. And that's not even including attempts to write data.
My AVR is clocked at 16Mhz. Here's a simple loop that toggles a pin (which just happens to connected to the LED)
Sticking a scope on this I get a 70Khz square wave. That is clearly not quick enough. Even with optimisation (replacing digitalWrite with inline assembler) I doubt I'll get to 100Khz. And that's not doing anything; just toggling.
I'm actually disappointed!
At 400Khz I have 2.5uS to determine if the balanced signals match, and if the data bit coming in hasn't collided with the clock. And that's not even including attempts to write data.
My AVR is clocked at 16Mhz. Here's a simple loop that toggles a pin (which just happens to connected to the LED)
void loop() {
boolean x=false;
int y;
while(1)
{
x=!x;
if (x) { y=HIGH; } else { y=LOW;}
digitalWrite(LED_BUILTIN,y);
}
}
Sticking a scope on this I get a 70Khz square wave. That is clearly not quick enough. Even with optimisation (replacing digitalWrite with inline assembler) I doubt I'll get to 100Khz. And that's not doing anything; just toggling.
I'm actually disappointed!