2022-02-28 02:43 PM
First I declare the buffer length
/* USER CODE BEGIN PD */
#define ADC_BUF_LEN 10000
Then I declare the buffer
/* USER CODE BEGIN PV */
GPIO_InitTypeDef gpio_init_structure;
VIRT_UART_HandleTypeDef huart0;
VIRT_UART_HandleTypeDef huart1;
uint16_t adc_buf[ADC_BUF_LEN];
I've enabled the VREF
/* USER CODE BEGIN 2 */
// Enable the VREF clock
__HAL_RCC_VREF_CLK_ENABLE();
// Disable the high impedance mode which is the default one read page 1694 of refman
HAL_SYSCFG_VREFBUF_HighImpedanceConfig(SYSCFG_VREFBUF_HIGH_IMPEDANCE_DISABLE);
HAL_SYSCFG_VREFBUF_VoltageScalingConfig(SYSCFG_VREFBUF_VOLTAGE_SCALE2);
// To enable VREFBUF
HAL_SYSCFG_EnableVREFBUF();
Finally I start the ADC over DMA
HAL_ADC_Start_DMA(&hadc1, (uint32_t*)adc_buf, ADC_BUF_LEN);
I seem to get reasonable values when in engineering mode and look at variables in debug mode, however, when I build for release, then scp the file to the Linux core, then use the fw_cortex_m4.sh to forward the elf file, I get values of 4095.0000 every time.
I've also noticed that even though I'm using ANA1 which according to this documentation is linked to the PIN A3, but it actually seems to only work on A2, is this an error in the documentation?
2022-03-25 08:06 AM
Hi @msche.1 . I am experiencing the same issue. Did you manage to get it to work eventually?
2022-03-25 08:16 AM
Hi, just a quick thought but could Linux be turning off the reference thinking its unused? It sounds reminiscent of:
2022-03-25 09:07 AM
Hi @BillR thanks for the suggestion. I will check it out
2023-01-05 04:40 AM
I have the same issue here, and I think it's because OPENAMP is enable in production mode or when Linux is running, However, I still don't know why or how to fix it.
2023-07-28 08:28 AM
Is there any chance to share the project which is working in engineering mode?
I read 0x8000 regardless if I am in production or engineering mode in the ADC_DR register.
Thank you