HX711 adc read functions gives different accuracy
Both functions appear to work essentially identically, except for how bits 31:24 are handled - but I do not think this is your issue.

You did not specify which Arduino you were using though, and since shiftIn is a simple bit-banging function it will run att different speeds depending on what processor and speed you are working with, so if you are using an Uno or something even slower this will limit the resulting clock frequency to the HX711. Also, it internally uses digitalWrite/Read, which are notoriously slow, further limiting the frequency.

The same set-up is true for your STM32F1 function - it does bit-banging without timing. However the STM32F1 may be considerably faster than your Arduino and you are using HAL functions which typically get optimized very well, not unlikely to a single instruction. This should result in an SPI frequency considerably higher than the Arduino equivalent.

My guess is that it is so fast that it does not conform to the timing specifications of the HX711, leading to data corruption.

If this is the case, introducing hard delays after each WritePin call would slow things down and let you verify whether or not this is the issue. Something like for(volatile uint32_t n = 0; n &lt; (DELAY); n++); should do the trick (volatile prevents the delay from being optimized out).

You should measure (using a scope or logic analyzer) the resulting signals to verify that they are within specification.

I assume you cannot use the SPI peripheral for some reason, but if you can - that is a much better solution.