cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103C8T6 - GPIOA ports would not change when using HAL_GPIO_WritePin()

CSand
Associate III

Hi ,

I'm working on a code to collect data from a load cell wit HX711 cip. I'm using STM32CubeIDE.

I configured GPIO pin 6 as Clock output for the HX711 but when calling HAL_GPIO_WritePin the output pin PA6 does not change.

The hardware configuration is set in CubeMX .

CSand_0-1702503859400.png

I'm not even sure what information to provide.

I reduced the code to only couple of lines ...

 

CSand_1-1702504563854.png

I am writing code in C++ so I have a call of appMainC() that is declared as "extern C" as main() for my code. This may not influence our issue but I added it just for clarity.

CSand_2-1702504656577.png

And I also have the timer ElapsedCallback function call ..

CSand_3-1702504792009.png

I have changed 3 bluepill boards as I expected is a HW issue of the board but it the issue is the same on all 3.

I also tried by setting outputs PA3 ... PA6 as pull-up but I still measured 0V on the outputs with the oscilloscope.

Can anyone help with some idea on what could cause this issues? Or if I'm setting something wrong?

I can provide any additional information ... this seem so basic I don't know what to ask?

 

Best Regards,

Cristian

 

4 REPLIES 4

The pin is conflicted?

The pin you're probing isn't the one you think it is?

Check registers at a peripheral level, that the GPIO bank clock is enabled, that the pins are properly configured. Dig deeper into the code that's actually doing the configuration, the top level code is superficial 

>>I have changed 3 bluepill boards as I expected is a HW issue of the board but it the issue is the same on all 3.

Or the HW is built consistently?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Well I'm not sure I'm able to go that level. I was able to trace where the code is enableing the RCC APB2 but there are many #defines ...

I also look to find on the web a way to set GPIOA in using ASM but could not find. In that case I would remove the code below with ASM ...

CSand_0-1702545084787.png

 

 

Read out and check/post content of GPIOA registers.

JW

Karl Yamashita
Lead III

More likely a HW issue as the bluepill works fine toggling PA6 on my end. 

Show the schematic circuitry on how you've connected the Bluepill to the HX711

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.