Hello Xiang Xiao, Can you connect me with Donny or can you help me to understand spi_slave semaphore "unlock" ?
Looking into spi_slave_driver.c:330 while (priv->rx_length == 0) { remaining_words = SPIS_CTRLR_QPOLL(priv->ctrlr); if (remaining_words == 0) { spiinfo("All words retrieved!\n"); } else { spiinfo("%zu words left in the buffer\n", remaining_words); } if (priv->rx_length == 0) { nxmutex_unlock(&priv->lock); if (filep->f_oflags & O_NONBLOCK) { return -EAGAIN; } ret = nxsem_wait(&priv->wait); if (ret < 0) { return ret; } ret = nxmutex_lock(&priv->lock); if (ret < 0) { spierr("Failed to get exclusive access: %d\n", ret); return ret; } } } we have: ret = nxsem_wait(&priv->wait); I think read operation will be locked until the function spi_slave_notify has been called, but I cannot find any call of SPIS_DEV_NOTIFY in nuttx repo. Did you have different implementation in your side ? Em ter., 15 de out. de 2024 às 12:28, Felipe Moura Oliveira < moura....@gmail.com> escreveu: > Hello All, > > I did a dummy question, in master branch, spi slave implementation already > blocked until new data is available. I wasn't working in the master branch > but I will switch to. > > Em ter., 15 de out. de 2024 às 11:45, Felipe Moura Oliveira < > moura....@gmail.com> escreveu: > >> Hello Xiang Xiao, >> >> thanks for sharing with me about rpmsg, to be honest it is new for me =/, >> I was locked in baremetal for several years. For now I cannot use it >> because my host mcu is running baremetal (maybe in the future we will >> change it). I developed a simple protocol using ack and nak whey to handle >> communication with master and slave. About "lock" my app until data is >> available, I am thinking use semaphore to wait to do it, so my solution >> will be able to sleep my mcu until spi releases it. >> >> Em ter., 15 de out. de 2024 às 11:24, Xiang Xiao < >> xiaoxiang781...@gmail.com> escreveu: >> >>> Yes, we use DMA for both SPI master/slave, but DMA is more related to the >>> driver not the framework. >>> >>> On Tue, Oct 15, 2024 at 2:08 PM Tomek CEDRO <to...@cedro.info> wrote: >>> >>> > One question by the way someone asked me recently - can NuttX SPI Slave >>> > work in DMA mode? :-) >>> > >>> > -- >>> > CeDeROM, SQ7MHZ, http://www.tomek.cedro.info >>> > >>> >> >> >> -- >> *Felipe Moura de Oliveira* >> *Universidade Federal de Minas Gerais* >> Linkedin <https://www.linkedin.com/in/felipe-oliveira-75a651a0> >> <https://twitter.com/FelipeMOliveir?lang=pt-br> >> > > > -- > *Felipe Moura de Oliveira* > *Universidade Federal de Minas Gerais* > Linkedin <https://www.linkedin.com/in/felipe-oliveira-75a651a0> > <https://twitter.com/FelipeMOliveir?lang=pt-br> > -- *Felipe Moura de Oliveira* *Universidade Federal de Minas Gerais* Linkedin <https://www.linkedin.com/in/felipe-oliveira-75a651a0> <https://twitter.com/FelipeMOliveir?lang=pt-br>