how to run the HSADC?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to run the HSADC?

505 Views
9crkzhou
Contributor III

is there any official code examples ?

I can't get the HSADC work.

this is my code:

initial:______________________________________________________________________________

writel(0x50000000, clk_base + HW_CLKCTRL_HSADC); /* M = 18;RST=High; */

  *((u8*)(clk_base + HW_CLKCTRL_FRAC1 + 1)) = 30; /* HSADC=480*(M/N)=288MHz */

  *((u8*)(clk_base + HW_CLKCTRL_FRAC1_CLR + 1)) = 0x80; /* clear HSADC_CLK_GATE */

  writel(0xF0000000, hsadc_base + HW_HSADC_CTRL0_CLR); /* normal run;trigger is sw */

  writel(0x0000000F, hsadc_base + HW_HSADC_CTRL2_SET); /* precharge before convert */

                                                                                             /* set pin to HSADC */

  writel(0x00000003, hsadc_base + HW_HSADC_SEQUENCE_SAMPLES_NUM);/* 1 sample per sequence */

  writel(0x00000003, hsadc_base + HW_HSADC_SEQUENCE_NUM); /* 1 sequence per trig */

  writel(0xFC000000, hsadc_base + HW_HSADC_CTRL1_CLR); /* disable all interrupt */

  writel(0x01C00001, hsadc_base + HW_HSADC_CTRL0_SET); /* 4 discard & 12bit mode */

                                                                                             /* get the HSADC running */

read the value:________________________________________________________________________

// while((readl(hsadc_base + HW_HSADC_CTRL1) & 0x00000020)){ /* if empty then */

  writel(0x08000000, hsadc_base + HW_HSADC_CTRL0_SET); /* trig it! */

// }

  iRes = readl(hsadc_base + HW_HSADC_FIFO_DATA);

it just not work...

any help will be apreciated...

Labels (1)
0 Kudos
0 Replies