[En-Nut-Discussion] Harware SPI usage

Harald Kipp harald.kipp at egnite.de
Mon Nov 12 11:24:36 CET 2007


Petri Hyötylä schrieb:
> Hello!
> I'm planning to use the MCU's hardware SPI in a project.
> Is there some precautions in using it to avoid collisions with  
> Ethernut's internal SPI traffic or is the hardware SPI complete out of  
> question?
>   
You are free to use any hardware resource, except timer 0. You can use 
native interrupts like with any non-Nut/OS application.

> My guess is that the time that I keep my /CS low has to be a nut  
> critical section.
>   

Definitely not. Nut/OS is a cooperative tasker. EnterCritical blocks 
preemptive context switching. Only interrupts are preemptive with 
Nut/OS, threads are not. As long as your thread is not blocked by I/O or 
timer, the thread context will not switch.

Harald




More information about the En-Nut-Discussion mailing list