AnsweredAssumed Answered

How to toggle low voltage GPIO in AD9371 with delay of 1us.

Question asked by Abhisheknaik on Mar 31, 2017
Latest reply on Apr 17, 2017 by gverma
Hello Everyone,
         I am trying to implement a user space application in Xilinx ZC706 for initializing and configuring AD9371. I am refering to headless.c for developing this application and i'm using ug-992 document for understanding and implementing MYKONOS_API. I have registered AD9371 as spidev device in devicetree.dtb file and i have doing spi read and write using ioctl functions.
          Now i want to toggle low voltage GPIO pin in transceiver with 1 mirosecond delay(i.e TON = 1us and TOFF = 1us).. Following is my piece of code for toggling GPIO_9 on trnsceiver board.
Data structure for low voltage GPIO
static mykonosGpioLowVoltage_t gpio =
524287,/* Oe per pin, 1=output, 0 = input  Setting all GPIO as OUTPUT*/
GPIO_BITBANG_MODE,/* Mode for GPIO[3:0] */
GPIO_BITBANG_MODE,/* Mode for GPIO[7:4] */
GPIO_BITBANG_MODE,/* Mode for GPIO[11:8] */
GPIO_BITBANG_MODE,/* Mode for GPIO[15:12] */
GPIO_BITBANG_MODE,/* Mode for GPIO[18:16] */
Within main function in headless.c
if ((mykGpioErr = MYKONOS_setupGpio(&mykDevice)) != MYKONOS_ERR_GPIO_OK)
           /*** < Info: errorString will contain log error string in order to debug failure > ***/
           errorString = getGpioMykonosErrorMessage(mykGpioErr);
           printf ( "Setup Gpio fail\n") ;
while (1) 
                    MYKONOS_setGpioPinLevel( &mykDevice, 0x00600 ) ;
                    CMB_wait_us( 1 ) ;
                    MYKONOS_setGpioPinLevel( &mykDevice, 0x00000 ) ;
                    CMB_wait_us( 1 ) ;
Delay function for milliseconds
commonErr_t CMB_wait_ms(uint32_t time_ms)
                    /* nanosleep can be interrupted, if so, call until total time has completed */
                    struct timespec t0;
                    struct timespec t1;
                    struct timespec *temp;
                    struct timespec *waitTime = &t0;
                    struct timespec *remaining = &t1;
                    waitTime->tv_sec = time_ms/1000;
                    waitTime->tv_nsec = (time_ms % 1000) * (1000000);
                    while((nanosleep(waitTime, remaining) == (-1)) && (errno == EINTR))
                            /* if nanosleep returned early due to a interrupt, nanosleep again using remaining time */
                            temp = waitTime;
                            waitTime = remaining;
                            remaining = temp;
Delay Function for microseconds
commonErr_t CMB_wait_us(uint32_t time_us)
                    return(CMB_wait_ms( time_us / 1000));
           But when I probe gpio_9 pin to oscillscope.. I am seeing that TON and TOFF are of 200 microsecond (instead of 1us). Why it is so? What I have to do to get TON and TOFF of 1 microsecond?
           Please help me out with this. This is very urgent as I am planning to use these gpio for spi bit banging for control some other spi slave.
Thanks and Regards,
Abhishek Naik.