Re: [I] [HELP] SPI TX DMA complete callback [nuttx]
dakejahl closed issue #16373: [HELP] SPI TX DMA complete callback URL: https://github.com/apache/nuttx/issues/16373 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [I] [HELP] SPI TX DMA complete callback [nuttx]
dakejahl commented on issue #16373: URL: https://github.com/apache/nuttx/issues/16373#issuecomment-2893017296 Thanks for the reply! Okay yeah that makes sense. Using signals makes sense, there's a sem already in use for the STM32H7 SPI RX complete. Unfortunately I'm dealing with a pre-compiled library + API that imposes tight timing requirements, a supplied callback must be invoked <60us after the last SPI TX frame (before the DRDY fires and calls another callback, and the order of callbacks matters). I temporarily solved the issue by increasing the thread priority of my driver such that it's not pre-empted between SPI_EXCHANGE and callback() and instead benefits from pre-emption once the SPI_EXCHANGE is complete. It's not ideal since the driver shouldn't actually be high priority. I'll have to think about this harder. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [I] [HELP] SPI TX DMA complete callback [nuttx]
acassis commented on issue #16373: URL: https://github.com/apache/nuttx/issues/16373#issuecomment-2888407051 Hi @dakejahl it is not directly possible to install a callback from user space for SPI DMA completion due the userspace/kernel space separation (in FLAT mode it could work, but it will neither work in PROTECT mode or KERNEL mode). Maybe you can modify your spi driver to create a notification event when DMA TX is complete in your chip and use some mechanism such as signal, poll, message queue, etc to notify your application. Other option is create a character driver that subscribe to DMA TX complete IRQ and do this notification, this way we avoid modifying the existing driver, but there are some complications since the IRQ is already handled in the spi driver. If you want to use signal, you can see the driver nuttx/drivers/sensors/zerocross.c when I used it and the apps/examples/zerocross application example. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
