Author Topic: CH32V003 ADC interrupt cannot set  (Read 661 times)

0 Members and 1 Guest are viewing this topic.

Offline SajeevTopic starter

  • Contributor
  • Posts: 13
  • Country: in
CH32V003 ADC interrupt cannot set
« on: January 23, 2024, 03:44:41 am »
Dear Esteemed forum members,
I am trying to do ADC conversion with EOC interrupt but it seems the EOCIE bit in ADC_CTRL1 register never sets. I was successful in polling ADC conversion but the interrupt seems elusive. I tried to print out the ADC registers via UART and found the ADC_CTRL1 register is always 0 even though i had OR it with 1<<5. The attached code only prints a polled result and then waits for an interrupt to fire.Requesting forum members to review the code attached an identify the mistake i made. I only know assembly.Appreciate any help/comments

Regards
Sajeev

current result, only one polled result and interrupt never fires

 

Offline SajeevTopic starter

  • Contributor
  • Posts: 13
  • Country: in
Re: CH32V003 ADC interrupt cannot set
« Reply #1 on: January 23, 2024, 06:45:17 pm »
Dear Members,
Thanks for the views. I got the problem/bug . Instead of OR ing the EOCIE bit i AND ed it to ADC_CTRL1 register. That was the reason the register was always 0. On OR ing the value the interrupt started working. Please find the attached corrected code if it may help anybody. Also find attached ADC with DMA code. covets 2 inputs PD4 and PD3 and stores in SRAM using DMA.
Thanks
Sajeev
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf