SAME70 GPIO latency


Jiří Kubias <jiri.kubias@...>
 

Hi,
I measuring the time via oscilloscope - then the time measurement is independent on zephyr time. The printk is just for info. 

Best regards,
Jiri Kubias

2018-08-09 20:31 GMT+02:00 punit vara <punitvara@...>:

Hi Jiri,

Welcome to awesome zephyr community. 

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

Hi,
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);
   cnt++;
   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 : http://docs.zephyrproject.org/kernel/timing/clocks.html 


}

Best regards,
Jiri Kubias

_._,_._, 
._,_
- PV 
._,_pk




--
===================================================
Ing. Jiri Kubias
 
e-mail: jiri.kubias@...
mobile: 775 593 956
===================================================


punit vara <punitvara@...>
 

Hi Jiri,

Welcome to awesome zephyr community. 

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

Hi,
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);
   cnt++;
   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 : http://docs.zephyrproject.org/kernel/timing/clocks.html 


}

Best regards,
Jiri Kubias

_._,_._, 
._,_
- PV 
._,_pk


Jiří Kubias <jiri.kubias@...>
 

Hi,
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);
   cnt++;
   printk("Button pressed at %d\n", k_cycle_get_32()); 
}

Best regards,
Jiri Kubias