Hello everyone.
I am running atmega328p with uSD card on custom PCB.
Using write() method I'm trying to write array that contains 192 byte elements.
According to millis() its usually takes around 2ms, sometimes up to 7ms and occasionally like 18ms or even 200ms.
Why is it so irregular and so unreliable?
uSD card was formatted with SDFormatter v4.
Here is endless loop that execute mentioned operation:
while(1)
{
PCICR &= ~(0b00000110); //blocking PC interrupts that i use
time=millis();
myFile.write(a,192); //a is declared like this: byte a[192]={'/1'};
if(millis()-time>6) Serial.println(millis()-time); //if time extended 6ms its being printed to serial
myFile.flush();
PCICR |= 0b00000110; //enabling interrupts
}
Thanks in advance.