Seguinte, estou tentando usar o ADC do str711fr2, porém não estou conseguindo fazer a interrupção funcionar. Estou usando a biblioteca da st 4.0 com compilador gcc.
O código é este:
- Código: Selecionar todos
void ADC_Init(void)
{
ADC12_Init();
//Configure all ADC inputs to High impedance Analog inputs
GPIO_Config (GPIO1, 0x0F, GPIO_HI_AIN_TRI);// p1.2 e p1.3
//configure the mode
ADC12_ModeConfig(ADC12_SINGLE);
//select the channel 0 to be converted
ADC12_ChannelSelect(ADC12_CHANNEL0);
//configure the prescaler 500Hz
ADC12_PrescalerConfig(10); //apb2_clk/(adc12_clk*512*8)
// enable interrupt
ADC12_ITConfig(ENABLE);
EIC_IRQChannelConfig( ADC_IRQChannel, ENABLE );
// start the conversion
ADC12_ConversionStart();
}
//código na int
void ADC12_IRQHandler(void)
{
u16 Conv_Res;
uart_send_p("Entrou na bagaça \r\n");
Conv_Res = ADC12_ConversionValue(ADC12_CHANNEL0);
uart_send_p( "Lendo AD0... %d\r\n", Conv_Res );
}
int main(void)
{
/* Configuracao do PLL com cristal de 16Mhz para os clocks Core:48Mhz APB1:24Mhz APB2:24Mhz ------------*/
// clk / 2
RCCU_Div2Config( ENABLE );
// APB1
RCCU_PCLK1Config ( RCCU_RCLK_2 );
// APB2
RCCU_PCLK2Config ( RCCU_RCLK_2 );
// Configurar MCLK, RCCU_DEFAULT = RCLK /1
RCCU_MCLKConfig ( RCCU_DEFAULT );
// Configurar PLL1 ( * 12 , / 2 )
RCCU_PLL1Config ( RCCU_PLL1_Mul_12, RCCU_Div_2 );
// Aguarda PLL ativar (lock)
while( RCCU_FlagStatus( RCCU_PLL1_LOCK ) == RESET ) ;
// Seleciona PLL1 como fonte de clock para RCLK
RCCU_RCLKSourceConfig (RCCU_PLL1_Output);
/* Enable ADC12 and GPIO0 clocks on APB2 */
APB_ClockConfig (APB2, ENABLE, ADC12_Periph | GPIO0_Periph | GPIO1_Periph);
/* Enable I2C0 clock on APB1 */
APB_ClockConfig (APB1, ENABLE, I2C0_Periph | UART0_Periph );
uart_init();
// AD
ADC_Init();
/* Infinite loop */
while (1);
}
Na serial não sai nada

O código é bem simples, não consigo achar o problema, alguém sabe o que pode ser?
Desde já agradeço.
[]'s