FRC CAN Library

Need help with CAN Filters and the CAN call back

  1. How many Filter banks can I have per FIFO? 1?

  2. i’m getting an "uncaught exception in CAN(2) rx interrupt handler
    MemoryError: " when I trigger my callback. Here is my code.

canbuf = bytearray(8)
canlist = [0,0,0,memoryview(canbuf)]

def canHandler(bus, reason):
    print("data recieved.  Reason: %d" %reason)
    bus.recv(1,list = canlist, timeout=500)

can.rxcallback(1, canHandler)

CAN.LIST32 doesn’t seem to be supported like it is mentioned in the docs. I understand that it makes more sense to use CAN.DUAL, but it took me a minute to read further, because i’m not that bright.

Hi, you are trying to print which uses malloc in an interrupt callback. The canHandler is run in interrupt context. You should use micropython.schedule() to schedule another function to run outside of interrupt context.

The CAN module was greatly changed in the most recent update of MP. I need to re-familiarize myself with it.