X4 Problems reading data when using freeRTOS(FPGA+SoC)

Discussion in 'X2 & X4 SoC' started by anmeichen, Jul 10, 2019.

  1. anmeichen

    anmeichen New Member

    Referring to the Raspberry Pi driver X4M05 example (https://github.com/xethru/X4Driver_RaspberryPi_Example), I tried to use the ZYNQ7020 with the freeRTOS system driver X4M05, and wanted to get a higher FPS (using the Raspberry Pi up to 2Khz).
    After a long period of hard work, I put the x4driver_data_ready() function in the while(1) loop to implement the 5.7Khz FPS(set Radar fps =6Khz). Although there is data readout, it seems that the data is very invalid because the GPIO interrupt is not used to trigger the call of the function x4driver_data_ready() .
    Related parameter settings:
        int xgl_iter = 8;
        int xgl_pulsestep = 1;
        int xgl_dacmin = 949;
        int xgl_dacmax = 1100;
        xtx4_dac_step_t xgl_dacstep = DAC_STEP_1;
        float xgl_fps = 6000;
    Question 1:
    Then I tried to add the interrupt function to achieve, first through the key interrupt can trigger the interrupt service function x4driver_data_ready (), but when I connect this IO port to X4M05, why is there no interrupt signal generated?

    In order to avoid the above problem (not solve), I directly read the IO port level to judge, the code is as follows (not sure if this is good), but the waveform is very good, the data is correct, but the FPS becomes 3Khz.
    for (;;)
            task_int[1] = task_int[0];
            task_int[0] = XGpioPs_ReadPin(&GPIO_PTR, 11);
            if(task_int[0] && ~task_int[1])
    Question 2:
    Maybe question 1 is not easy to solve and explain, at least I don't know how. But I noticed XEP source (https://www.xethru.com/community/resources/xep-source.90/) .In this project (also based on freeRTOS), it seems that there is no interrupt reading data, could you please tell me how to understand this code or to avoid using interrupts to reach 5Khz (it should be reached)?
    for (;;)
            // TODO: Check if radar communication is OK
            status = monitor_task_alive(monitor_task_handle);
            if (xt_get_operation_mode() == XT_OPMODE_CERTIFICATION)
                cert_mode = radar_certification_handler(x4driver);
            xTaskNotifyWait( 0x00,      /* Don't clear any notification bits on entry. */
                             0xffffffff, /* Reset the notification value to 0 on exit. */
                             &notify_value, /* Notified value pass out. */
                             500 / portTICK_PERIOD_MS );  /* Block indefinitely. */
            if (notify_value & XEP_NOTIFY_RADAR_DATAREADY)
                // Radar data ready
                if(x4driver->trigger_mode != SWEEP_TRIGGER_MANUAL)
                    read_and_send_radar_frame(x4driver, dispatch);
            else if(notify_value & XEP_NOTIFY_RADAR_TRIGGER_SWEEP)
            else if(notify_value & XEP_NOTIFY_X4DRIVER_ACTION)
            else if (notify_value == 0) // Timeout
    Last edited: Jul 10, 2019
  2. Charlie Shao

    Charlie Shao Moderator Staff Member

    Hi anmeichen,
    I suggest you transplant XEP directly to your development platform. Atmel SAM MCU is much similar with ZYNQ ARM SoC than RPI running raspbian. XEP checks the flag in register to decide if data is ready instead of using ISR.