I've got a problem similar to https://www.esp32.com/viewtopic.php?t=5240.
I need to send and receive information to an IC over SPI. This task has to be made with specific timing, hence I've got a time routine made with Timer 0 and interrupts.
The problem is when I write spi_device_transmit(spi, &t) (or something related to SPI) into the timer ISR function, the CPU crashes.
How can I solve this?
It is important to mention that I'm not using FreeRTOS and I'm not intended to use it. In the cited post there is a solution using FreeRTOS, but how can I solve this problem without FreeRTOS?
Regards.
Alejandro.
Call SPI into timer ISR
-
- Posts: 9757
- Joined: Thu Nov 26, 2015 4:08 am
Re: Call SPI into timer ISR
...You *are* using FreeRTOS. You may not be calling into any FreeRTOS functions yourself, but everything around it (the timer API, the SPI API, WiFi etc) is using FreeRTOS, so you're still bound to its limitations and need to find solutions in the feature it offers.
Re: Call SPI into timer ISR
Thanks for the reply.
So what could be a possible solution, please. With example code would be great.
So what could be a possible solution, please. With example code would be great.
-
- Posts: 9757
- Joined: Thu Nov 26, 2015 4:08 am
Re: Call SPI into timer ISR
See the answer I gave in that topic: set a semaphore in your ISR, have a task running that waits for that semaphore to be set and runs the SPI transaction afterwards.
Re: Call SPI into timer ISR
spi_device_handle_t spi; and spi_transaction_t t; should be declared as global in order to be used from all of the task?
-
- Posts: 9757
- Joined: Thu Nov 26, 2015 4:08 am
Re: Call SPI into timer ISR
That very much depends on what you're trying to code.
Who is online
Users browsing this forum: Bing [Bot] and 220 guests