Hi.
i want initialize ADC1 for MK22FN512VMP12, i write in SIM_SCGC6 for enable ADC1 Clock Gate Control, but when i write in ADC1_CFG1 or ADC1_SC1A for star a conversion, the program return a follow error.
///////////////////////////////////////////
Default_Handler:
b .
.size Default_Handler, . - Default_Handler
/* Macro to define default handlers. Default handler
* will be weak symbol and just dead loops. They can be
* overwritten by other handlers */
////////////////////////////////////////////
what is the problem? can you help me?
pd. Si alguien habla español se lo agradeceria mucho.
Hi omar mendiola,
How did you enable ADC1 in SIM_SCGC6? did you really set the ADC1 bit in the SIM_SCGC6?
I configure it like this:
SIM_SCGC6 |= SIM_SCGC6_ADC1_MASK;
ADC1_SC1A =0X1A;
ADC1_CFG1 =0;
The MCU works ok on my side, it didn't enter default handler.
If you still have problem, please paste your problem code, I would like to help you to check it.
Have a great day,
Jingjing
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
hi jingjing
this is the code:
======================================
SIM_SCGC6 |= (1<<7);
__asm("NOP");
ADC1_CFG1 = 0b00011000;
__asm("NOP");
ADC1_SC2 = 0x00;
ADC1_SC1A = 19;
for(;;)
{
if(u32Test)
{
u32Test = ADC1_RA;
}
}
======================================
i first set up the ADC1, after i start a conversion in channel 19, but when i write in ADC1_CFG1 or any other register of ADC1, debug return the same error.
do you think that problem is into my MCU?
Hi omar mendiola,
If you want to write the ADC code, you can't just configure it like this, I suggest you refer to the KSDK K22 ADC sample code, please go to this link:
Download the KSDK1.2.0, and install it, then you can find the ADC sample code from this path:
C:\Freescale\KSDK_1.2.0\examples\frdmk22f\driver_examples\adc16
Wish it helps you!
Have a great day,
Jingjing
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------