cancel
Showing results for 
Search instead for 
Did you mean: 

Configuring Peripheral ADC Issue

Vincent7
Associate III

Hello Everybody,

MCSDK:6.3.0

CubeMX: 6.3.0

Workbench : 6.3.0

CubeIDE : 1.15.0

I encountered an issue after generating FOC code using Workbench v6.3.0.
I then used CubeMX to configure PB15 as ADC2_IN15 to read the torque sensor voltage.
However, after regenerating the code in CubeMX, I observed two problems:

1) The configuration for ADC2_IN15 was not automatically generated by CubeMX. I had to manually set it up. Is this expected behavior?

2) During initialization, I first measured PIN PB15 using a multimeter, and its voltage level was 0.7V (which is the correct baseline voltage for the torque sensor).
However, once the program executes MX_MotorControl_Init();, this pin is pulled up to 3.3V.
I checked Workbench, and this pin does not appear to be used by the FOC configuration.
How can I resolve this issue? Please help me...

Note: In the FOC code generated by Workbench, ADC2 uses injection mode, while the additional ADC I configured uses regular mode.

3 REPLIES 3
ahsrabrifat
Associate III

Even if PB15 is not explicitly shown in Workbench, the FOC firmware might still be using it for internal purposes, such as debugging, GPIO triggering, or an alternate function. In Workbench, double-check that PB15 is not assigned to any function (even indirectly).

 

TDK
Guru

Check the GPIOB registers to see what PB15 is configured as. If it's configured as something, find out where in your code it's being configured. Stepping through can help to locate this.

If you feel a post has answered your question, please click "Accept as Solution".
Vincent7
Associate III

Hello ahsrabrifat and TDK

Thank you guys for providing the clues. I will check the code again, and if I find a solution, I will share the cause of the issue. I really appreciate the direction you provided! I originally thought that the generated FOC code, if not visible in CubeMX, should be customizable by the user.

Once again, I really appreciate you all.