Digilent Staff
  • Content Count

  • Joined

  • Last visited

  • Days Won


Posts posted by Ciprian

  1. As far as I can tell from your code, you are continuously reinitialize and reconfigure the XSysMon (the XADC driver). During this process, which is redundant, you are loosing a lot of samples.

    Try this instead:

    #include <stdio.h>
    #include "xparameters.h"
    #include "platform.h"
    #include "xsysmon.h"
    #include "xil_printf.h"
    #include "xstatus.h"
    #include "xuartlite.h"
    #define UART_BUFFER_SIZE 16
    #define NUMBER_OF_SAMPLES 4500
    int main()
        static XSysMon SysMonInst;      /* System Monitor driver instance */
        unsigned int ReceivedCount = 0;
        unsigned char RecvBuffer[UART_BUFFER_SIZE];
        XUartLite UartLite;
        unsigned int channel = 3;
        int Status;
        XSysMon_Config *ConfigPtr;
        XSysMon *SysMonInstPtr = &SysMonInst;
        int *sample;
        //External memory address to store samples
        sample=(int *)0x60000000;
        Status = XUartLite_Initialize(&UartLite, UARTLITE_DEVICE_ID);
        ReceivedCount = 0;
            ReceivedCount = XUartLite_Recv(&UartLite, (unsigned char *) RecvBuffer, 1);
        ConfigPtr = XSysMon_LookupConfig(SYSMON_DEVICE_ID);
        if (ConfigPtr == NULL) {
            return XST_FAILURE;
        XSysMon_CfgInitialize(SysMonInstPtr, ConfigPtr, ConfigPtr->BaseAddress);
        XSysMon_SetAvg(SysMonInstPtr, XSM_AVG_0_SAMPLES);
        XSysMon_SetAdcClkDivisor(SysMonInstPtr, 39);
        XSysMon_SetSequencerMode(SysMonInstPtr, XSM_SEQ_MODE_SINGCHAN);
                    XSM_CFR1_CAL_PS_GAIN_OFFSET_MASK |
        Status=  XSysMon_SetSingleChParams(SysMonInstPtr, XSM_CH_AUX_MIN+channel,
                                FALSE, FALSE, TRUE);
        if(Status != XST_SUCCESS) {
            return XST_FAILURE;
         * Disable all the alarms in the Configuration Register 1.
        XSysMon_SetAlarmEnables(SysMonInstPtr, 0x0);
             * Wait till the End of conversion
            for(int i=0;i<NUMBER_OF_SAMPLES;i++){
                XSysMon_GetStatus(SysMonInstPtr); /* Clear the old status */
                while ((XSysMon_GetStatus(SysMonInstPtr) & XSM_SR_EOC_MASK) !=
                //Four last bits are noise
                *(sample+i) = XSysMon_GetAdcData(SysMonInstPtr, XSM_CH_AUX_MIN+channel);
            //print("Finish capture\n\r");
            for(int i=0;i<NUMBER_OF_SAMPLES-1;i++){
        return 0;


  2. @HeroGian

    Your question is somewhat tricky. It is doable on an ARM but as far as I can gather it's not dynamic, you either start without caches and then everything moves slower or you continue using caches. The dynamical approach is somewhat tricky  because you risk freezing your OS. I you want to try that you can find more info here:

    There might be a better way to do it. What you actually want is just a hardware accelerated memcpy in the DDR, you could try to handle this like an DMA transfer in to DDR from the PL and use a coherency function for it. These are kernel space specific functions so I guess you will have to wirte a kernel driver for it. I strongly suggest reading about continuous memory (CMA) and coherent data transfers + the ACP port of the Zynq before proceeding. Here is a link which might give you an insight in to what and why I suggest this.

    Although you are using a Zynq, there might be some useful information in the ZynqMP wiki by xilinx about what you need.

    Sorry for not being able to give you a more coherent and straight forward answer, what you are attempting is tricky.

    Good Luck,


  3. Hi @Sduru,

    These are BSP errors you will have to regenerate the bsp. Just right click on it in the project explorer (on the left of the main SDK windows) and hit Re-generate BSP sources. These are common xilinx SDK errors, not specific to this project.


  4. Hi @daeroro,

    #define SPI_DEV    "/dev/spidev32766.0" 

    Judging by the .dtsi this should be something else... probably something like spidev1.0. You will need to change to the right device name. To determine which is the right name please run

    ls /dev/ | grep spi

    on the running petalinux target.


  5. Hi @Sduru,

    In order to see data transfers on the AXI-Stream interface which is connected to the PCAM you will need to configure the PCAM and enable the DMA transfers to do so. This is accomplished using the SDK, therefor you will need to program and monitor the ILA as well as run the SDK program to see any changes on the ILA. I'm guessing that you have a problem with running the code which would explain why you don't see the menu on the console  or any traffic on the ILA.

    I'm guessing that your terminal is set up properly (although using COM1 is unusual), because you mentioned that you ran a hello world project and it displayed the message on the terminal, which leaves us with the possibility that you either have an error running the code  in SDK or that there is a bug which does not allow you to get to the menu part of the PCAM code.

    To test this please put a xil_printf("hello world\n"); at the beginning of the main function and check if it is displayed.


  6. Hi @ahmedengr.bilal,

    Like I mentioned in the previous post there is no HDMI output from the Linux side, neither the embedded rootFS provided by petalinux nor the kernel configuration we give out is set to accommodate this feature.

    Regarding the missing media-ctl and v4l2-ctl, you have not activated the v4l-utils in the rootfs configuration of the petalinux. to do this you need to navigate to your petalinux project folder and run:

    petalinux-config -c rootfs

    Once the menu appears you need to go to Filesystem Packages->misc->v4l-utils and activate: v4l-utils, libv4l, media-ctl. Rebuild the whole project and it should be working now.


  7. HI @osmaan_khan,

    To clarify on xillybus and XADC, we have never configured the design which they provide, therefore we don't know how to add the XADC IP to it and interface it with their linux kerne and rootfs.

    Regarding the VCC and the GND pins, the PMOD connector JA can be configured as XADC or can be used as a simple PMOD connector (following the PMOD standard you need VCC and GND), when using it in a XADC configuration the VCC and the GND can be ignored.

    All the information on how the XADC works, configurations and limitations can be found in ug480 form xilinx. For instance, you cannot measure a voltage grater 1V using the XADC, you will have to scale your voltage in order to measure it with the XADC (maybe use a voltage divider, it depends on you circuit).

    The XADC is a Xilinx IP which is configurable both from the IP configuration window in Vivado and trough some registers using the AXI-Lite interface, with a xilinx kernel you should have access to it if the XADC driver is active in the kernel and if the .dts is configured to include the IP. We cannot help you with this, unfortunately; you will have to ask the support team from xillybus about how to manage this.

    - Ciprian

  8. Hi @flying,

    There is a lot to unpack here.

    Firstly I would like to draw your attention to the fact that this post was originally started by malkauns regarding the porting of the petalinux project with PCAM capabilities to the Zybo Z7-10 board, very similar to a previous topic which you have started. If you follow the steps in the previous post by vicentiu you should have the HW configuration finished by vivado, and then all you need to run is:

     petalinux-config --get-hw-description=<PATH-TO-HDF-DIRECTORY>
     petalinux-package --boot --force --fsbl images/linux/zynq_fsbl.elf --fpga images/linux/system_wrapper.bit --u-boot

    In the Petalinux-Zybo-Z7-20 project and you should have everything working the way it's described in the projects readme.

    Secondly (although off topic), regarding the "the "desktop" of the Petalinux.", our petalinux project so far has no GUI in the FS(file system) therefore you will not be able to see anything on the HDMI display. The HDMI is currently configured as a pass trough, in the petalinux project, at 720p; which means everything that is sent via the HDMI RX connector is forwarded to the HDMI TX connector without processing. All of this is routed trough the FPGA, meaning that without programming the .bit into the FPGA, the HDMI will not work. For more details on this please refer to the block diagram of the Zybo-Z7-20-base-linux which is an intuitive description of what I explained here.

    Lastly, regarding the rest of the questions (also off topic), most are answered by reading trough the petalinux user guide ug1144 which describes how petalinux works and the workflow. I would also recommend reading up on how the Zynq processor is used in bare-metal and the role of the ps7_init files, the .bit, the .hdf and the BOOT.bin.Unfortunately going in to detail about these, would be hard without making it in to a tutorial or a step by step guide with page long explanations at every step.

    I hope this helped clarify some of your queries.


  9. Hi @fangzr,

    It seems to me that you teacher has asked you to write a kernel driver from  scratch (more or less) for a wireless module. Depending on what he expects the driver module to contain, you could either write only the driver for the module it self (RTL8812au for example) or the module and the corresponding dependencies which will make development very hard because you will need to integrate a lot in to the kernel.

    I have unfortunately no experience with WiFi kernel driver development, but I would take it one step at a time. Starting with understanding kernel drivers and what their role is and then looking over the WiFi kernel interface, you can read about this here, understanding the structure of it and then starting to write my own driver by looking at already existing one (RT3070 for example). I would also recommend to read about the various forms of kernel debugging like KGDB and how to do that or Xilinx has a brief step by step "tutorial" here about using Xilinx SDK for kernel debugging.

    It's no an easy task, Good Luck.


  10. Hi @fangzr,

    I am not familiar with RTL8812au, but I managed to set up a ath9k dongle driver for the Zybo Z7-20 with petalinux. For the ATH9K it's easier because it has the driver in the kernel you just need to activate it. Regarding the RTL8812au all I can tell you from experience is that some Wireless dongles need additional firmware, like the ATH9K, which will be loaded in to the wireless automatically over  USB, provided you set up your USB port to identify mass storage devices. These should be copied in to the corresponding folder on the rootfs of your target.

    Another critical issue is the driver dependencies, some Wireless drivers need to have certain Kernel drivers loaded in order for them to work, like the MAC80211 stack in the Kernel for instance. Please make sure that your driver is not depended on anything else. Based on the log you have sent us, I would start with this.


  11. Hi @Mingfei,

    If you are referring to Arty-Z7-XX-hdmi-out, where XX is either 10 or 20, demo then you  have series of solutions to make it work faster.

    Before I go in to detail regarding this let's talk a bit what the demo actually does. It basically reads one frame (dispCtrl.framePtr[dispCtrl.curFrame]) and then takes every pixel and inverts it in to the output frame (dispCtrl.framePtr[nextFrame]) this is a software approach (based on how DemoInvertFrame() is written) which means that it will depend on the processor how fast it can manage the data. Therefor stuff like printing text on the console (like printf("Volage.....)) will slow it down. As for the solutions there are 2 way to try and speed it up:

    1. Software, VDMA has a feature called frame buffer parking you can read all about it in the User Guide (PG020 for v6.3), it basically parks the output frame on one buffer and lets you edit the other 2 frames without interrupting the video out stream. This will increase your out put to 50 fps but the refresh rate of what you want to do, the actual processing, will still only work at 5 frames.

    2. Hardware, you could take advantage of your FPGA and write a IP core which does the inversion in HW thus offloading the task from the processor and getting to almost no processing delay; this of course means you will have to redesign your project. I would recommend writing the IP in HLS because it's easier and placing it at the output stage be teen the VDMA and the Subset Convertor.


  12. Hi @AndyCap,

    Unfortunately I don't have the time to look in to this but judging by what you said


    I have checked that the issue is not a general alsa issue by setting up a gadget usb audio device to send over USB, this doesn't have the same issue. 

    I would look in to the IP driver of the audio system <kernel>/sound/soc/adi/axi-i2s.c (as far as I remember), how the buffers are handled in regards to the DMA transfer. The issue might be that full and the empty flags are nor properly handled in the driver or in the HDL IP.

    Sorry for not being able to help more.


  13. Hi,

    We are planning to update our project to 2018.3 but we don't have a precise release date for it yet. If it's not mandatory to use 2018.3 please stick with 2017.4 with this project for the time being.


  14. Hi @Kris Persyn,

    It depends on how you manage your resources, driving immersive visuals on a HDMI display can be done in multiple ways at different resolutions, some are PL taxing others are DDR taxing; you could generate entire frame buffers in PL or PS or you could find a optimal algorithm to change just the previous frame or you could allocate a high number of frame buffers and then run them in a loop.

    It also depends on how math lab synthesizes the IP you will need to add to your design.

    If you design your project properly and don't aim for a resolution higher more 720p( I'm being conservative, we managed to drive the HDMI at 1080p with processing filters without a problem)  I think it should be enough for what you want to do, resource wise.

    My suggestion, download and install Vivado, download and install the board files, create and implement your project look at the resource consumption and then buy a board.

    - Ciprian

  15. Hello @Gourav,

    Unfortunately the issue could be in multiple locations and it's hard to determine this from the block diagram, it's probably a small bug either in the block design or in the HLS IP.

    Either way please send the archive with project so that I can look over it.

    Thank you


  16. I'm not sure about this but I would look in to the HPD signal, as far as I know in the Nexys Video demo is set up so that the HPD is a pass-trough signal which might interfere with the zybo z7 design. I will ask our colleague who has more experience in HDMI if he has some input regarding your question.


  17. Hi @Amin,

    It depends on what you are planning to do. If you only need a Linux running on your Zybo Z7-20, then I can give you our pre-build BOOT.bin, kernel+rootfs images. This approach is based on our Demo HW platform, you will have the benefit of a lot of IPs in the design which allows a very versatile approach to the board, unfortunately this will not allow you to add any new IP to the design.

    If you want to build you own platform and base the on board Linux on it then you will need to install petalinux on linux(I recommend Ubuntu) and build/customize it the way you want, @jpeyron sent you the links for this in the previous post.


  18. Hi @kotra sharmila,

    Please follow the steps provided in this read me to modify/create your project.

    Please kkep in mind the following NOTE at step 12


    12. Select a sample application to run and click finish to create the project.

    *NOTE* When creating a project that uses xfopencv, it is best to always use a sample project as a starting point. The source files can be replaced with the new project's source. This is because the sample project sets up a lot of build settings like include paths, libraries, and symbols that are required for the libraries to build.

    - Ciprian