LPC51U68 USB Power Saving & DFU?

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

LPC51U68 USB Power Saving & DFU?

Jump to solution
1,971 Views
AndyHo
Contributor III

Hi,

I am using LPC51U68 to for joystick application. Joystick now can work perfectly, but still having several issues need to solve, and can't find example in SDK or document, hope I can get help here, thanks:

1. For power management, how to modify USB related code to send report only when data change?

    all usb example in SDK ( mouse,keyboard....etc) always send usb report in callback function, no chance to enter low power mode, so I modify the code (refer AN4748.pdf) but without success: 

in USB_DeviceHidMouseAction(){

.....

if(button_changed){

        return USB_DeviceHidSend(g_UsbDeviceHidMouse.hidHandle, USB_HID_MOUSE_ENDPOINT_IN, g_UsbDeviceHidMouse.buffer,  USB_HID_MOUSE_REPORT_LENGTH);

else {

       return kStatus_USB_Success; // stuck here

}

....

}

if move the statement to while () in main, and set USB_DEVICE_CONFIG_USE_TASK = 1, usb can't be enumerate

main(){

....

while(1){

......

if(button_changed){

USB_DeviceTaskFn(g_UsbDeviceHidMouse.deviceHandle);

}

......

}

}

please guide me how to do it, and provide the example code in AN4748.pdf 

2. Can't find HID power saving example code:

Some MCU provide HID mouse with power saving example, it means mouse will get idle to save power if no mouse movement or left/right click, it save many time to study USB stack.

Use LPCxpresso SDK, I don't know how to do it, USB stack documents provide no much help, maybe study how to merge USB Hid mouse + power_ manage_lpc + utick_wakeup example code? but I know it's not working for my project because it's not for USB power saving. 

So are there any LPC MCU have example code to do HID + mcu power saving using LPCXpresso ? because most of app note found are not coding using LPCXpresso SDK, maybe assembly or LPCOPEN,LPCware, like AN3565.pdf, AN4748.pdf,  no 51u68 ,so maybe can provide example or point out which MCU SDK I can refer to.

3. Device firmware update without XXLINK

Same as 2, I am searching for example or guide for firmware update without LPCXpresso, e.g. DFU, flashloader..., are there any document to guide user how many ways and how to do it step by step? it is not possible to design a product like 51u68 LPCXpresso demo board which need another usb and LPC4322 ( even don't know how it can do firmware update).

Regards,

Labels (1)
0 Kudos
1 Solution
1,629 Views
FelipeGarcia
NXP Employee
NXP Employee

Hi Andy,

 

Regarding 1, please make sure you are doing the following:

 

-Connect your USB to Serial converter to UART0, this is connected to FTDI header at P3.

-Make sure you power the board through J6 (leave J5 disconnected).

-Press SW2 (ISP0) during reset to enter ISP USART mode.

 

Open Flash Magic and follow the next snippet:

 pastedImage_2.png

 

Regarding 2 and 3:

 

To flash your LPCXpresso board using Flash Magic you will need a .hex file (as shown in step 5 of the snippet above). Please check the following tutorial to create S-Record, binary and hex files in MCUXpresso (same process can be followed in LPCXpresso).

 

MCUXpresso IDE: S-Record, Intel Hex and Binary Files

 

I hope this helps you.

 

Best regards,

Felipe

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

View solution in original post

0 Kudos
6 Replies
1,629 Views
FelipeGarcia
NXP Employee
NXP Employee

Hello,

 

Regarding your questions:

 

1. For the AN4748 source code please refer the following link. https://www.nxp.com/docs/en/application-note-software/AN4748SW.zip

 

2. Sorry but we do not have any examples of HID power saving. However, you can check the user manual on page 22.4.5 for more information about the suspend and resume mode.

 

3. You can use an external debugger to communicate with the LPC51U68 directly with a SWD interface.

 

Best regards,

Felipe

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
1,629 Views
AndyHo
Contributor III

Hi Felipe,

Sorry for reply late and thank you for the information you provide.

For the item 3 in your reply, I don't need debug interface.

There is only one usb on my board, so joystick and flash firmware use same USB (J5 of OM40005 ), is it possible?

In user manual (UM110071 ch1.2/ch3.1), it seems there are several ways to do it, but how? you can see my question of each method here:

CH1.2

ROM API Support

- IAP/ISP

-ROM based USB drivers (HID,CDC,MSC,DFU), Flash update via USB <-- it is what I need 

CH3.1

1.Boot source=Flash,

2.Boot source=i2C/SPI, not for my application

3.Boot source=USART, not for my application

4.Boot source=USB, an usb disk is enumerated, 

From Above information, USB DFU and USB MSC are the possible solution:

- For flash,  it seems use external flash rom to store firmware, so where is the rom file and is it correct format

       for external flash rom? if no, how to convert?

- For HID or DFU, Other LPC MCU have privode DFU example, but not in LPC51u68 SDK, where to find it and   

       how to use it?

- For USB MSC, I can see a firmware inside, but what is it? the same firmware I just flash? how to build this kind       of image using MCUExpresso? Just put the firmware into disk then reboot and firmware will flash 

       automatically?

Or there is a complete applicaiton note or user guide for those flash update method?

Regards,

 

0 Kudos
1,629 Views
FelipeGarcia
NXP Employee
NXP Employee

Hi,

 

You can flash your device through ISP commands. In LPC51U68 you have the following booting sources.

 pastedImage_1.png

To do this you have to enter your MCU in ISP mode using the above configurations during reset.

I recommend you to use Flash Magic tool in order to flash your LPC with ISP commands.

 

Please refer to chapter 3.2 and 4 of the User Manual. Also, you can check chapter 4 of the flash magic manual (you can find it in the folder where Flash Magic Tool was installed).

 

I hope this helps you.

 

Best regards,

Felipe García

1,629 Views
AndyHo
Contributor III

Hi Felipe,

Thank you for the information you provide.

Flashmagic tool seems can only download image through SUART interface, on my OM40005 board, I have tried the flashmagic tool to 51U68 without success, but success with onboard LINK2 MCU, so my question are:

1. Follow UM11121 LPCXpresso51U68 user guide, I have tried every jumper setting and procedures, only LINK2 MCU ISP mode can be identify via J6's VCOM, but always fail to LPC51U68 FTDI header ( i make a ftdi 232 cable, work for run power manager demo), so what is the correct jump setting/circuit rework for OM40005 board to make LPC51U68 ISP working with flashmagic.

2. Even flashmagic can work, I still don't know how to make the neccessary rom file (HEX format) using LPCXpresso IDE, please provide related guide.

3. We will not have UART interface on production board, so UART ISP can work, the simplest way is USB MSC ISP mode. from the UM11121 guide, I just need to put firmware.bin in it USB MSC, but how to make the firmware.bin using LPCXpresso IDE?please provide related guide.

Regards,

Andy

0 Kudos
1,630 Views
FelipeGarcia
NXP Employee
NXP Employee

Hi Andy,

 

Regarding 1, please make sure you are doing the following:

 

-Connect your USB to Serial converter to UART0, this is connected to FTDI header at P3.

-Make sure you power the board through J6 (leave J5 disconnected).

-Press SW2 (ISP0) during reset to enter ISP USART mode.

 

Open Flash Magic and follow the next snippet:

 pastedImage_2.png

 

Regarding 2 and 3:

 

To flash your LPCXpresso board using Flash Magic you will need a .hex file (as shown in step 5 of the snippet above). Please check the following tutorial to create S-Record, binary and hex files in MCUXpresso (same process can be followed in LPCXpresso).

 

MCUXpresso IDE: S-Record, Intel Hex and Binary Files

 

I hope this helps you.

 

Best regards,

Felipe

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
1,629 Views
AndyHo
Contributor III

Hi Felipe,

Thank you very much!

Regards,

Andy

0 Kudos