2024-02-11 10:49 PM - last edited on 2024-09-24 05:18 AM by Amel NASRI
I'm finding difficult to get the value from the channel that i configured of a regular channel with stm32l412 microcontroller. where I'm not getting the EOC interrupt enabled in ADC_ISR register.
and When I tried to get data from ADC_CDR register, it throwing error on me like there no like this register is exists.
Really not understood why is happening like this.
Please help me in this.
2024-02-12 05:16 AM
> When I tried to get data from ADC_CDR register, it throwing error on me like there no like this register is exists.
Show the error.
Typically you read from the ADCx_DR register for a single ADC.
Lots of examples in CubeMX on how to use the ADC.
2024-02-13 10:22 AM
Hi @Aj_123
The forum moderator had marked your post as needing a little more investigation and direct support. An online support case has been created on your behalf, please stand by for just a moment and you will hear from us.
Regards,
Billy
2024-02-13 10:40 AM
>When I tried to get data from ADC_CDR register
How did you try ?
ADC_CDR is 32 bits and has two parts...
2024-02-14 03:10 AM
2024-02-14 03:15 AM
This is how i tried but, i don't know why it's happening. I have not even seen CDR register is there in registers list. Please acknowledge and respond. Your help will be greatly appreciated.
2024-02-14 03:19 AM
Please have a look into this. I'm trying to enable both regular and injected in ADC_CCR register so, we have to read from ADC_CDR regiser. Your help will be greatly appreciated.
2024-02-14 06:58 AM
The common ADC register is at ADC12_COMMON->CDR, not ADC1->CDR.
2024-02-14 07:05 AM
could you give me an example of this logic to read data from it .
2024-02-14 07:12 AM
I don't know that it has the data you want, but here is how you would read the two fields in the register:
uint32_t cdr = ADC12_COMMON->CDR;
uint16_t upper_field = cdr >> 16;
uint16_t lower_field = cdr & 0xFFFF;