I got an autonomo board and made it work with 3 separate devices, all connected to Serial1, 2 and 3 respectively. When I read them in round robin way they work fine.
But my application requires interrupts on these ports.
serialEvent2() don’t seems to work in code.
If I bind them with external interrupts on RX ports, then serial communication stop working altogether.
Is there any other way to get serial interrupts working? Or i have to attach external interrupts on different pins?
The method serialEventRun() does not seem to be implemented on the SAMD platform. This method is called after loop() finishes and is responsible for calling the specific serialEventX() methods, if the method exists and if new data is available.
The serialEventX() methods are not actually interrupts. They are just routines that are called after loop() if data has arrived.
You can either write method called serialEventRun() which will be executed every time after loop(), and in which you can check for new data using available(), or you can just add a similar code to the end of loop().
If you want to bind to actual interrupt, have a look at the SERCOMX_Handler() methods in variant.cpp (for the specific board you are compiling for). These methods simply call the SerialX.IrqHandler() which stores the new data word that has arrived. You can add an additional call to whatever method you want afterwards. However, you should consider using something like //attribute((weak)).