It seems that when using the USB-Stack (CDC-Device) the interrupt enable routines in the generated usb1.c are using the wrong NVIC-Registers:
------------------------------ snip ----------------------------------
/* ###################################################################
** THIS COMPONENT MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
** Filename : USB1.c
** Project : ProcessorExpert
** Processor : MK20DN512ZVMD10
** Component : FSL_USB_Stack
** Version : Component 01.024, Driver 01.00, CPU db: 3.00.003
** Compiler : IAR ARM C Compiler
** Date/Time : 2014-03-07, 15:21, # CodeGen: 1
** Abstract :
** This component implements a wrapper to the FSL USB Stack.
** Settings :
** Component name : USB1
** Freescale USB Stack Version : v4.1.1
** USB : Init_USB_OTG_VAR0
** Device Class : CDC Device
** CDC Device : Enabled
** CDCDevice : FSL_USB_CDC_Device
** HID Keyboard Device : Disabled
** MSD Host : Disabled
** Call Init Method : yes
** Contents :
** Init - byte USB1_Init(void);
**
** (c) Copyright Freescale, all rights reserved, 2013.
** Ported as Processor Expert component: Erich Styger
** http: www.mcuoneclipse.com
** ###################################################################*/
/*!
** @file USB1.c
** @version 01.00
** @brief
** This component implements a wrapper to the FSL USB Stack.
*/
/*!
** @addtogroup USB1_module USB1 module documentation
** @{
*/
/* MODULE USB1. */
#include "USB1.h"
#include "derivative.h" /* include peripheral declarations */
#include "types.h" /* Contains User Defined Data Types */
/*
** ===================================================================
** Method : USB1_usb_int_dis (component FSL_USB_Stack)
**
** Description :
** Disables USB interrupts (if supported)
** This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
void USB1_usb_int_dis(void)
{
/* Kinetis K20D50 */
NVICISER1 = (1<<3); /* Enable interrupts from USB module (Interrupt Set-Enable Register) */
}
/*
** ===================================================================
** Method : USB1_usb_int_en (component FSL_USB_Stack)
**
** Description :
** Enables USB interrupts (if supported).
** This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
void USB1_usb_int_en(void)
{
/* Kinetis K20D50 */
NVICICPR1 = (1<<3); /* Clear any pending interrupts on USB (Interrupt Clear-Pending Register) */
NVICISER1 = (1<<3); /* Enable interrupts from USB module (Interrupt Set-Enable Register) */
}
------------------------------ snip ----------------------------------
correct is
void USB1_usb_int_en(void)
{
/* Kinetis K20D50 */
NVICICPR2 = (1<<9); /* Clear any pending interrupts on USB (Interrupt Clear-Pending Register) */
NVICISER2 = (1<<9); /* Enable interrupts from USB module (Interrupt Set-Enable Register) */
}
Best regards
Martin