High-speed GPIO - maximum frequency



  • Hi,

    May someone share the maximum supported and the max. stable frequency of the high-speed GPIO module (FPIOA)?



  • @vmetodiev

    You should do something like this:

    #define PIN_OUT 25
    #define GPIO_OUT 3
    
    // configure pin
    fpioa_set_function(PIN_OUT, FUNC_GPIOHS3);
    gpiohs_set_drive_mode(GPIO_OUT, GPIO_DM_OUTPUT);
    
    // the pin is now accessible via gpiohs_t structure
    
    volatile gpiohs_t* const gpiohs_pins = (volatile gpiohs_t*)GPIOHS_BASE_ADDR;
    
    // there are 32 gpiohs pins, each accessible via coresponding bit in 'output_val' or 'input_val' registers
    // we are using GPIOHS3, so bit #3 must be set or reset to set the pin hi or lo
    
    // set the pin Hi
    uint32_t org = *gpiohs_pins->output_val.u32) | (1 << 3);
    *gpiohs_pins->output_val.u32 = org;
    
    // set the pin Low
    uint32_t org = *gpiohs_pins->output_val.u32) & ~(1 << 3);
    *gpiohs_pins->output_val.u32 = org;
    
    

    You can toggle the pin in loop, but as I've sed it is better to do it using, for example, the PWM peripheral.



  • @loboris said in High-speed GPIO - maximum frequency:

    @vmetodiev
    But you can drive the pin by directly accessing the registers

    Hi, @loboris , thanks a lot for the insight!

    May you please help me which register exactly is in charge of the frequency selection - so that I can try to set it at 50-100MHz?



  • @vmetodiev
    It depends on frequency generator software implementation.
    If you are using SDK provided HS gpio driver, if I remember well, you can hardly get frequencies above 1 MHz, the driver uses to much instructions between actually switching the pin state. But you can drive the pin by directly accessing the registers, in which case you can get much higher frequencies (~10 MHz, tested, maybe up to 100 MHz, not tested).
    You can also use other peripherals, like PWM or SPI, to generate the frequencies up to 100 MHz (tested).