What's the easiest way to tell is something is generating an interrupt? Any ideas what could be causing this if not interrupts?

Code: Select all
import gc
gc.collect()
gc.disable()
# sensitive code here
gc.enable()
Code: Select all
from pyb import SPI, Pin
from utime import sleep_ms, sleep_us
from math import sin, pi
from struct import pack
spi = SPI(1)
spi.init(SPI.MASTER, polarity=0)
cs = Pin('X22', Pin.OUT) # Grey wire
cs.value(1)
ldac = Pin('X21', Pin.OUT) # Yellow
ldac.value(1)
scopeTrigger = Pin('Y12', Pin.OUT)
scopeTrigger.value(1)
buf = bytearray()
buf.append(0x3f)
buf.append(0x3f)
def setDAC(buffer):
cs.value(0)
spi.send(buffer)
cs.value(1)
# sleep_us(1)
ldac.value(0)
sleep_us(1)
ldac.value(1)
def saw():
global buf
while True:
scopeTrigger.value(0)
for x in range(16):
for y in range(0xFF):
buf = bytearray()
buf.append(x + 0b00110000) # Select ch A, 1x Gain, enable output A
buf.append(y)
setDAC(buf)
sleep_us(5)
scopeTrigger.value(1)
def tri():
global buf
while True:
scopeTrigger.value(0)
for x in range(16):
for y in range(0, 0xFF, 128):
buf = bytearray()
buf.append(x + 0b00110000) # Select ch A, 1x Gain, enable output A
buf.append(y)
setDAC(buf)
sleep_us(5)
scopeTrigger.value(1)
for x in range(16):
for y in range(0, 0x100, 128):
buf = bytearray()
buf.append((0x0F - x) + 0b00110000)
buf.append(0xFF - y)
setDAC(buf)
sleep_us(5)
def sine():
global buf
while True:
scopeTrigger.value(0)
for x in range(500):
value = (pi * 2) * (x / 500)
value = sin(value)
total = (value * 0xFFF * 0.5) + (0xFFF / 2)
b2, b1 = pack(">H", int(total))
buf = bytearray()
buf.append(b2 + 0b00110000)
buf.append(b1)
setDAC(buf)
sleep_us(5)
if x == 50:
scopeTrigger.value(1)
Code: Select all
# old method, this code was used every time I needed to send a new command to the MCP4802
buf = bytearray()
buf.append(x)
buf.append(y)
# new method
buf = bytearray(b'\x00\x00') #initialized once at the start of the routine only
# in the wave generator functions I use
buf[0] = x
buf[1] = y