2008-10-28 02:30 AM
2011-05-17 12:56 AM
I need to run the A/D converter in maximum conversion speed. Im using a new Keil MCB-STR9 board, Processor STR912FAW44 Revision H. Fast trigger in single mode should give 1.2 Msps. Activating the ACG bit in SCU->GPIOANA for fast trigger gives just a little acceleration. I’m polling the ECV Flag and don’t use DMA or interrupt. That might be a problem? After 1000 results, I’m toggle GPIO0 for indication. Im reaching 761 Ksps, if ADC prescaler is set to 0x01. PCLK is 48Mhz. That means ADC Clk is 48 Mhz, too much ! Maximum is 25 Mhz. But reducing ADC Clk reducing conversion rate again.
Can anyone help ? SCU->GPIOANA |= 0x100; // set ACG-Bit to enable fast trigger mode ADC->CR |= 0x0002; // POR=1 Power on mode for (i=0; iADC->CR &= 0xFFF7; // STB=0 analog Block is kept powerded on waitUs_v (50); // wait 50µs. SCU->GPIOANA |= 0x100; // set ACG-Bit to enable fast trigger mode ADC->CCR = 0x03; // Config ADC Input Channel 0 ADC->PRS = 0x01; // should be 0x02 !!! fADC = PCLK/2. PCLK=48Mhz, fADC max = 25Mhz. ADC->CR2 = 0x07; // External Trigger Pin // 0x06; Trigger enabled. Trigger source = External pin ADC->CR |= 0x8000; //clear ECV i=0; toggle = 0; while (1) if (ADC->CR&0x8000) { // 0x8000 conversion ready (ECV=1) ? ADC->CR |= 0x8000; // clear ECV wert = ADC->DR0; // dummy read if (++i == 1000) { i=0; if (toggle) GPIO_Write(GPIO0, 0xff), toggle=0; // toggle for diagnostic else GPIO_Write(GPIO0, 0x00), toggle=1; } }