Page 1 of 1

Call spi_device_transmit inside ISR

Posted: Wed Nov 15, 2017 11:40 am
by Deejay
Hi there,

I'm currently building a LED Matrix which is multiplexed. I want to achieve this by calling an ISR every x ms and send the data inside the ISR via SPI. When I do this it doesn't work, because it fails getting a result from spi_device_get_trans_result

Can I even use spi_device_transmit inside an ISR? If not how can I achieve a "timed" update call instead?

Thanks in advance.

Re: Call spi_device_transmit inside ISR

Posted: Thu Nov 16, 2017 4:17 pm
by ESP_Sprite
There are quite few functions you can call safely from an ISR... but the FreeRTOS functions that end in FromISR are always safe. Suggest you use this to start off the transfer: have a thread that waits on a semaphore or task notification and then starts the next transfer, and in the ISR use xSemaphoreGiveFromISR or vTaskNotifyGiveFromISR to kick off the next transfer.

Also: you may be interested in this: viewtopic.php?f=17&t=3188

Re: Call spi_device_transmit inside ISR

Posted: Sun Nov 19, 2017 11:33 am
by Deejay
Thanks for your answer, that really helps me. I will look into the freertos functions.