ultrasonic front_USS(FTRIG, FECHO, 100ms, 1s, &f_dist);
ultrasonic left_USS(LTRIG, LECHO, 100ms, 1s, &l_dist); ```
The code compiles fine, but when I run it the serial just shows this error:
> ++ MbedOS Error Info ++
> Error Status: 0x80FF0100 Code: 256 Module: 255
> Error Message: Fatal Run-time error
> Location: 0x80058FD
> Error Value: 0x0
> Current Thread: main Id: 0x20001F2C Entry: 0x8006C47 StackSize: 0x1000 StackMem: 0x20000518 SP: 0x2000140C
> For more info, visit: https://mbed.com/s/error?error=0x80FF0100&tgt=NUCLEO_F303RE
> -- MbedOS Error Info --
> InterruptIn error: irq channel conflict
The code runs fine for either of the sensors on their own. but it doesn't like having both decalared at once.
I assume the IRQ channel conflict is to do with having timeouts/interrupts happening for both sensors at once.
Is there a way to get this code working for multiple ultrasonic sensors?
Thankyou
Thanks for your response, here are the pins I’m using on the Nucleo F303RE:
#define FTRIG D9
#define FECHO D10
#define LTRIG D11
#define LECHO D12
//f_dist() and l_dist() defined here
ultrasonic front_USS(FTRIG, FECHO, 100ms, 1s, &f_dist);
ultrasonic left_USS(LTRIG, LECHO, 100ms, 1s, &l_dist);
from:
On STM32 external interrupts share lines.
All PA_1, PB_1, PC_1 … PG_1 share one single line 1
All PA_2, PB_2, PC_2 … PG_2 share one single line 2
All PA_N, PB_N, PC_2 … PG_N share one single line N
And even EXTI may be shared between lines 5 to 9
So user should only consider using one EXTI per GPIO bank and carefully review selection
from the nucleo pinout: D9-D12 = PC_7, PB_6, PA_7, PA_6
does this mean the error is being caused by using pins ending in the same number (6 and 7)?