AnsweredAssumed Answered

GPIO toggle gets interrupted

Question asked by Arvind Prakash on Mar 28, 2019
Latest reply on Mar 29, 2019 by Arvind Prakash

Hi,

We are using custom IMX6 board. We have a requirement of toggling a GPIO line at higher speed. We are using the the following code

 

   volatile u32 *gpio_base_addr = (u32) ioremap_nocache(GPIO_ADDR,32);

   spin_lock(&gpio_spinlock);
   gpio_high_val = readl(gpio_base_addr) | 0x200;

   gpio_low_val = readl(gpio_base_addr) &  0xFFFFDFF;

 

   gpio_base_addr = gpio_high_val;

   gpio_base_addr = gpio_low_val;

                    ...

                    ... for 20 times

                    ...

   gpio_base_addr = gpio_high_val;

   gpio_base_addr = gpio_low_val;

          

   spin_unlock(&gpio_spinlock);

 

We are able to get the twenty toggle cycles most of the time. Sometimes we are not getting the full toggle cycles, the line simply remains low  after 10 to 15 toggles. We want the complete cycles all the time.

We are using the GPIO (3, 14) and disabled the drivers which are using GPIOs from the bank 3 in the DTS, but still it gets interrupted.

 

Thanks,

Arvind

Outcomes