Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPI interrupt panics when using ESP-LCD (IDFGH-10273) #11536

Closed
3 tasks done
NaivelyWritten opened this issue May 30, 2023 · 2 comments
Closed
3 tasks done

SPI interrupt panics when using ESP-LCD (IDFGH-10273) #11536

NaivelyWritten opened this issue May 30, 2023 · 2 comments
Assignees
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Type: Bug bugs in IDF

Comments

@NaivelyWritten
Copy link

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

master

Operating System used.

macOS

How did you build your project?

Command line with idf.py

If you are using Windows, please specify command line type.

None

Development Kit.

ESP32-S3-USB-OTG

Power Supply used.

USB

What is the expected behavior?

LCD screen works

What is the actual behavior?

System panics with

Steps to reproduce.

  1. Run the LCD demo according to master documentation

Debug Logs.

No response

More Information.

The bug is here:

        if (!acq_dev_lock) {
            // This function may assign a new acquiring device, otherwise it will suggest a desired device with BG active
            // We use either of them without further searching in the devices.
            // If the return value is true, it means either there's no acquiring device, or the acquiring device's BG is active,
            // We stay in the ISR to deal with those transactions of desired device, otherwise nothing will be done, check whether we need to resume some other tasks, or just quit the ISR
            resume_task = spi_bus_lock_bg_check_dev_acq(lock, &desired_dev);
        }
        // sanity check
        assert(desired_dev);

        if (!resume_task) {
            bool dev_has_req = spi_bus_lock_bg_check_dev_req(desired_dev);
            if (dev_has_req) {
                device_to_send = host->device[spi_bus_lock_get_dev_id(desired_dev)];
                trans_found = xQueueReceiveFromISR(device_to_send->trans_queue, &host->cur_trans_buf, &do_yield);
                if (!trans_found) {
                    spi_bus_lock_bg_clear_req(desired_dev);
                }
            }
        }

resume_task can set desired_dev to be NULL and then return true in

desired_dev = NULL;
lock->acquiring_dev = NULL;
bg_yield = true;
}
}
*out_desired_dev = desired_dev;
return bg_yield;
}

Fix: move the assertion inside the if(!resume_task)

@NaivelyWritten NaivelyWritten added the Type: Bug bugs in IDF label May 30, 2023
@NaivelyWritten
Copy link
Author

Cross ref to the forum: https://esp32.com/viewtopic.php?t=33776&p=114375

@espressif-bot espressif-bot added the Status: Opened Issue is new label May 30, 2023
@github-actions github-actions bot changed the title SPI interrupt panics when using ESP-LCD SPI interrupt panics when using ESP-LCD (IDFGH-10273) May 30, 2023
@NaivelyWritten
Copy link
Author

@suda-morris This bug dates back to last year but I don't know why it only appeared recently.

@espressif-bot espressif-bot added Status: In Progress Work is in progress Status: Done Issue is done internally Resolution: NA Issue resolution is unavailable and removed Status: Opened Issue is new Status: In Progress Work is in progress labels May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests

3 participants