Default_Handler is triggering() :(

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

Default_Handler is triggering() :(

1,227 Views
varunrajarangan
Contributor II

Hi everyone,

I am new to freescale microcontrollers. I am using KL05z microcontroller. Whenever I try to configure PORTB_PCR8, the Default_Handler() is triggering. I am using Code Warrior. I am doing this as a baremetal code without Processor Expert. what could be the reason??

When I checked the kinetis_sysinit.c, It is having a PORTD_IRQHandler().

But the microcontroller doesn't have a PORTD.

I am really confused..:(

Please help...

Varun Rajarangan

Labels (1)
3 Replies

660 Views
pgo
Senior Contributor V

Hi Varun,

You haven't given much information but as a guess have you enabled the clock to the port before accessing the Port registers,  Failure to do so will result in an illegal access exception which may be what you are seeing.

Refer to the SIM_SCGC5 (from memory) register.

bye

660 Views
varunrajarangan
Contributor II

Thank you so much pgo. You are right. I didn't configure the clock for that module.

After configuring, It worked. Now the default handler is not coming and the port is properly configured.

I have one more doubt.

I am using KL05Z microcontroller. When I checked the kinetis_sysinit.c, I could see the interrupt vector table.

/* The Interrupt Vector Table */

void (* const InterruptVector[])() __attribute__ ((section(".vectortable"))) = {

    /* Processor exceptions */

    (void(*)(void)) &_estack,

    __thumb_startup,

    NMI_Handler,

    HardFault_Handler,

    0,

    0,

    0,

    0,

    0,

    0,

    0,

    SVC_Handler,

    0,

    0,

    PendSV_Handler,

    SysTick_Handler,

    /* Interrupts */

    DMA0_IRQHandler, /* DMA Channel 0 Transfer Complete and Error */

    DMA1_IRQHandler, /* DMA Channel 1 Transfer Complete and Error */

    DMA2_IRQHandler, /* DMA Channel 2 Transfer Complete and Error */

    DMA3_IRQHandler, /* DMA Channel 3 Transfer Complete and Error */

    MCM_IRQHandler, /* Normal Interrupt */

    FTFL_IRQHandler, /* FTFL Interrupt */

    PMC_IRQHandler, /* PMC Interrupt */

    LLW_IRQHandler, /* Low Leakage Wake-up */

    I2C0_IRQHandler, /* I2C0 interrupt */

    I2C1_IRQHandler, /* I2C1 interrupt */

    SPI0_IRQHandler, /* SPI0 Interrupt */

    SPI1_IRQHandler, /* SPI1 Interrupt */

    UART0_IRQHandler, /* UART0 Status and Error interrupt */

    UART1_IRQHandler, /* UART1 Status and Error interrupt */

    UART2_IRQHandler, /* UART2 Status and Error interrupt */

    ADC0_IRQHandler, /* ADC0 interrupt */

    CMP0_IRQHandler, /* CMP0 interrupt */

    FTM0_IRQHandler, /* FTM0 fault, overflow and channels interrupt */

    FTM1_IRQHandler, /* FTM1 fault, overflow and channels interrupt */

    FTM2_IRQHandler, /* FTM2 fault, overflow and channels interrupt */

    RTC_Alarm_IRQHandler, /* RTC Alarm interrupt */

    RTC_Seconds_IRQHandler, /* RTC Seconds interrupt */

    PIT_IRQHandler, /* PIT timer all channels interrupt */

    Default_Handler, /* Reserved interrupt 39/23 */

    USBOTG_IRQHandler, /* USB interrupt */

    DAC0_IRQHandler, /* DAC0 interrupt */

    TSI0_IRQHandler, /* TSI0 Interrupt */

    MCG_IRQHandler, /* MCG Interrupt */

    LPTimer_IRQHandler, /* LPTimer interrupt */

    Default_Handler, /* Reserved interrupt 45/29 */

    PORTA_IRQHandler, /* Port A interrupt */

    PORTD_IRQHandler /* Port D interrupt */

};

Why does this PORD_IRQHandler present here?? This microcontroller doesn't have a PORTD.

And what should I do If I have to create a PORTB_IRQHandler ???

Thanks and regards

Varun Rajarangan

0 Kudos

660 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

That should be a CodeWarrior software issue, which should be PORTB_IRQHandler /* Port B interrupt */   (a typo error).

I will report this issue to CodeWarrior team about it.

Sorry for the inconvenience may cause.


Have a great day,
best regards,

Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------