cancel
Showing results for 
Search instead for 
Did you mean: 

ADC not working with NUCLEO-G431RB.

msingh
Senior

NUCLEO-G431RB + X-NUCLEO-IHM07M1

MCWB 5.Y.3 + STM32CubeIDE 1.7.0

Maxon motor combination: 200142 + 166935 + 673026

I have created a project to drive a BLDC motor with the above mentioned equipment, I was able to create a basic project to drive the BLDC very quickly because of the knowledge gained from the F303RE+IHM07M1 combination. I have then cried to use the same method to achieve ADC however I was not able to do so. Attached is the main.c file from my project, the ADC code present in this file is the same as in the other project with the only difference of using ADC2 instead of ADC1 and the timing of the conversion.

Thanks in advance

Kind Regards

Manpreet Singh

1 ACCEPTED SOLUTION

Accepted Solutions

Thanks for replying. I had forgotten to update this thread. I have found the issue. In my code I have the following

PotentiometerConv.channel = ADC_CHANNEL_14;

this needs to be changed to:

PotentiometerConv.channel = MC_ADC_CHANNEL_14;

After this change it works perfectly fine.

Kind Regards

Manpreet Singh

View solution in original post

3 REPLIES 3
msingh
Senior

Additional information:

I have tried changing the sampling time but still couldn’t get the correct ADC value. When the conversion time is set to ADC_SAMPLETIME_640CYCLES_5 I am not able to do get passed the alignment status while any other conversion time has the following result.

RCM_RequestUserConv true

RCM_GetUserConv 0

The function RCM_RequestUserConv returning “true�? means the conversion is registered successfully, however when the conversion finishes the output is always 0. Would you be able to suggest something?  (I have checked I am using the correct hardware pin, PB11 on CN10 pin 18)

Philippe Cherbonnel
ST Employee

hello @msingh​ ,

Your code in attached file seems correct.

The issue is probably somewhere else.

Can you try to run examples in STM32G4 FW package:

...\Firmware\Projects\NUCLEO-G431RB\Examples\ADC

By customizing the example (change of ADC channel and GPIO, change ADC feature, ...) you should keep a functional setup.

Best regards

Philippe

Thanks for replying. I had forgotten to update this thread. I have found the issue. In my code I have the following

PotentiometerConv.channel = ADC_CHANNEL_14;

this needs to be changed to:

PotentiometerConv.channel = MC_ADC_CHANNEL_14;

After this change it works perfectly fine.

Kind Regards

Manpreet Singh