KL27 ROM BootLoader configuration

cancel
Showing results for 
Search instead for 
Did you mean: 

KL27 ROM BootLoader configuration

647 Views
alekseystarovoy
Contributor I

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.

0 Kudos
5 Replies

169 Views
alekseystarovoy
Contributor I

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:

  1. typedef struct{
  2.   uint32_t *arr;
  3.   uint8_t size;
  4.   uint16_t num;
  5.   const uint8_t **desc;
  6.   uint32_t *dsize;
  7. }descr;

And then

  1. descr g_languages  = {
  2.   (uint32_t *) USB_STR_0,
  3.   sizeof(USB_STR_0),
  4.   (uint16_t)0x0409, 
  5.   (const uint8_t **)g_string_descriptors,
  6.   (uint32_t *) g_string_desc_size
  7. };

Thanks again

Aleksey

0 Kudos

169 Views
alekseystarovoy
Contributor I

Well, I thought it is working, but it is actually not...

0 Kudos

169 Views
alekseystarovoy
Contributor I

Hi Everyone

We made it work.

Thanks Isaac for the reply again.

0 Kudos

169 Views
mykhayloshcherb
Contributor I

Can you show the code that works for you? I'v done as in my attachment but strings are default.

0 Kudos

169 Views
isaacavila
NXP Employee
NXP Employee

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

0 Kudos