AnsweredAssumed Answered

LPC11U68: rapid USB re-enumerations when calling mass storage device bootloader

Question asked by lpcware Employee on Jun 15, 2016
Latest reply on Nov 2, 2016 by Olivier Martin
Content originally posted in LPCWare by danblumenfeld on Fri Mar 18 07:57:42 MST 2016
Hello, all.

My name is Dan...I'm new to micro development, as well as to LPCWare, so I apologize if I've missed anything obvious.

I'm attempting to put together a proof-of-concept, demonstrating the ability to update the firmware via the USB mass storage emulation for ISP. I started with the application note and sample code found here: https://www.lpcware.com/content/nxpfile/an11305-usb-system-programming-lpc11u3xlpc11u2x.

I'm developing in the LPCXpresso IDE, v8.0.0 [Build 526] [2015-11-23], on a Windows 10 desktop.

When I debug it through the IDE with the USB cable plugged into the link, it appears to function correctly; gets as far as the call to IAP_Entry and executes. Nothing enumerates, though, presumably because I'm connected to link not target.

When I run it with the USB cable plugged into the target, I see flickering in Explorer's notification tray and in Device Manager, and hear repeated USB enumeration notification sounds. Occasionally, a new drive briefly shows in Explorer, but immediately vanishes. Device Manager lists a disconnected disk drive called "NXP LPC1XXX IFLASH USB Device", which I assume is the mass storage ISP device.

My current code, as simplified as possible (based on LPCOpen projects), is as follows:
Includes lpc_board_nxp_lpcxpresso_11u68 library
Includes lpc_chip_11u68 library

Three source files:
sysinit.c:
Copied unchanged from LPCOpen
cr_startup_lpc11u.c:
Copied unchanged from LPCOpen

Main.c:

#include "board.h"

/* This data must be global so it is not read from the stack */
#define IAP_ENTRY_LOCATION        0X1FFF1FF1
typedef void (*IAP_ENTRY_T)(unsigned int[5], unsigned int[4]);

void IAP_Entry(unsigned int cmd_param[5], unsigned int status_result[4])
{
    ((IAP_ENTRY_T) IAP_ENTRY_LOCATION)(cmd_param, status_result);
}
void ReinvokeISP(void)
{
uint32_t command[5], result[4];

SCB->VTOR = 0; //Resets vector table offset
LPC_SYSCTL->SYSAHBCLKCTRL |= 0x14440; //USB clock(0x04000), 32-bit timer(0x00400), GPIO clock(0x00040), and IO config clock(0x10000) must all be on
LPC_SYSCTL->SYSAHBCLKDIV = 1; //make sure AHB clock divider is 1:1

command[0] = 57; //Reinvoke ISP command
IAP_Entry(command, result);
}

/* Main Program */
int main()
{
ReinvokeISP();
}


An image of my board and jumpers is attached.

Any suggestions for something obvious I'm doing wrong, or how best to diagnose the problem? It feels as if the device is continuously resetting itself into the USB ISP mode.

Thanks in advance for any help you can provide this novice.

Best,

--Dan

Outcomes