AnsweredAssumed Answered

Example for the FlexTimer Module with interrupts on the FRDM-K20D50

Question asked by juanm on Jan 5, 2014
Latest reply on Mar 30, 2015 by Jorge_Gonzalez

Hi! I'm starting with the Kinetis microcontrollers, and I have an FRDM-K20D50. At first I was using processor expert, but now I want to use it without it. For this, I was following this examples:

 

KWIKSTIK K40 Getting Started

FREEDOM BOARD / CORTEX M0+ GETTING STARTED

 

I didn't have any trouble adapting the firsts examples to the Freedom Board, but I'm not sure with the FTM module.

The problem is with the interrupt vector table. In the code attached in those videos, in the file kinetis_sysinit.c for the KL25, there's an array with all the IRQ handlers declared like this:

 

/* 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 */

};

 

But with the K20, Codewarrior generate this kinetis_sysinit.c:

 

/* The Interrupt Vector Table */

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

    /* Processor exceptions */

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

    __thumb_startup,

    NMI_Handler,

    HardFault_Handler,

    MemManage_Handler,

    BusFault_Handler,

    UsageFault_Handler,

    0,

    0,

    0,

    0,

    SVC_Handler,

    DebugMonitor_Handler,

    0,

    PendSV_Handler,

    SysTick_Handler,

 

 

    /* Interrupts */

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

    Default_Handler,

};

 

The question is how can I generate a table for K20 with all the IRQ handlers defined like in the KL25?

I hope that I have made myself clear with the question, English isn't my first language.

 

PD: Also I would like to know if there's a working example for the TFM with interrupts for the FRDM-K20D50.

 

Thanks!!!!!!

Outcomes