I am using the ESP32 to read/write data from/to an SD card in the SPI mode. Occasionally, the file write operation freezes leading to the task getting stuck at that stage. Log file gathered in verbose mode is shown below:
Note: The SPI lines are being used exclusively for the SD card. There is no other device on the SPI line
As shown above, the last write operation never completes and the task is waiting for the function to return. Any suggestions on the cause of this and how to resolve this or to enable a timeout to the file write operation?SDSPI hangs occasionallly
Re: SDSPI hangs occasionallly
Hi tsc1987, which IDF version are you using (git describe --tags)? Recently an issue has been reported with IDF 3.1 where SPI transaction might not complete in some situation. Given that SDSPI relies on the SPI driver, it might be related to what you are seeing.
We can supply you with a patch to the SPI driver which adds some debug output, it may help figure out the issue.
We can supply you with a patch to the SPI driver which adds some debug output, it may help figure out the issue.
Re: SDSPI hangs occasionallly
I am using esp-idf v3.1.3
-
- Posts: 37
- Joined: Mon Aug 28, 2017 10:25 am
Re: SDSPI hangs occasionallly
Hi tsc1987,
Here is a debugging patch to show:
1. the process of the trans into and out of sending queue, into and out of the returning queue (to avoid he accidently receive the trans elsewhere).
2. when the interrupt triggers, when the interrupt is enabled/disabled, and trans_done is cleared
3. key value of registers before the transaction is sent
It helps a lot for us to debug your case. Can you run your code with this patch on v3.1.3 and give us the full log/or the latest several pages of log before the hanging happened?
Here is a debugging patch to show:
1. the process of the trans into and out of sending queue, into and out of the returning queue (to avoid he accidently receive the trans elsewhere).
2. when the interrupt triggers, when the interrupt is enabled/disabled, and trans_done is cleared
3. key value of registers before the transaction is sent
It helps a lot for us to debug your case. Can you run your code with this patch on v3.1.3 and give us the full log/or the latest several pages of log before the hanging happened?
- Attachments
-
- 0001-debug-commit.rar
- (1.77 KiB) Downloaded 466 times
Who is online
Users browsing this forum: Bing [Bot] and 159 guests