Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Sep 2021 19:19:41 +0300
From:      Andriy Gapon <avg@FreeBSD.org>
To:        Emmanuel Vadot <manu@bidouilliste.com>
Cc:        arm@FreeBSD.org, Emmanuel Vadot <manu@freebsd.org>
Subject:   Re: rk_gpio: high latency switching between input / output
Message-ID:  <5b3a2e6b-dd1f-59a5-d372-6e9ebe12200d@FreeBSD.org>
In-Reply-To: <20210923091821.dd92732fa44d30f94a9415b1@bidouilliste.com>
References:  <4472ded5-1815-e7c0-0238-efd6935062e0@FreeBSD.org> <20210923091821.dd92732fa44d30f94a9415b1@bidouilliste.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 23/09/2021 10:18, Emmanuel Vadot wrote:
> 
>   I've made some tests on my rock64 board.
>   The program I used [1] is, I think, the worst possible scenario that
> can happen as it :
>   - Set the pin to output
>   - Toggle the pin
>   - Set the pin to input
>   - Read the pin
>   - Set the pin to output
> 
>   With it I get a ~30khz signal produced on the pin.
> 
>   I did some change to rk_gpio [2], those changes are :
> 
>   - Cache the pin info (gpio or not) and flags (pullup/pulldown)
>   - Remove useless reads for the pin direction and value when we're
> setting or toggling the pin (so output mode only).
> 
>   With this and the same program I manage to have a ~50khz signal output
> on the pin.
>   I'm not sure I can get higher result for now.
> 
>   All test where done on main (c96da199458) with GENERIC kernel.
>   Obviously you will have better result for kernel operation but I
> choose to do userland to have the worst case possible.
> 
>   Let me know if this helps you in your case, otherwise I'll hookup some
> 1wire temp sensors and try to make them work while the scope is still
> plugged on the board.
 >
>   1: https://people.freebsd.org/~manu/rk_gpio/gpio_test.c
>   2: https://people.freebsd.org/~manu/rk_gpio/0001-arm64-rockchip-rk_gpio-Improve-mode-switching.patch
> 

Thank you very much!
1-wire works reliably for me with your patch.
Hope to see it committed soon.


-- 
Andriy Gapon



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5b3a2e6b-dd1f-59a5-d372-6e9ebe12200d>