CANPS with PYNQ

Hello Dears,
I use PYNQ-Z2 board, the pynq version which I am using is v3.1.
Vivado design is attached .
CAN0,1 use from EMIO pins.
The code which I have used is:

from pynq import MMIO
from pynq import Overlay
from pynq import ps
from pynq import GPIO
from pynq import registers
from pynq import allocate
import numpy as np
import sys
sys.path.insert(1, ‘./src’)
ol=Overlay(“./bits/FullInterfaceWrapper.bit”)
ol.download()
ps.Clocks.fclk0_mhz=100.0
BASE_ADDRESS = 0xE0009000#CAN

mmio=MMIO(BASE_ADDRESS,8)
result=mmio.read(0)

Code hangs when reach to ‘result=mmio.read(0)’


Why the arm processor is hanged?

Hi @saeed123,

pynq.mmio() reads and writes from IP in the PL via the GP ports. The CAN IP and base address are associated to the PS, hence when you try to read the board crashes.

Mario

1 Like

Dear @marioruiz , what is the solution to work with CAN in PS section without consuming PL gates? How I can access to these registers for reading and writing into them? Is there any proper library to handle CAN in python environment for Pynq-z2?

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.

The CAN IP in the PS doesn’t have a Python API in PYNQ.
You would need to write this yourself, or use an existing driver.

Cathal