How about adding a few nops with the interrupts disabled? A context switch would take longer than this delay.
On Wed, Mar 24, 2021, 14:24 David Sidrane <david.sidr...@nscdg.com> wrote: > What HW is this on? > > -----Original Message----- > From: Grr [mailto:gebbe...@gmail.com] > Sent: Wednesday, March 24, 2021 10:09 AM > To: dev@nuttx.apache.org > Subject: Re: Sleep Resolution > > Thank you very much for your response > > What I'm trying to do is to generate hold and disable times for SPI CS, > which should be about 50 ns > > I started by an empty for loop but it seems optimization gets rid of it (I > haven't researched the issue properly). Then I thought a proper function > would be better but got stuck in that expression "sleep resolution" > > For that scale (10 SYSCLK cycles), a loop is probably OK but I wanted to > make sure there's not a more appropriate system tool > > El mié, 24 mar 2021 a las 10:46, Sara da Cunha Monteiro de Souza (< > saramonteirosouz...@gmail.com>) escribió: > > > Hi Grr, > > > > I have never needed to use this function neither this range (ns). > > But I used the usleep function which resolution is defined as > > CONFIG_USEC_PER_TICK. > > But maybe, in your case, for such range, you should consider using a > > hardware timer or a Timer Hook. > > Take a look at this wiki: > > https://cwiki.apache.org/confluence/display/NUTTX/Short+Time+Delays > > > > Sara > > > > Em qua., 24 de mar. de 2021 às 13:37, Grr <gebbe...@gmail.com> escreveu: > > > > > Hello to all. > > > > > > Looking for the right way to create a _very_ short delay (10-100 ns), I > > > found clock_nanosleep, whose description says: > > > > > > "The suspension time caused by this function may be longer than > > > requested > > > because the argument value is rounded up to an integer multiple of the > > > sleep resolution" > > > > > > What is the sleep resolution and where/how is defined? > > > > > > TIA > > > Grr > > > > > >