Markus_L811:
So the problem must be somewhere behind the micros the function delayMicroseconds is realy open so the problem musst be somewhere there
Right, micros() must have a problem with noInterrupts().
I tried to change delayMicroseconds() to make it independent from micros(). Here is the code:
#define CYCLES_PER_USEC 84 // Arduino Due has 84 MHz clock
#define CYCLES_PER_LOOP 6 // one iteration of the loop takes 6 cycles
#define OVERHEAD_CONST 18 // could someone with an osci please verify this constant?
void delayMicroseconds( uint32_t us )
{
if(us==1) return;
int j;
//one iteration of this loop takes 6 cycles on Arduino Due compiled with IDE 1.5.2
for(j=0;j<us*(CYCLES_PER_USEC/CYCLES_PER_LOOP)-OVERHEAD_CONST;j++)
{
asm volatile("mov r0, r0"); // just NOP
asm volatile("mov r0, r0");
}
}
This change worked with the original version of OneWire (OneWire_preview22_17jan13.zip)
This patch is not pretty but it proves that the problem is in the micros().
Tomorrow I'll try to understand, why micros() has a problem with noIterrupts().