cancel
Showing results for 
Search instead for 
Did you mean: 

BlueNRG_LP multiple channel ADC

michelemancini2
Associate III

I am working with BlueNRG LP.

I am acquiring 3 channels:

ADC_VINP0 (PB3)

ADC_VINM0 (PB2)

BATTERY.

I used and modified example of the "BlueNRG-LP Navigator" ADC_DMA.

I read ADC_VINP0 and the batteries but ADC_VINM0 not work!! ( I used STEVAL-IDB011V1 and i remove the "R50" (pin DOUT of MP34DT05-A digital microphone)

static void MX_ADC_Init(void)
{
  /* Enable the ADC peripheral */
  HAL_ADC_StructInit(&adc_handle);
  adc_handle.Init.DataRatio = USER_RATIO;
  adc_handle.Init.DataWidth = USER_DATAWIDTH;
  adc_handle.Init.SampleRate = USER_SAMPLERATE;
  adc_handle.Init.SamplingMode = ADC_SAMPLING_AT_START; 
  adc_handle.Init.SequenceLength = ADC_SEQ_LEN_03;
  adc_handle.DMA_Handle = &hdma_adc;
  
  if (HAL_ADC_Init(&adc_handle) != HAL_OK) {
    Error_Handler();
  }
  
  /* Set the 1 input channel */
  xChannel.ChannelType = ADC_CH_VINP0_TO_SINGLE_POSITIVE_INPUT;
  xChannel.SequenceNumber = ADC_SEQ_POS_01;
  xChannel.VoltRange = ADC_VIN_RANGE_3V6;
  if (HAL_ADC_ConfigChannel(&adc_handle, &xChannel)!= HAL_OK) {
    Error_Handler();
  }
  
  
  /* Set the 2 input channel */
  xChannel.ChannelType = ADC_CH_VINM0_TO_SINGLE_NEGATIVE_INPUT; 
  xChannel.SequenceNumber = ADC_SEQ_POS_02;
  xChannel.VoltRange = ADC_VIN_RANGE_3V6;
  if (HAL_ADC_ConfigChannel(&adc_handle, &xChannel)!= HAL_OK) {
    Error_Handler();
  }
 
    /* Set the 3 input channel */
  xChannel.ChannelType = ADC_CH_BATTERY_LEVEL_DETECTOR;
  xChannel.SequenceNumber = ADC_SEQ_POS_03;
  xChannel.VoltRange = ADC_VIN_RANGE_3V6;
  if (HAL_ADC_ConfigChannel(&adc_handle, &xChannel)!= HAL_OK) {
    Error_Handler();
  }
 
  
  
  LL_ADC_SetCalibPoint1Gain(ADC, LL_ADC_DEFAULT_RANGE_VALUE_3V6);
  LL_ADC_SetCalibPointForSinglePos3V6(ADC, LL_ADC_CALIB_POINT_1);
}
 
/** 
  * Enable DMA controller clock
  */
static void MX_DMA_Init(void) 
{
  /* DMA controller clock enable */
  __HAL_RCC_DMA_CLK_ENABLE();
 
  /* Configure NVIC for DMA */
  HAL_NVIC_SetPriority(DMA_IRQn, 0);
  HAL_NVIC_EnableIRQ(DMA_IRQn);
 
}

2 REPLIES 2
TDK
Guru

> ADC_VINM0 not work

What about it doesn't work? What results are you getting and what do you expect instead?

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

i found the problem, i got confused with the HAL and LL drivers