I’m working on interfacing an HX711 with a Jetson Nano 2GB dev kit (the eventual application will interface with a Xavier NX, but just proof-of-concepting things here). This is my first time working with the Nano and for a start, I’m just trying to do the same thing I did on a Raspberry Pi (and an old RPi at that - I think it’s a model 2?).
I’m using a Python library ( GitHub - gandalf15/HX711: Read HX711 ADC for Weigh Scales on Rasperry PIs. ) which interfaces using the RPi.GPIO interface - which I was pleased to see is emulated by the Jetson GPIO interface. I was able to successfully toggle some of the pins on the Nano (including the pins which I’m using) with Python.
When I use the HX711 library, however, it’s unable to communicate with the HX711 device, because it’s not able to toggle the GPIO fast enough (an operation which works fine on the Pi). In specific, the clock pin can’t stay high for more than 60us (ie, 0.00006s) or else the HX711 shuts down - and according to the debug timing in the lib I’m using, it takes on the order of 2ms(!) to toggle the clock pin on this Jetson Nano 2GB dev kit.
Is this expected? If I rewrite the pin toggling in C and use the sysfs
interface for GPIO, can I expect better performance, or do I have to write a kernel driver for this?
Thanks,
+j
hello riz-nvidia,
may I know what’s your expectation,
you need to program the GPIO via kernel level to have better performance,
thanks
My expectation was that it would yield similar performance to a six-year-old Raspberry Pi. (Where, as I said, this does toggle in under 60us)
What you seem to be saying, though, is a userspace driver (even written in C) is not going to work on the Nano?
hello riz-nvidia,
please refer to GPIO Bit-Bang Speed Increase - #23 by Bibek,
please have a try to increase clock rate to get better results.
thanks
I looked there, but the suggestion
root@tegra-ubuntu:/sys/kernel/debug/bpmp/debug/clk/axi_cbb# cat rate
115200000
…doesn’t work on this Nano because there’s no “bpmp” node in /sys/kernel/debug:
riz@jetson-nano:~$ sudo ls /sys/kernel/debug/
57000000.gpu iio pwm tegra_gpio
57000000.gpu_scaling isp ras tegra_hdmi
70006040.serial isp.1 regmap tegra_host
70006200.serial ixgbe regulator tegra_la_ptsa
7000d400.spi mc sdhci-tegra.0 tegra_latency
7000d600.spi memblock sleep_time tegra_mipi_cal
70019000.iommu mlxsw_core soctherm tegra_pinctrl_reg
asoc mmc0 split_huge_pages tegra_sor1
bdi msenc suspend_stats tegra_throttle
bluetooth nvdec sync tegra_vi
clk nvjpg system_states tegra_xhci
cpuidle_t210 nvlink tegra-pmc-io-pads tegradc.0
debug_enabled nvmap tegra-rtc tracing
dma_buf opp tegra_bwmgr tsec
dri pcie tegra_camera_platform tsecb
dynamic_debug pg_domains tegra_central_actmon usb
extfrag pinctrl tegra_denver vi
fault_around_bytes pm_genpd tegra_dfll_fcpu vic
gpio pm_qos tegra_dvfs virtio-ports
gpu.0 pmc-reset tegra_ec wakeup_sources
hid powergate tegra_emc
I’d be happy to try bumping some clock rate as long as I know which one.
hello riz-nvidia,
oh, that axi_cbb
is only available for TX2 series.
please refer to this example, https://raw.githubusercontent.com/jwatte/jetson-gpio-example/master/gpiomem.cpp
you may have a try for using mmap
to have faster speed.
thanks