Open mmar22 opened 8 months ago
Ofcourse i read this before write my ticket. "I think that function is not allowed to run in an ISR context." I think isnt real result. And my code dont use SPI in other place as this line then what semaphore? Call this func return OK allways and when crash then return nothing because crash inside spidriver.
One new info i upgrade to 2.0.11 (pio 6.4.0) and now crash is immediately and always. Need help with spi dma in timer isr
Nobody? I reqiure DMA offload perfectly timed SPI transfers. Seems on 1.x works, 2.0.9 work some minutes and on 2.0.11 crash . I know its arduino espidf builds, but problem is in rtos core and non existence SPI func for ISR. I require help with this.
Now only working solution is change to
ret=spi_device_polling_transmit(spiDISP, &transline);
but this is no DMA and no offload MCU
hi @mmar22
Because on spi_device_queue_trans
call to xQueueSend
instead of xQueueSendFromISR
. If you're call spi_device_queue_trans
from peripheral interrupt it's always crash.
You must update spi_master.c
to make it's work.
Replace
BaseType_t r = xQueueSend(handle->trans_queue, (void *)&trans_buf, ticks_to_wait);
By
BaseType_t task_woken = pdFALSE;
BaseType_t r = xQueueSendFromISR(handle->trans_queue, (void *)&trans_buf, &task_woken);
portYIELD_FROM_ISR(task_woken);
I know this, but i cant uderstand why in 21 century somebody writes library not prepared for ISR use? Yes your edit maybe helps , but 100% not if i require use other SPI outside ISR. I accept this for new lib , but IDF is how 5 year ???
Answers checklist.
IDF version.
framework-arduinoespressif32 @ 3.20009.0 (2.0.9)
Espressif SoC revision.
ESP32S3 v0.1
Operating System used.
Windows
How did you build your project?
VS Code IDE
If you are using Windows, please specify command line type.
None
Development Kit.
Custom
Power Supply used.
External 3.3V
What is the expected behavior?
In timer interrupt 👍 `void IRAM_ATTR irqCallbackStopFunc() { //on moment low pwm
gpio_set_level(DSP_EN,1);
esp_err_t ret; //start spi and complete set EN low myled.nextline+=1; if(myled.nextline>7) myled.nextline=0; transline.tx_buffer=LEDBufferlines[myled.nextline]; //finally send the line data transline.length=7*8; //Data length, in bits
}` this works ok but randomly on last line crash
What is the actual behavior?
random crash additional FYI SPI 13MHz PWM 800Hz
Steps to reproduce.
Debug Logs.
More Information.
i comment out this one last line and all works anytime ok.
ret=spi_device_queue_trans(spiDISP, &transline, portMAX_DELAY);
My project is big and i dont test update PIO framework to latest. I mean is irelevant.