Default interrupt error using ADC on Kinteis FRDM board

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

Default interrupt error using ADC on Kinteis FRDM board

Jump to solution
845 Views
mattgallagher
Contributor I

Trying to build a simple A to D application on the FRDM KL25 board. I am using ADC0 attached to pin PTC1.  Using Codewarrior 10.3 and as I step through the code it goes directly to a default interrupt handler the moment I step into any command that attempts to initialize an ADC register.  For example in the intialization ADC0_CFG1=0x4; will cause an interrupt which has no handler defined so it goes to default.  I suspect I am making a simple error.

//Initialize PTC1 as ADC15  A to D
   
         SIM_SCGC5|=SIM_SCGC5_PORTC_MASK;   //  Turn on clock for port C
        
    // Convert the specific pins to the ADC module ( ADC is default).

         PORTC_PCR(1)=PORT_PCR_MUX(0);
        
         ADC0_CFG1=0x4;   //  12 bit conversion, single ended, full speed bus  clock normal operation    <<<interrupt occurs here
         ADC0_CFG2=0;       <<< or here if I have the above line commented out...

Labels (1)
0 Kudos
1 Solution
549 Views
JimDon
Senior Contributor III

Try this:

SIM_SCGC6 |= SIM_SCGC6_ADC0_MASK;

View solution in original post

0 Kudos
2 Replies
550 Views
JimDon
Senior Contributor III

Try this:

SIM_SCGC6 |= SIM_SCGC6_ADC0_MASK;

0 Kudos
549 Views
martynhunt
NXP Employee
NXP Employee

Jim Donelson wrote:

Try this:

SIM_SCGC6 |= SIM_SCGC6_ADC0_MASK;

That will fix your default_isr issue. The module's Clock Gate control must be enabled in the appropriate SIM_SCGCx register.