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

Cleared events in event_wait #21

Open
Marco-Peter opened this issue Nov 10, 2024 · 2 comments
Open

Cleared events in event_wait #21

Marco-Peter opened this issue Nov 10, 2024 · 2 comments

Comments

@Marco-Peter
Copy link

Marco-Peter commented Nov 10, 2024

The BSP provides three functions to allow for waiting on events:

  • chbsp_event_wait_setup()
  • chbsp_event_wait()
  • chbsp_event_notify()

During the initial programming int shasta_detect_and_program() they are used so that the application can wait on the sensor reset.

Before programming, chbsp_event_wait_setup() is called to clear any pending events and chdrv_int_interrupt_enable() to enable the interrupts.
After programming and reset, event_wait is called to wait for the interrupt.

The problem is now that the called function event_wait() again calls chbsp_event_wait_setup() and chdrv_int_interrupt_enable().
This clears any potentially arrived events.

static inline uint8_t event_wait(ch_dev_t *dev_ptr) {
uint8_t err = 0;
chbsp_event_wait_setup((1 << dev_ptr->io_index));
chdrv_int_interrupt_enable(dev_ptr); // *** enable interrupt ***/
#ifdef CHDRV_WAIT_DEBUG
chbsp_debug_on(1);
#endif /* CHDRV_WAIT_DEBUG */
err = chbsp_event_wait(CHDRV_EVENT_TIMEOUT_MS, (1 << dev_ptr->io_index));
/* The interrupts are disabled in the entry of chdrv_int_callback */

I would suggest to remove the calls to

  • chbsp_event_wait_setup()
  • chdrv_int_interrupt_enable()
    within event_wait()

@tdk-invn-oss/ultrasonic-maintainers

@tdk-opensource
Copy link
Collaborator

Thank you for opening this issue! We will look into it shortly.

Notifying @tdk-invn-oss/ultrasonic-maintainers

@mhkline
Copy link
Contributor

mhkline commented Dec 9, 2024

Thanks for the suggestion. This does look fishy. We will add this to our internal tracker and look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants