PYNQ: PYTHON PRODUCTIVITY FOR ZYNQ

Axidma problem in the jupyter

I made a edge detection accelerating IP in which includes a axivdma, and when I try to use it in the jupyter,some error occurred. I use the MM2SChannel.writeframe(frame) to input a png to vdma, and it noted me a error that “writeframe() missing 1 required positional argument: ‘frame’”, so should I add a argument for “self”? I wanna add the overlay.axi_vdma_0 as the first argument, but some wrong with the axi_vdma_0 as below shows:

BdbQuit Traceback (most recent call last)
in ()
----> 1 vdma = edge_detection.axi_vdma_0

/opt/python3.6/lib/python3.6/site-packages/pynq/overlay.py in getattr(self, key)
314 “”"
315 if self.is_loaded():
–> 316 return getattr(self._ip_map, key)
317 else:
318 raise RuntimeError(“Overlay not currently loaded”)

/opt/python3.6/lib/python3.6/site-packages/pynq/overlay.py in getattr(self, key)
516 elif key in self._description[‘ip’]:
517 ipdescription = self._description[‘ip’][key]
–> 518 driver = ipdescription’driver’
519 setattr(self, key, driver)
520 return driver

/opt/python3.6/lib/python3.6/site-packages/pynq/lib/video.py in init(self, description, framecount)
760
761 “”"
–> 762 super().init(description)
763 self.framecount = framecount
764 self.readchannel = AxiVDMA.S2MMChannel(self, self.s2mm_introut)

/opt/python3.6/lib/python3.6/site-packages/pynq/overlay.py in init(self, description)
466 self._gpio = {}
467 for interrupt, details in self._interrupts.items():
–> 468 setattr(self, interrupt, Interrupt(details[‘fullpath’]))
469 for gpio, entry in self._gpio.items():
470 gpio_number = GPIO.get_gpio_pin(entry[‘index’])

/opt/python3.6/lib/python3.6/site-packages/pynq/interrupt.py in init(self, pinname)
64 pdb.set_trace()
65
—> 66 parentname = PL.interrupt_pins[pinname][‘controller’]
67 self.number = PL.interrupt_pins[pinname][‘index’]
68 self.parent = weakref.ref(

/opt/python3.6/lib/python3.6/site-packages/pynq/interrupt.py in init(self, pinname)
64 pdb.set_trace()
65
—> 66 parentname = PL.interrupt_pins[pinname][‘controller’]
67 self.number = PL.interrupt_pins[pinname][‘index’]
68 self.parent = weakref.ref(

/opt/python3.6/lib/python3.6/bdb.py in trace_dispatch(self, frame, event, arg)
46 return # None
47 if event == ‘line’:
—> 48 return self.dispatch_line(frame)
49 if event == ‘call’:
50 return self.dispatch_call(frame, arg)

/opt/python3.6/lib/python3.6/bdb.py in dispatch_line(self, frame)
65 if self.stop_here(frame) or self.break_here(frame):
66 self.user_line(frame)
—> 67 if self.quitting: raise BdbQuit
68 return self.trace_dispatch
69

BdbQuit:

What should I do next? and if the way i try to use the axivdma is right, waiting for your reply.

Are you able to post your block diagram TCL? The stack-trace you’ve posted seems to imply that the failure is in creating the VDMA driver not in writeframe. Given the stack trace it looks like it is failing to create the interrupt handlers. Do you have the two interrupt lines of the VDMA attached to an AXI Interrupt controller? The VDMA driver is dependent on the interrupts being wired up as described in https://pynq.readthedocs.io/en/v2.4/overlay_design_methodology/pspl_interface.html#interrupt

Peter

I am sorry, I cannot upload the block diagram, because i am a new user.could you send a email to 1028271706@qq.com, and I will reply some files in my project. I have stuck here for a long time, and need a help indeed.I am sorry for replying so late in the last.

PYNQ only understands the first interrupt line going into the PS so in order to use the VDMA you also need an AXI interrupt controller to coalesce the two interrupts from the IP to a single one for the PS. I’ve attached a block diagram that shows the basic idea.

Peter

interrupt_example.pdf (85.4 KB)

thanks for your reply, I will try to modify the interrupt controller.

design_1.pdf (42.1 KB)
this is my new block design, there is the same error with the past.could you find where the wrong is?

Can you post the .hwh or .tcl file you are using with the bitstream?

Peter

canny.zip (281.7 KB)
yes, there are some files you maybe need to check,and thanks for your effort.

I took the files you posted and they seem to be working. I’ve posted the notebook I used for testing purposes here. I renamed your .hwh file to match the bitstream but that was only so I could have a look at the register map for your IP block and see if it needed poking to start. The image doesn’t come out right but I assume that’s because I’ve fed the wrong sized image in.

Note that if you are using the VDMA it will continually write frames out as fast as the downstream block can process them. This may be fine in a loop because the writeframe() function will block until the frame is written out but it is something to be aware of. You can force the DMA to stop after each frame but that’s not supported in the driver at present.

Peter

Dear Peter,
do u know the version of the uboot and linux in pynq image 2.1?

v2.1 = Ubuntu 16.04
https://pynq.readthedocs.io/en/v2.4/changelog.html?highlight=16.04#version-2-1

PetaLinux 17.04
https://pynq.readthedocs.io/en/v2.4/pynq_sd_card.html?highlight=v2.1

thanks, I found that uboot and kernel all are 2016.4.

hi peter, I try your notebook, but the project broke at : f[:] = img. and the log uart showed as:
Unable to handle kernel paging request at virtual address 471a594e
pgd = cd84c000
[471a594e] *pgd=00000000
Internal error: Oops - BUG: 1 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 1 PID: 1828 Comm: python3.6 Not tainted 4.6.0-xilinx #3
Hardware name: Xilinx Zynq Platform
EXT4-fs error (device mmcblk0p2) in ext4_reserve_inode_write:5267: Out of memory
EXT4-fs error (device mmcblk0p2) in ext4_reserve_inode_write:5267: Out of memory
EXT4-fs error (device mmcblk0p2) in ext4_orphan_add:2839: Out of memory
EXT4-fs error (device mmcblk0p2) in ext4_reserve_inode_write:5267: Out of memory
EXT4-fs error (device mmcblk0p2) in ext4_reserve_inode_write:5267: Out of memory
EXT4-fs warning (device mmcblk0p2): ext4_evict_inode:255: couldn’t mark inode dirty (err -12)
task: dec44180 ti: cdb6c000 task.ti: cdb6c000
PC is at timerqueue_add+0x18/0x8c
LR is at enqueue_hrtimer+0x30/0x34
pc : [] lr : [] psr: 20030093
sp : cdb6dda0 ip : d9010572 fp : c016de40
r10: dfb62c40 r9 : 00000000 r8 : 00000001
r7 : dfb62c40 r6 : dfb62cac r5 : 471a593e r4 : cdb6de30
r3 : ded5d188 r2 : ded5d180 r1 : 151354cd r0 : 21a8da20
Flags: nzCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment none
Control: 18c5387d Table: 0d84c04a DAC: 00000051
Process python3.6 (pid: 1828, stack limit = 0xcdb6c210)
Stack: (0xcdb6dda0 to 0xcdb6e000)
dda0: cdb6de30 cdb6ddb8 dfb62ca0 c015e870 00000724 c015eedc 0000c350 00000000
ddc0: 21a8da20 151354cd 002225b4 20030013 cdb6de84 cdb6de84 cdb6de30 21a816d0
dde0: 151354cd 000005ff ffffffff 00000000 00000000 c016de40 0000c350 00000000
de00: 00000000 cdb6de30 00000002 cdb6df78 cdb6de30 00000002 002225b4 c016e02c
de20: cdb6debc 00000000 21a8da20 151354cd cdb6de30 00000000 00000000 00000000
de40: 21a8da20 151354cd 21a816d0 151354cd c015e9ac dfb62ca0 00000001 00000724
de60: c016de40 68747970 2e336e6f 65740036 006f6f62 00000000 dec44180 cdb6dea8
de80: cdb6df60 00000064 cdb6de88 cdb6de88 cdb6de90 cdb6de90 dec44180 00000000
Unable to handle kernel paging request at virtual address 3f1f8b9a
pgd = c0004000
[3f1f8b9a] *pgd=00000000
dea0: 00222000 def76a80 000005b4 00000000 00000000 00000000 ffffffff df74e380
dec0: cdb6def8 00000009 00000000 002225b4 00000000 00000002 002225b4 000005ff
dee0: 00000000 c016fd58 ffffffff df440234 00000000 c01fd568 cdb6def8 cdb6def8
df00: cdb6df78 df440200 00000000 cdb6df60 df6573c0 00000000 df440200 c01fe4a0
df20: 00000000 000005b0 00000001 df6573c1 05f5e100 00000000 00000040 00000009
df40: 00000000 00000189 00000000 000005ff 002225b4 00000051 00000000 c0170820
df60: 00000000 00000000 ffffffff 00000051 b40fe564 0000004e 21a816d0 151354cd
df80: 5a84c573 15ad58d0 00000000 ffffffff 002225b0 000000f0 c0106f24 cdb6c000
dfa0: 00000000 c0106d60 00000000 ffffffff 002225b4 00000189 000005ff b40fe55c
dfc0: 00000000 ffffffff 002225b0 000000f0 431bde83 00222594 00222594 00000000
dfe0: 000000f0 b40fe4d8 b6ed502b b6ed9456 40030030 002225b4 00000000 00000000
[] (timerqueue_add) from [] (enqueue_hrtimer+0x30/0x34)
[] (enqueue_hrtimer) from [] (hrtimer_start_range_ns+0x1fc/0x2cc)
[] (hrtimer_start_range_ns) from [] (futex_wait_queue_me+0xb8/0x164)
[] (futex_wait_queue_me) from [] (futex_wait+0xe0/0x1e4)
[] (futex_wait) from [] (do_futex+0xd0/0xa54)
[] (do_futex) from [] (SyS_futex+0x144/0x188)
[] (SyS_futex) from [] (ret_fast_syscall+0x0/0x3c)
Code: e1a06000 e1a04001 e3a02000 ea000006 (e1c521d0)
Internal error: Oops - BUG: 5 [#2] PREEMPT SMP ARM
—[ end trace 3f9dc539769a2cc6 ]—
Modules linked in:
CPU: 0 PID: 0 Comm: swapper/0 Tainted: G D 4.6.0-xilinx #3
Hardware name: Xilinx Zynq Platform
task: c0a065c0 ti: c0a00000 task.ti: c0a00000
PC is at skb_put+0x8/0x50
LR is at gem_rx+0xa0/0x17c
pc : [] lr : [] psr: 20030113
sp : c0a01e30 ip : 00001736 fp : 00005a0d
r10: 0d96a541 r9 : 00000040 r8 : 00000040
r7 : 0880c03c r6 : 00000001 r5 : 3f1f8b42 r4 : df514500
r3 : 00000fff r2 : c03e4ce0 r1 : 0000003c r0 : 3f1f8b42
Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
Control: 18c5387d Table: 0d84c04a DAC: 00000051
Process swapper/0 (pid: 0, stack limit = 0xc0a00210)
Stack: (0xc0a01e30 to 0xc0a02000)
1e20: df514500 3f1f8b42 00000001 c03e4ce0
1e40: df514500 00000040 00000002 df514790 df514500 c03e19f8 00000040 0000012c
1e60: 00000001 c03e4e88 c03e4e44 df514790 dfb5abc0 c093fbc0 1f21b000 c0511d94
1e80: c0a01e80 c0a01e80 c0a01e88 c0a01e88 00000000 00000008 0000000a c0a0208c
1ea0: 00000101 c0a02080 00200000 00000003 00000004 c011e204 df4b88a0 00002004
1ec0: 00000003 00005a0c c0a30b60 00000000 00000000 df402600 00000001 8f45ee58
1ee0: 0000007b c0a30b60 00000000 c011e520 000000a5 c0151558 c0a01f20 f8f00100
1f00: c0a01f20 ffffffff c0a01f54 c01013bc c0498dac c0498dd0 60030013 c010a5d4
1f20: 00000000 c093f1c0 1f21b000 dfb5a1c0 00000000 00000000 dfb595c0 00000050
1f40: 8f45ee58 0000007b c0a30b60 00000000 00000008 c0a01f70 c0498dac c0498dd0
1f60: 60030013 ffffffff 00000051 c0498da0 00987d8a 00000000 8efe53b9 0000007b
1f80: 8f45ee58 0000007b c0a30b50 dfb595c0 c0a30b50 ffffffff c0930a30 00000001
1fa0: 413fc090 dffffc80 00000000 c014a050 c0a00000 c0a3a010 c0a39fc0 c0900b80
1fc0: ffffffff ffffffff 00000000 c09005b4 00000000 c0930a30 00000000 c0a3a254
1fe0: c0a02480 c0930a2c c0a077ec 0000406a 00000000 0000807c 00000000 00000000
[] (skb_put) from [] (gem_rx+0xa0/0x17c)
[] (gem_rx) from [] (macb_poll+0x44/0xe8)
[] (macb_poll) from [] (net_rx_action+0xe4/0x26c)
[] (net_rx_action) from [] (__do_softirq+0xc8/0x1d0)
[] (__do_softirq) from [] (irq_exit+0x58/0xc0)
[] (irq_exit) from [] (__handle_domain_irq+0x88/0xac)
[] (__handle_domain_irq) from [] (gic_handle_irq+0x50/0x90)
[] (gic_handle_irq) from [] (__irq_svc+0x54/0x90)
Exception stack(0xc0a01f20 to 0xc0a01f68)
1f20: 00000000 c093f1c0 1f21b000 dfb5a1c0 00000000 00000000 dfb595c0 00000050
1f40: 8f45ee58 0000007b c0a30b60 00000000 00000008 c0a01f70 c0498dac c0498dd0
1f60: 60030013 ffffffff
[] (__irq_svc) from [] (cpuidle_enter_state+0xe0/0x1f0)
[] (cpuidle_enter_state) from [] (cpu_startup_entry+0x188/0x1e8)
[] (cpu_startup_entry) from [] (start_kernel+0x304/0x364)
Code: e8bd8038 c065aa7c e92d4070 e1a0200e (e5904058)
—[ end trace 3f9dc539769a2cc7 ]—
Kernel panic - not syncing: Fatal exception in interrupt
SMP: failed to stop secondary CPUs
—[ end Kernel panic - not syncing: Fatal exception in interrupt