cancel
Showing results for 
Search instead for 
Did you mean: 

B-U585I-IOT02A: No ADC1 data from PC0 pin

EmbeddedN00b
Visitor

Hello all!

I need some rubber ducking help here.

I have got hold of a B-U585I-IOT02A dev board, where I'm trying to get learn and get to know the STM32 family.

I have got a lot of things working, but the ADC1 is giving me a hard time:

Here is my MX config:

EmbeddedN00b_0-1778651326810.png

IN1 enabled, and expecting the data to be stored in the DR register.

PC0 is selected as ADC1_IN1:

EmbeddedN00b_1-1778651419752.png

EmbeddedN00b_2-1778651472759.png

Global interrupts are enabled:

EmbeddedN00b_3-1778651511216.png

So far, so good( I think ).

my application code:

/* Running in my main while(1) loop */
    // Other stuff before here
    if (StartConv) {
      if (HAL_ADC_Start_IT(&hadc1) != HAL_OK)
      {
        /* Start Conversation Error */
        Error_Handler();
      }
      StartConv = 0;
    }
    HAL_Delay(10);

And when above is executed, I can see that I'm getting a interrupt and call to my own ConversionCallback function:

void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* AdcHandle)
{
  /* Get the converted value of regular channel */
  adc_raw = HAL_ADC_GetValue(AdcHandle);
  printf("ADC Raw Value: %lu\r\n", adc_raw);
  // Retrigger convertion
  StartConv = 1;
}

 (Remember folks, this is just for learning, I would never but a printf call in my ISR ;) )

And the prints i'm getting:

Fluctuating values between 0 and 2:

 

EmbeddedN00b_4-1778652295991.png

 

"But hey, have he even applied any voltage on the PC0 pin?" you might be thinking.

And the answer is: Yes, I have tried to direct hot wire the 3.3V pin from connector CN17.

I have also tried to use a potentiometer(This is my standard setup):

EmbeddedN00b_5-1778652763187.png

EmbeddedN00b_6-1778652782017.png

When I measure the PC0 pin (Green cable in my setup), I can see that it is between 0 and 3.3V based on the potentiometer position.

I base the board pins on the documentation:

EmbeddedN00b_7-1778653098159.png

 

So, so far during my rubber ducking session I have not found the problem!

Can someone else see my probably n00b mistake?

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
EmbeddedN00b
Visitor

Rubber ducking success!!

After re-reading my own post here, and playing around with the CubeMX settings for the ADC, I finally got it to work.

EmbeddedN00b_0-1778664790306.png

After changing "Enable Regular Conversions" to Enable, it magically started to work.

EmbeddedN00b_1-1778664834899.png

But... I do not now know why.....

View solution in original post

1 REPLY 1
EmbeddedN00b
Visitor

Rubber ducking success!!

After re-reading my own post here, and playing around with the CubeMX settings for the ADC, I finally got it to work.

EmbeddedN00b_0-1778664790306.png

After changing "Enable Regular Conversions" to Enable, it magically started to work.

EmbeddedN00b_1-1778664834899.png

But... I do not now know why.....