element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Personal Blogs
  • Community Hub
  • More
Personal Blogs
Legacy Personal Blogs PYNQ-Z2 Workshop - Session 1 blog 2
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: beacon_dave
  • Date Created: 28 May 2020 5:01 PM Date Created
  • Views 1604 views
  • Likes 7 likes
  • Comments 8 comments
  • pynq framework
  • pynq-z2
  • pynq workshop
  • pynqstarter
Related
Recommended

PYNQ-Z2 Workshop - Session 1 blog 2

beacon_dave
beacon_dave
28 May 2020

Continuing on from the previous PYNQ-Z2 Workshop - Session 1 blog,  this blog continues to investigate the topics covered in the Element 14 workshop session PYNQ-Z2 Workshop: Getting Started with PYNQ led by Adam Taylor, where we took an introductory look at the PYNQ-Z2 development board produced by the Tul Corporation.

 

Previously I had looked at using the logictools overlay and more specifically the Pattern Generator and Trace Analyzer in relation to a 4-bit gray code. This time I'm using it with the DMX512 protocol which is widely used for entertainment control purposes.

 

Once the PYNQ-Z2 development board is powered up and connected to the local network, we can use a web browser to log into Jupyter running on one of the microprocessor cores of the ZYNQ 7000 series device.

 

Here we create a new notebook and start interacting with the PYNQ framework.

 

First we download the logictools overlay supplied with the PYNQ-Z2 board image:

image

Then we create the WaveJSON waveform in WaveDrom mark-up:

image

In this instance we are creating a start frame plus 5 frames of data.

  • start frame is set to 0x00 to indicate dimmer frames
  • channel 1 is set to a value of 0
  • channel 2 is set to a value of 1
  • channel 3 is set to a value of 127
  • channel 4 is set to a value of 128
  • channel 5 is set to a value of 255

Annotations have been added to help illustrate the DMX512 format making use of the WaveDrom features.

  • m.a.l.c mark-after-last channel (minimum duration of 0s but only if at least 24 channels are present to comply with the minimum packet duration)
  • m.a.b mark-after-break (minimum duration of 88μs / two frames)
  • m.b.f mark-between-frames (minimum duration of 0, max of 1s)

The minimum permitted duration for a DMX512 packet is 1196μs, so this example would either need an additional 19 channels adding or alternatively an extended mark-after-last channel to pad out to 1196μs.

 

The 88μs break may also need extending to the recommended 100-200μs to accommodate receiver tolerances.

We can now display the waveform:

image

This is just the first 17 bits, the full 120 bits can be seen further down after the analysis has been captured and added.

 

We can now instantiate the pattern generator and trace analyzer objects to make use of this waveform data.

image

The analyser is set to capture 120 bits of data.

 

The pattern generator needs to be configured with the stimulus and analysis group wave names, the mode and the frequency.

By default the generator runs at 10MHz which is too fast for DMX512. Unfortunately its configurable range out of the box is 251.95kHz to 100MHz which is still slightly too fast for the 4μs pulses used in in DMX512, however not an issue with simulation, but would make the 88μs break too short to be recognised by some receivers.

The mode can be set to single shot or continuous looping. At this stage it is set to single shot, however looping will be required for a receiver test.

image

In order for the trace analyser to capture the pattern generator output, a jumper cable requires connecting between D0 and D19 on the Arduino interface to provide a loopback signal.

 

We can now run the pattern generator and trace analyzer and display both the generated (Tx) and captured (Rx) waveform:

image

image

image

image

image

image

image

After the capture we can stop the pattern generator:

image

 

As with the previous blog, this was fairly easy to configure and run. The Jupyter notebook environment is convenient to work with, and WaveDrom is quite flexible  once you get the hang of it.

 

Unfortunately the PYNQ documentation is a bit vague on how to use the logictools pattern generator with either of the PMOD (or the Raspberry Pi) interfaces as I have a PMOD RS-485 module sitting here eager to participate. It may have to be patched into the Arduino interface instead.

  • Sign in to reply

Top Comments

  • yuricts
    yuricts over 5 years ago in reply to beacon_dave +2
    Hi Dave, I have been digging in the docs, namely: In this source you see the TraceAnalyzers specification can be set (line 114-122): https://github.com/Xilinx/PYNQ/blob/master/boards/Pynq-Z2/base/base…
  • beacon_dave
    beacon_dave over 5 years ago +1
    adamtaylorcengfiet is there any information available on how to use the LogicTools Pattern Generator with either the PMOD or Raspberry Pi interfaces on the PYNQ-Z2 board ? ReadTheDocs keeps hinting that…
  • yuricts
    yuricts over 5 years ago in reply to yuricts +1
    I have been trying this, but I cannot find the correct pin mapping to the pmod. Feels like a dead-end... After reading Adam's blog here: https://www.hackster.io/news/pynq-edition-interfacing-with-pmods…
  • beacon_dave
    beacon_dave over 5 years ago in reply to yuricts

    "...that is one for the Z1 (I suppose the board pinouts are identical in perspective of arduino/rpi/pmod pinout)…"

    The PYNQ-Z1 doesn't have the Raspberry Pi interface, it has the  chipKit enhanced Arduino shield instead. The Z1 and Z2 PYNQ builds appear to share some of the same files but the comments don't always reflect this which can be confusing. There is also a whole load of code where 'raspberry' is renamed to 'respberry' as well that could do with a little cleaning up. 

     

    I find is strange that they went to all the effort of setting up the Raspberry Pi logic controller and IOPs but then they don't appear to document how to use it from the logictools overlay.

     

    PatternGenerator.connect() appears to configure the IO switch

    https://pynq.readthedocs.io/en/v2.5.1/pynq_package/pynq.lib/pynq.lib.logictools.html?highlight=connect()#pynq.lib.logict…

    but isn't intended to be used directly.

     

    PaternGenerator.run() calls .connect() but presumably the intf_spec or similar needs to be set to the appropriate interface before .run() is called.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • yuricts
    yuricts over 5 years ago in reply to beacon_dave

    I tried changing the pynq/overlays/logictools/logictools.py on the pynq (via FileZilla and edit file) to have it use RASPBERRYPI or PMODB. No success yet...

     

        def __init__(self, bitfile, **kwargs):

            super().__init__(bitfile, **kwargs)

            if self.is_loaded():

                self.iop_pmodb.mbtype = "Pmod"

                self.lcp_ar.mbtype = "Logictools"

                self.lcp_rp.mbtype = "Logictools"

     

     

                self.PMODB = self.iop_pmodb.mb_info

                self.ARDUINO = self.lcp_ar.mb_info

                self.RASPBERRYPI = self.lcp_rp.mb_info

     

     

                self.boolean_generator = BooleanGenerator(self.ARDUINO)

                self.pattern_generator = PatternGenerator(self.PMODB)

                self.fsm_generator = FSMGenerator(self.ARDUINO)

                self.trace_analyzer = TraceAnalyzer(self.ARDUINO)

                self.logictools_controller = LogicToolsController(self.ARDUINO)

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • yuricts
    yuricts over 5 years ago in reply to yuricts

    There is only one specifitation defined in https://github.com/Xilinx/PYNQ/blob/master/pynq/lib/logictools/constants.py and that is one for the Z1 (I suppose the board pinouts are identical in perspective of arduino/rpi/pmod pinout).

     

    You can see that it is this one being used:

    print(pattern_generator.intf_spec)

     

    It is possible to change the interface specification, after creating the pattern_generator you can assign a dict to it:

    pattern_generator.intf_spec={'interface_width': 28,

                                'monitor_width': 64,

                                'traceable_io_pins': {'D27': 0,

                                                      'D28': 1,

                                                      'D3': 2,

    ...                                                  'D37': 26,

                                                      'D13': 27

                                                      },

                                'traceable_tri_states': {'D27': 28,

                                                         'D28': 29,

      ...

                                                        'D37': 54,

                                                         'D13': 55

                                                         }

                                }

    (see https://github.com/Xilinx/PYNQ/blob/master/boards/Pynq-Z2/base/constants.py  for the full specification)

    When you call setup that will be used.

     

    But at this moment I don't have a clue where the pin numbers are defined (28,29,...). Probably in a tcl or hwh file?

    And I can't imagine how it would work this way.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • beacon_dave
    beacon_dave over 5 years ago in reply to yuricts

    Yes, I found that as well but it appears to also have settings in there for .PMOD and .RASPBERRYPI as well.

     

    self.PMODB = self.iop_pmodb.mb_info 
    self.ARDUINO = self.lcp_ar.mb_info 
    self.RASPBERRYPI = self.lcp_rp.mb_info

     

     

    I also found some more pin names used by the base overlay here:

       https://github.com/Xilinx/PYNQ/blob/master/boards/Pynq-Z2/base/constants.py

    which includes Raspberry Pi and PMOD as well as Arduino.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • yuricts
    yuricts over 5 years ago in reply to yuricts

    Looking at the source code of the logictools overlay it seems arduino is hard-coded:

    https://github.com/Xilinx/PYNQ/blob/master/boards/Pynq-Z2/logictools/logictools.py


      self.pattern_generator = PatternGenerator(self.ARDUINO)
    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube