AnsweredAssumed Answered

USB detection on TWR-K22F120M board not working

Question asked by Srinivasa Rao Wunnimani on Feb 23, 2017
Latest reply on Mar 13, 2017 by Jorge Antonio Alcala Vazquez

Hi,

 

I am working on TWR-K22F120M board.   I am just working on the existing code and I have selected target device as “MK22F51212” and I have problem in USB detection.

 

Able to compile and download bootloader and LED Demo application code to target board.

Able to use KinetisFlashTool and download the application.

I have UART and USB peripherals enabled in Bootloader Configuration area.  I am able to work with UART.  Able to send command from blhost and do all the stuff with UART.

 

In bootloader_config.h I have ensured that

BL_CONFIG_USB_HID and BL_CONFIG_USB_MSC are enabled. 

 

On the hardware side, I have ensured that jumpers J26 and J28 are mounted.  Pin 1 and 2 of J27 is shorted and J34 is mounted.

 

After inserting USB, USB is not being detected. 

 

Upon debugging, I have found that bootloader  reads the configuration data, USB is enabled (enabledPeripherals = 0xF9, //!< Enabled Peripheral: UART CAN USB-HID), USB registration is success and handle is returned successfully.

 

Futher in bl_main.c, it polls for active peripherals, it is able to find UART but not USB.

 

// Wait for a peripheral to become active
while (activePeripheral == NULL)
{

 

}

 

 

Going further, below line invokes 

 if (peripheral->controlInterface->pollForActivity(peripheral))  (line 403 of bl_main.c)

calls below  function in "usb_hid_msc_peripheral_interface.c"

 

bool usb_hid_poll_for_activity(const peripheral_descriptor_t *self)
{
// uint32_t hidInfoIndex = self->instance / 2;
bool hid_active = false;
bool msc_active = false;
#if USB_DEVICE_CONFIG_HID
hid_active = g_device_composite.hid_generic.hid_packet.didReceiveFirstReport;
#endif // USB_DEVICE_CONFIG_HID
#if USB_DEVICE_CONFIG_MSC
msc_active = g_device_composite.msc_disk.msc_state.isActive;
#endif // USB_DEVICE_CONFIG_HID

s_dHidMscActivity[0] = hid_active;
s_dHidMscActivity[1] = msc_active;
return (g_device_composite.attach && (hid_active || msc_active));
}

 

variables hid_active and msc_active is never SET

 

Why?  What is that I am missing?  Am i getting interrupts?  Am i registered with interrupts?

 

 

What is missing?

 

Regards

Srinivasa

Outcomes