Stop other thread

Hi,

I've got a chip which needs precise timing to be read. A year ago, I was able to communicate with this chip but now, even if I go as fast I can it seems that timing have increased with same source code. So is there a way to force the CPU to do only one task at the time for the duration of the function. Ca

Hi,

I've got a chip which needs precise timing to be read. A year ago, I was able to communicate with this chip but now, even if I go as fast I can it seems that timing have increased with same source code. So is there a way to force the CPU to do only one task at the time for the duration of the function. Can we tell the scheduler to stop other thread?

Cheers,

Should I simply run a thread with highest priority so I'm sure it will be run before running other thread?

Hey,

I've got a chip which needs precise timing to be read. A year ago, I was able to communicate with this chip but now, even if I go as fast I can it seems that timing have increased with same source code. So is there a way to force the CPU to do only one task at the time for the duration of the function. Can we tell the scheduler to stop other thread?

two things might interrupt:

1. a thread with higher priority

This can be solved by increasing the priority of the thread talking to your code, possibly to the maximum. (beware: lower priority value means higher priority)

2. interrupts

If an interrupt messes with your timing, that can be prevented by disabling interrupts for a time-critical section:

    unsigned state = irq_disable()     /* timing critical code */     irq_restore(state);

Kaspar

Thanks it works with highest priority and irq disabled