2024-10-23 08:38 AM - edited 2024-10-23 08:44 AM
I have two active ADCs with many channels reading, some in regular converison, some injected, etc.
The code is autogenerated from MC Workbench, but I added a channel 11 for an external potentiometer.
I don't really know in the autogenerated files where the other ADC channels are read, and in addition to reading those channels, I should also read channel 11.
I ask you if this code is sufficient (in the main.c) to read also from ADC1 and channel 11:
there is the error: ADC_HandleTypeDef has no member named rank
Maybe I should add these lines of code where the other channels are also read? ..to avoid two HAL_ADC_ConvCpltCallbacks in the project.
I kindly ask you how to solve (I think bases a simple line of code that unfortunately I do not know)
Thank you.
2024-10-23 08:42 AM
Since the code was autogenerated from MC Workbench, the thread was moved to STM32 MCUs Motor control forum.
2024-10-23 09:26 AM
Hello @luke514,
If you are using B-G431B-ESC1 board, why not taking the advantage of enabling potentiometer feature through Workbench>Stage Configuraton>Potentiomer? ADC1_IN11 input is used, and capture is done via RCM_ExecRegularConv() function call.
2024-10-23 09:45 AM
I used it when I selected a speed control.
In the case of torque control, I think it can not be used to vary the motor torque .. in fact during the debug nothing happens during its rotation. Am I wrong?
If I am wrong and there is the possibility to activate it also with the torque control .. my question remains the same because I have always read channels simultaneously, but now I would like to know how to read one of the many initialized ones.
That's why I asked the question in the main thread and not in the specific one for Mc workbench, because in my opinion the question is of a general nature and is independent of the fact that I used Mc workmage to generate the code.
2024-10-28 08:05 AM
Hello @luke514,
You are right, potentiometer is fully speed control oriented, and we do not plan to add this feature for the moment.
Based on current provided FW potentiometer, you can extend SPDPOT_Run() function to handle MCM_TORQUE_MODE as STC_ExecRamp() function handles this control mode.