originally I intended to use a timer ISR to send out periodic CAN messages. The timer callback was a class method. However, this did not work, giving "heap allocation not allowed" error messages.
I understand that no heap can be allocated in an ISR and that it should be as short as possible a function. But is really the only solution then to use flags (e.g. and then to check the flag in main routine and send CAN message if set)?
Also, I wonder how to determine when heap gets allocated. For example, I run the code provided in the docs (http://docs.micropython.org/en/latest/p ... #pyb-timer), namely:
Code: Select all
def tick(timer): print(timer.counter()) tim = pyb.Timer(4, freq=1) tim.callback(tick)
This only provides '0' as output on the screen. So apparently there is a memory issue with the print during ISR, but no heap allocation message is thrown.