Support for the HX711 load cell sensor chip has been requested a number of times already. I have written a preliminary module which is able to read out data from the HX711. It works without modifying the MCU code, but there is a catch: It does not obey the specifications in the HX711 data sheet.
The HX711 has a unidirectional SPI-like interface with a clock and a data bin. The host is expected to read 24 bits after the HX711 has send a data ready signal by pulling the data pin to low. After the transfer, it should send 1-3 additional clock signals to configure the gain for the next conversion.
My module simply reads 32 bits periodically (currently with ~10 Hz, as my HX711 module is configured to that frequency apparently). The additional clock signals seem to be ignored (although the data sheet explicitly mentions to send no more than 27 clock pulses per conversion interval). The gain will then presumably fixed at 64 (lowest setting).
More problematic is actually ignoring the data ready signal. With a logic analyzer I have found that the HX711 actually revokes the data ready signal if the data has not been read out before the end of the conversion interval. If the host attempts to read the data during that time it probably will read simply -1 (all bits high).
Another issue is that the SPI implementation in Klipper seems to expect always all 4 pins to be configured.
Anyway, this is a first starting point I wanted to share with the community. Maybe some people have ideas how to improve this without the need for special microcontroller code (which in principle would be fine for me, but I think it would be nice to avoid it).
So my first goal to improve this would be to read out the data ready signal. Is it possible to read out a pin which is configured as a soft-SPI MISO pin in addition as a plain GPIO input pin? If yes, is it realistic to poll this pin with a frequency (much) bigger than 80 Hz (the fastest possible HX711 read out frequency) and react to it in time with initiating a transfer?