Yes, I discovered doorbells yesterday but Google denied all knowledge. It seems it's hot off the press and I discovered it before Google.On RP2350 there are new "doorbells" for exactly this purpose (also in multicore.h)

.in the peripheral itself (registers visible to both CPU cores) and in the NVIC (private to the core in question)
Thanks, that is the clearest and most concise explanation I've read on this confusing subject.
I looked at doing it internally it did not seem possible , I'll look into your suggestion.
I did try that approach but it did not work. I have not spent much time trying to debug it and find what I missed. The gpio pins seemed simpler. That's almost working but seems to be calling the ISR twice as often as it should.For simple cases, you can ignore the fact that it's a FIFO - just write arbitrary words into it on one core to trigger the interrupt in the other core, and then in the handling core pull a word out of it to acknowledge the interrupt.
Code:
void setup1() {#ifdef USE_FIFO irq_set_exclusive_handler(SIO_IRQ_PROC1, &DATA_ISR); irq_set_enabled(SIO_IRQ_PROC1, true); #else gpio_set_function(CORE1_CATCH_PIN, GPIO_FUNC_SIO); gpio_set_function(CORE0_SEND_PIN, GPIO_FUNC_SIO); gpio_set_dir(CORE1_CATCH_PIN, GPIO_IN); gpio_set_dir(CORE0_SEND_PIN, GPIO_OUT); gpio_put(CORE1_CATCH_PIN, 0); // jumper connects send and catch pins gpio_put(CORE0_SEND_PIN, 0); gpio_add_raw_irq_handler_masked(CORE1_CATCH_PIN, &DATA_ISR); irq_set_enabled(IO_IRQ_BANK0, true); irq_set_mask_enabled (CORE1_CATCH_PIN,true); gpio_set_irq_enabled(CORE1_CATCH_PIN, GPIO_IRQ_EDGE_RISE, true);#endif} // setup1() void DATA_ISR(){ Serial.printf("Core_%d: calling IMU_ISR()\n",get_core_num ());#ifdef USE_FIFO if (multicore_fifo_rvalid()) { // should always be valid if IRQ fired but prevent blocking multicore_fifo_pop_blocking(); // clear FIFO, drop ret value multicore_fifo_clear_irq(); // Clear interrupt getdata(); // ~300us I2C } else { Serial.printf("Core%d: FIFO empty \n",get_core_num ()); // debug only, should not happen }#else getdata(); // ~300us I2C gpio_acknowledge_irq(CORE1_CATCH_PIN ,GPIO_IRQ_EDGE_RISE); // clear when done.#endif} // DATA_ISR()
Thanks
Statistics: Posted by pie_face — Fri Aug 09, 2024 3:01 pm