Closed mbait closed 1 year ago
#include <modm/board.hpp> #include <modm/io/iostream.hpp> #include <modm/processing.hpp> #include <modm/processing/protothread.hpp> #include <modm/processing/timer.hpp> using namespace Board; using namespace std::chrono_literals; MODM_ISR(INT4) { Board::D19::acknowledgeExternalInterruptFlag(); Board::LedD13::toggle(); } int main() { Board::initialize(); Board::LedD13::setOutput(); Board::D19::setInput(Gpio::InputType::PullUp); Board::D19::setInputTrigger(Gpio::InputTrigger::RisingEdge); Board::D19::enableExternalInterrupt(); serialStream << "started" << modm::endl; for(;;); }
The following code being run on Arudino Mega 2560 exhibits weird behaviour: once the desider pin becomes high, the chip resets and starts the program from scratch. A similar setup in Arduino IDE performs just fine.
I realized a mismatch between the pin setup and the ISR provided, and, according to the datasheet, an unimplemented interrupt vector causes reset.
The following code being run on Arudino Mega 2560 exhibits weird behaviour: once the desider pin becomes high, the chip resets and starts the program from scratch. A similar setup in Arduino IDE performs just fine.