MKW24D512 Kinetis Bootloader port

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

MKW24D512 Kinetis Bootloader port

713 Views
aljazsrebrnic
Contributor I

Hello everyone!

I'm trying to port the official Kinetis Bootloader, but I keep running into problems in the USB stack. There's some defines missing, like DEV_ARCHITECTURE_STRUCT, GETSTATUS_DATA_SIZE and GETSTATE_DATA_SIZE and there's no mention of them in the documentation, so I don't know if I should set them or they get set by IAR. Any ideas?

Labels (2)
Tags (1)
0 Kudos
2 Replies

460 Views
adriancano
NXP Employee
NXP Employee

Hi,

Those definitions are part of the USB stack:

DEV_ARCHITECTURE_STRUCT is used only when COMPOSITE_DEV is used in the stack but the Kinetis Bootloader (KBOOT) does not support composite device, you can see it in the usb_(class name).c file (example usb_hid.c) code:

#ifdef COMPOSITE_DEV

        DEV_ARCHITECTURE_STRUCT_PTR dev_arc_ptr;    //HERE

        CLASS_ARC_STRUCT_PTR dev_class_ptr;

        dev_arc_ptr = (DEV_ARCHITECTURE_STRUCT *)USB_Desc_Get_Class_Architecture(controller_ID);

It is the same with the GETSTATUS_DATA_SIZE and GETSTATE_DATA_SIZE you can find them in the usb_dfu.c file inside the \FSL_Kinetis_Bootloader_1_1_0\src\usb_device\class:

static uint_8 USB_Class_DFU_Getstatus (

    uint_8 controller_ID,              /* [IN] Controller ID */

    uint_8 interface,                  /* [IN] Interface */

    uint_8_ptr *data,                  /* [OUT] Pointer to Data */

    USB_PACKET_SIZE *size              /* [OUT] Pointer to Size of Data */

)

{

    UNUSED(controller_ID)

    /* if interface valid */

    if (interface < USB_MAX_SUPPORTED_INTERFACES)

    {

        /* get status data*/

        *size = GETSTATUS_DATA_SIZE;    //HERE

        *data = g_status;

        return USB_OK;

    }

    return USBERR_INVALID_REQ_TYPE;

}

This macros are not used because only USB HID is supported by the KBOOT but are in the files because are part of the stack.

Refer to the Kinetis Bootloader 1.1.0 Reference Manual.pdf file included in the KBOOT documentation the chapter 9 has a lot of hints and procedure of porting the KBOOT to other devices.


Hope this information can help you

Best Regards,
Adrian Sanchez Cano
Technical Support Engineer
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

460 Views
aljazsrebrnic
Contributor I

I decided to use the IAR workbench after all, and now the project compiles. Unfortunately, it fails to enumerate as a USB device. I suspect it has something to do with these lines:

BW_USB_CLK_RECOVER_CTRL_CLOCK_RECOVER_EN(USB0_BASE, 1);

BW_USB_CLK_RECOVER_IRC_EN_IRC_EN(USB0_BASE, 1);

I removed them since MK24 does not have internal 48MHz clock recovery support.

Since the device fails to enumerate for three times consecutively my hypothesis is that it goes to sleep and fails to respond to the host setup packet. How can I disable the device sleep mode?

My other theory is that there's something wrong with the clock setting. Does anyone know which is the correct one?

Thanks,

Aljaž

0 Kudos