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
Path to Programmable
  • Challenges & Projects
  • Design Challenges
  • Path to Programmable
  • More
  • Cancel
Path to Programmable
Blog Path to Programmable - Project update - I made something!
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: aspork42
  • Date Created: 11 Jan 2019 5:49 AM Date Created
  • Views 3005 views
  • Likes 9 likes
  • Comments 17 comments
  • isr
  • interrupt
  • pwm
  • xilinx
  • fpga
  • vivado
  • sdk
Related
Recommended

Path to Programmable - Project update - I made something!

aspork42
aspork42
11 Jan 2019

Well - I finally managed to do it!

I have created a basic project based on the lessons from the training.

image

 

About:

Through Avnet, Xilinx and Element14, a training program to learn about the Zynq 7000 platform which is System On Chip combining an FPGA with an ARM processor. This comes to the students as complete development board packed with goodies like a wireless chip from MuRata (BT/BTLE/WIFI), 8GB Flash memory, onboard RAM, USB to JTAG (JTAG programmable over USB), Arduino-style headers (3.3V compatible only), Microphone, Bi-Color LED, and two additional expansion ports.

 

See all blog posts for this training here.

 

What did I do?

My project was supposed to be a line follower, but I had to limit the scope to just the sensor array as I talked about in the previous blog post. I spent a number of days trying to run with external hardware using an ADC to read the line sensor array; but for the life of me, I couldn't get the I2C bus to work. I continually got compiling errors in SDK relating to an interrupt library:

 

fatal error: xintc.h: No such file or directory

 

I wasn't able to find any example code that I could start with as a base.

 

My project ended up being an Timer Interrupt library based in the FPGA fabric. It generates an interrupt every "N" clock cycles; and I mapped it to the 48 MHz clock. This interrupt then feeds into the interrupt concatenator as interrupt #0. This still is relative to what I had wanted to do, but much much farther away from where I wanted to be.

 

I used the IP Library to find new IP and import into my hardware design. I then exported the hardware and made a new workspace & BSP in the SDK utility. I started with some base code in the SDK and got it working with my new hardware to run things. So I'm using both the PS + PL. I had to re-map the interrupt which was used in the base program to the one generated from Vivado.

 

image

 

 

This project uses the PWM LED dimmer as a base code for the PS side of things; but modified. When the FPGA Fixed Interval Timer ("FIT") generates an interrupt, it is captured in the PS running my code. We keep count of the number of interrupts and use that to run the PWM signal back out to the real world.

 

Here is the functional part of the ISR that does it:

 

void PWMIsr(void *InstancePtr)
{
count += 1; // add one to the counter
brightness = (count % 10)* 110000; // count modulus 10, multiplied by 110000 to normalize with the clock
xil_printf("\033[2K I have been interrupted %u times! Setting brightness to %u \r", count, brightness);
Xil_Out32(PWM_BASE_ADDRESS, brightness);//write value to PWM controller back in the PL
}

 

This code is still related to the project I wanted to do. I spent hours trying to create the part of the line follower which reads a wheel encoder and provides feedback about the speed of the robot before I settled on this as a start. Since this has a consistent time-based interrupt, I could use it to periodically check a counter to calculate the frequency of pulses; which correlate to speed. The output of this would then feed into a PID loop to adjust the PWM signal going out to the wheel motor based on the speed delta.

 

I can say that this has been very tough challenge as I don't have any background with FPGAs. Although this project is hardly earth shattering in terms of complexity, but it does demonstrate that the training has actually given a total beginner enough knowledge to perform some basic tasks. As stated above, this does make use of both the PS + PL, and both Vivado and the SDK were required to make all of this work. I had to find & import IP on my own, re-wire the block diagram, export a valid bitstream; then import to SDK and write [well, ok, 'modify'] a corresponding program. I have gotten much better at navigating the interfaces now that I'm doing it on my own. I decided that I like the automatic build when you save a file in SDK. One other nice thing as stated in a previous blog was the System Debugger lets you edit code and upload right from the deugger; which made it much faster and easier to develop. I thought at first that this would be annoying; but when running the debugger I can edit code right there, hit save (which generates a new build) then restart the deubgger immediately. I'm really curious what shortcuts are available on this platform to speed up hardware debugging because using the FPGA side to alleviate pressure on the ARM processor would be amazing and key to the line follower that I would like to build with this.

 

I found myself numerous times falling into some of the traps that the training warned about - importing code incorrectly, leaving a space in the Application Project Name (see cryptic error message below), and many other things. I would start getting cryptic errors and after an hour or so of troubleshooting, I would realize my mistake.

 

Error message from invalid application project name. This doesn't show up until one tries to run the debugger.

wrong # args: should be "dow ?options? file ?address?"

 

As with the Smart Range Hood design challenge, my sympathetic wife hung in there watching our two kids while I hid away in the workshop on this project, so I owe a big thanks to her.

 

See the video here to watch it in action! (sorry about the background noise with my 3D Printer running)

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

Conclusions?

What did I learn from this? What are the take-aways?

Well... as far as the actual training documents, they are very well written. As long as someone can follow them, they can complete the lessons. There are training videos which are pretty dry and the presenter can be seen reading the prompter which was pretty distracting; but otherwise were very good. Looking back, I think I would have preferred having the SW (SDK) lessons first, then introduce the Hardware lessons and Vivado. The reason is that, especially for someone new to all of this, things can get overwhelming. As we modify the hardware in Vivado, there are quite a few steps required to get it running on the actual board - Synthesize, generate Bitstream, Export. Open SDK, Import hardware and generate Board Support Package. Create a new application (even it it is an empty 'do nothing' app), THEN we can program the FPGA, Then we have to run the application.

 

With this board, The FPGA (PL) can't run without at least a generic PS program. If we had done the software training first, then at least I would have been more comfortable with the SDK before I get in a start with the FPGA stuff. But then again, part of the focus of this training was around using an FPGA, so doing training in that order does seem a little backwards, and also means we couldn't write FPGA programs until the second half.

 

A huge thanks to Xilinx, Avnet, and Element14 for sponsoring this contest! I plan to continue to develop more with the MiniZed and really let it flex its muscles.

 

- James O'Gorman

  • Sign in to reply

Top Comments

  • michaelkellett
    michaelkellett over 6 years ago +6
    Thanks for your work so far James. Sorry you couldn't get the I2C to work the way you wanted. From your efforts and those of the other reviewers I still think the Zynq is far to hard to use to gain the…
  • aspork42
    aspork42 over 6 years ago in reply to michaelkellett +2
    Thanks Michael - Yes - there was a pretty big learning curve on this one. I certainly understand where the complexity comes from, but after working with things like Arduino for so long I come to the MiniZed…
  • nixiefairy
    nixiefairy over 6 years ago +2
    Good job James! And congrats on completing the course ! I doubt I can finish mine in time
Parents
  • michaelkellett
    michaelkellett over 6 years ago

    Thanks for your work so far James.

     

    Sorry you couldn't get the I2C to work the way you wanted.

     

    From your efforts and those of the other reviewers I still think the Zynq is far to hard to use to gain the market the hardware has the potential to work with. It just seems so much effort compared with using a separate processor and FPGA.

     

    MK

    • Cancel
    • Vote Up +6 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • michaelkellett
    michaelkellett over 6 years ago

    Thanks for your work so far James.

     

    Sorry you couldn't get the I2C to work the way you wanted.

     

    From your efforts and those of the other reviewers I still think the Zynq is far to hard to use to gain the market the hardware has the potential to work with. It just seems so much effort compared with using a separate processor and FPGA.

     

    MK

    • Cancel
    • Vote Up +6 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
  • aspork42
    aspork42 over 6 years ago in reply to michaelkellett

    Thanks Michael - Yes - there was a pretty big learning curve on this one. I certainly understand where the complexity comes from, but after working with things like Arduino for so long I come to the MiniZed. It is a pre-packaged board with lots of goodies, but the training makes me manually set memory addresses and nanosecond clock delays for RAM. Uploading a [PL] program is a 17 step process. Compared to just picking the board from a drop-down and having a one-click upload function.

     

    There is also the issue of support and pre-made IP blocks/libraries - there is certainly a following out there like the ZedBoard forums and Xilinx support, but there is nowhere near what Arduino has; which I find unfortunate. I really want to do a lot more with the FPGA side, but searching the web for "MiniZed Encoder IP" or any similar shows only things like MPEG encoding and 4G LTE Encoding, but nothing for reading an [rotary] encoder. Without having a PMOD chip, I was completely unable to play with non-PMOD I2C. (Yes - others with more experience wouldn't have as many issues, but I represent someone new to the arena).

     

    I think I've stated in a place or two before, this training was much more about "how to use Vivado and SDK" than about "how does an FPGA work". I think it is geared towards something like a three or four-day seminar that Xilinx could host and your work would send you as a professional embedded programer. I certainly learned a lot during the training but I still don't know how to write my own Verilog or do proper memory allocation for a given application.

     

    I would like to morph my project into using a hardware input (from a wheel encoder) and have the FIT timer used to calculate frequency and speed; and do this all in the FPGA fabric, but aren't really sure where to start.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • michaelkellett
    michaelkellett over 6 years ago in reply to aspork42

    I can certainly help with VHDL (or at a push Verilog) to work the decoder - not sure I'd use the FIT timer is but measuring pulse timing and calculating speed should be easy enough. You need some Xilinx demo code for a peripheral that acts as an input device to the processor and that can then be merged with the code that works your encoder.

     

    MK

    • Cancel
    • Vote Up +2 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