We do use KL27 ROM Bootloader to update the firmware on our device via USB port. We use code from datasheet to initiate the bootloader. It works fine; however, we have UART0 connected to remote IC, and when MCU in the bootloader mode, and that IC start to talk on UART line, MCU disconnects from USB. In the bootloader section of the datasheet it talks about using the BCA to disable or enable peripherals. As I see it, we need to set only USB is to be active for the bootlader. Unfortunately, if BCA used, it requires to manually set usbVid, usbPid and usbStringPointer.
VID and PID are no problem, but a String Pointer is a little bit tough. My question is, could we use default String Pointer from ROM, and if yes, what its address. Or, maybe someone has an example of setting Bootloader BCA for Keil or IAR.
Thank you.
Thanks Isaac for the reply.
I was not able to find section 13.4.4.2 in KL27's reference manual. Also there is not much info about default String Pointer.
To make it work I had to make my custom typedef struct like this:
And then
Thanks again
Aleksey
Well, I thought it is working, but it is actually not...
Hi Everyone
We made it work.
Thanks Isaac for the reply again.
Hello,
You can use default VID/PID and usbStringsPointer values. This usbStringsPointer points to the structure where manufacturer, product and serial number string for this USB device are found. Section 13.4.4.2 from KL27's reference manual talks about these parameters and how they are defined.
For example, if you want to use a customized usbStringsPointer you will need to define a structure (for example) as follows:
g_languages = {
USB_STR_0,
sizeof(USB_STR_0),
(uint_16)0x0409,
(const uint_8 **)g_string_descriptors,
g_string_desc_size
};
USB_STR_0 is a fixed 4-bytes array:
USB_STR_0[4] = {0x02,
0x03,
0x09,
0x04
};
g_string_descriptors contains next data:
g_string_descriptors[4] =
{ USB_STR_0,
USB_STR_1,
USB_STR_2,
USB_STR_3};
and g_string_desc_size contains:
g_string_desc_size[4] =
{ sizeof(USB_STR_0),
sizeof(USB_STR_1),
sizeof(USB_STR_2),
sizeof(USB_STR_3)};
You can make your own structure of USB_STR_1, USB_STR_2 and USB_STR_3, taking in mind that USB_STR_1 is used for the manufacturer string, USB_STR_2 is used for the produc t string and USB_STR_3 is used for the serial number.
After you define these structures, usbStringsPointer (BCA + 0X18) will have the address where g_languages structure is stored.
You can give a look to this useful document that might be helpful: https://community.nxp.com/docs/DOC-256669
I hope this helps!
Regards,
Isaac