trying to interface with an HX711 load cell amp
The HX711 requires the MCU to send an exact number of clock pulses to capture a 24 bit value, then the clock signal must remain low until the HX711 indicates its ready to transmit again, using the data line. I tried to use a GPIO pin to generate the clock signal manually with pin_set and pin_reset calls, which works in that it creates a clock signal at the frequency of the APB, but the amplitude is only 100 mv. When I plug the clock signal into the HX711 the signal becomes low level noise. Here is the pin config:
/*Configure GPIO pin : SCLK_Pin */
GPIO_InitStruct.Pin = SCLK_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(SCLK_GPIO_Port, &GPIO_InitStruct);and here is the clock gen code:
// read 24 data bits
for (i = 0; i < 24; i++) {
HAL_GPIO_WritePin (SCLK_GPIO_Port, SCLK_Pin, GPIO_PIN_SET);
buffer <<= 1;
HAL_GPIO_WritePin (SCLK_GPIO_Port, SCLK_Pin, GPIO_PIN_RESET);
buffer += HAL_GPIO_ReadPin (SDATA_GPIO_Port, SDATA_Pin);
}I should be getting a 3.3V clock signal. Any suggestions?
