Thanks it works with highest priority and irq disabled 2016-07-13 13:56 GMT+02:00 Kaspar Schleiser <kas...@schleiser.de>: > Hey, > > On 07/13/2016 01:32 PM, Baptiste Clenet wrote: >> 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 > > > _______________________________________________ > devel mailing list > devel@riot-os.org > https://lists.riot-os.org/mailman/listinfo/devel
-- Baptiste _______________________________________________ devel mailing list devel@riot-os.org https://lists.riot-os.org/mailman/listinfo/devel