Re: SAME70 GPIO latency

punit vara <punitvara@...>

Hi Jiri,

Welcome to awesome zephyr community. 

On Thu, Aug 9, 2018 at 11:46 PM Jiří Kubias <jiri.kubias@...> wrote:

Im new to Zephyr and Im trying to measure the GPIO handler latency. I have modified the samples/basic/button example to toggle LED pin when the handler rises. The test is to measure the time between input pin change and output pin change. I have measured maximal value about 3us and typical about 2.6us. The processor is SAME70 @ 300MHz so 3us is 900 instructions - why it took so long? It should be in tenth of ns.  Do I have correct approach or am I doing something wrong?  I have checked the sensor drivers and they are using the same workflow. 

The handler code is 

void button_pressed(struct device *gpiob, struct gpio_callback *cb, u32_t pins) 
   gpio_pin_write(dev, LED, cnt % 2);
   printk("Button pressed at %d\n", k_cycle_get_32()); 

k_cycle_get_32() prints cycles.

Use k_uptime_get(). Follow this to measure time : 


Best regards,
Jiri Kubias

- PV 

Join { to automatically receive all group messages.