RX is set to exint,and callback() is set uart.read and go to sleep.but it doesn't work!

import sensor, image, time, machine, pyb
from pyb import LED
from pyb import UART
from pyb import Pin, ExtInt
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000)

clock = time.clock()
led = LED(1) # red led

uart = UART(3, 19200)
uart.init(19200, bits=8, parity=None, stop=1)

sensor.sleep(True)

sensor.shutdown(True)
img=0

def whatever(x):
    global extint, led,img,REQUEST,ext
    ext.disable()    #turn off
    clock.tick()
    img +=1# sensor.snapshot()
    print(img)
    REQUEST = uart.read()
    print(REQUEST)
    #sensor.reset()
    #sensor.snapshot()
    led.toggle()
    time.sleep(1)
    led.toggle()
    time.sleep(1)
    #print(clock.fps())
    ext.enable()    #turn on
    sensor.sleep(True)

    sensor.shutdown(True)
ext = ExtInt(Pin('P5'), ExtInt.IRQ_RISING, Pin.PULL_NONE, whatever)# RX ExtInt
while(True):
    clock.tick()

#pc sends the hex data :05 30 01 02 03 04 15.
openmv show me:
1
uncaught exception in ExtInt interrupt handler line 11
MemoryError:

Hi, per the documentation you can’t do memory allocation in an interrupt handler.

The documentation describes how to use interrupts very clearly.

Also… you never want to add delays in an interrupt handler. You basically tried to crash the processor.