Issues programming NXP LPC11U34 - Page 1
Forum section: electronics / projects

author: Headless Chicken
author_rank: Newbie
timestamp: May 30, 2019, 12:46:49 pm
content: Hi all,I’m currently stuck on a kind of a problem, and I’m unable to make head or tails of where the it could be.So, the setup is the following, it’s some kind of USB gizmo using the NXP LPC11U34-421. I have made a custom dev board for it but note that for reasons, the pcb does not include the crystal and it’s now bodged as close as possible on top of the chip.The idea behind picking that chip was to save me the hassle of writing my own usb bootloader and just use the integrated one. First problem: I just cannot manage to boot into it, the USB device keep showing up as unrecognized and not MSC on the computer, even when I tried pulling the PIO0_3 to high and pressing reset (PIO0_0) while keeping the bootloader switch (PIO0_1) pressed as per the documentation, but nothing, still unrecognized.It’s my first time dabbling with usb so I’m not sure what to expect but using a USB analyzer I got some up and down traffic going on the bus. Here is an extract:• IRP_MN_QUERY_DEVICE_TEXT (description) for which the device (?) answered not supported• IRP_MN_QUERY_DEVICE_TEXT (location) for which the device (?) answered its port and hub locationSo that last one got me thinking maybe it’s not the device answering but something in the middle (the hub?) as I have yet to flash anything on the chip. The D6 LED on the Soft Connect D+ Pull up is lightning up as soon as I plug in the USB.So I figured, maybe the chip does not have the USB bootloader ready to use out of the factory, and I would hook up the BM probe to it to try flashing it through UART but then again to no avail, I got a “attaching to remote target failed”. Putting a logic analyzer on the RX TX lines showed me that no traffic was going through. I’m using PlatformIO set up to use the BM probe. I have not done anything else, no further installation. Is there any further setup required, it seems however to detect the probe just fine.I am currently at a point where I’m not sure if that part is fried, if I’m using the tools correctly, or if something is wrong in my board design.I would be very glad if someone could help me figure out what's wrong there!Best,

author: iMo
author_rank: Super Contributor
timestamp: May 30, 2019, 01:03:42 pm
content: Try to remove the D6 LED.https://os.mbed.com/media/uploads/andersonj55126/an11305v.1.pdf

author: Headless Chicken
author_rank: Newbie
timestamp: May 30, 2019, 01:31:36 pm
content: Hi Imo,Thanks for your answer, I tried to remove D6 and connect the USB but the result is the same.I came across the document you sent before, but sadly I'm blocked in the middle of the second section, and that is the procedure I am following.

author: iMo
author_rank: Super Contributor
timestamp: May 30, 2019, 02:00:46 pm
content: QuoteYour PIO0_3 is floating, afaik..Place a 10k pullup there..

author: Headless Chicken
author_rank: Newbie
timestamp: May 30, 2019, 02:50:43 pm
content: I haven't included the full schematics but PIO0_3 pin is connected to a header with a jumper wire to VCC.

author: dietert1
author_rank: Super Contributor
timestamp: May 30, 2019, 03:06:47 pm
content: Is the crystal oscillator coming on after power on? Can you check that with a scope? The two capacitors on the crystal should probably be 18 pF - anything with uF won't work.Regards, Dieter

author: nctnico
author_rank: Super Contributor
timestamp: May 30, 2019, 06:26:12 pm
content: AFAIK USB_connect is positive logic and the way it is wired it gets inverted. Also I never use a buffer between USB_connect and the USB lines. Just a 1.5k Ohm resistor.

author: Headless Chicken
author_rank: Newbie
timestamp: May 30, 2019, 08:37:17 pm
content: Quote from: dietert1 on May 30, 2019, 03:06:47 pmI gave it a check on the scope, and I do have a clear 12MHz clock coming online with the chip. I indeed used some 18pF, that was a typo in the schematics ...Quote from: nctnico on May 30, 2019, 06:26:12 pmAs I understood, on the LPC11U3X the USB_CONNECT is inverted. Regarding the buffer, I went with the recommended setup in section 11 of the short datasheet (https://www.nxp.com/docs/en/data-sheet/LPC11U3X.pdf), also this part of the design was made with reference from some NXP dev boards I found the schematics for. Would you advise going for 1.5K resistor between USB_CONNECT and the D+?

author: nctnico
author_rank: Super Contributor
timestamp: May 30, 2019, 10:24:38 pm
content: I see now USB_CONNECT is inverted on the chip itself so your circuit should be OK. Did you enable this pin through the pin connect block? Did you check whether USB_CONNECT gets driven at all and is not half way a logic level? It should be at 0V or 3.3V. Not somewhere in between.BTW I always use a GPIO to drive USB_CONNECT and I'm not using the USB block to drive USB_CONNECT so that is different and hence the confusion.

author: Headless Chicken
author_rank: Newbie
timestamp: May 31, 2019, 04:23:38 am
content: Quote from: nctnico on May 30, 2019, 10:24:38 pmYou are correct, the pin is not driven, it's around 1.3V which should be enough to saturate the transistor and I just noticed that using an external power source it also does light up the D6 LED.I have yet to program anything on the chip, I was hopping NXP was shipping it with the usb bootloader ready to use. I couldn't manage to flash it using the blackmagic probe either, but that is probably me using the tool wrong, the documentation available is very thin ...

author: iMo
author_rank: Super Contributor
timestamp: May 31, 2019, 06:23:08 am
content: I have here an LPCXpresso board w/ 1343 on it. I split the board in half (removing the programmer) years back and used to use it as an mcu board only.I added 2 buttons, wired to Reset and USB_FToggle pin PIO0_1 (plus some resistors around).The USB_VBUS is pulled to GND via 3k3 here.While reading the 1343 datasheet:QuoteI was using it with the built-in serial UART bootloader, it worked fine. I had to press the USB_FToggle button down and while hold it down I had to press/release the Reset button.QuoteThus (except your 1k5+transistor D+ signaling) there are other 3 signals involved I had to handle properly - RESET, USB_FToggle and USB_VBUS.It could be you have to use the FlashMagic.exe to upload the binary via the UART.

author: Headless Chicken
author_rank: Newbie
timestamp: May 31, 2019, 04:09:01 pm
content: I am doing the same here, I have two buttons Reset and Bootloader, respectively on PIO0_0 and PIO0_1.I also have a jumper wire on PIO0_3, that I switch between GND and +3.3V. This part is working because when I power the device with the jumper on Vcc it pops up in windows (still as unrecognized usb), and on GND it does not. At least the USB stack is not starting.So I tried the procedure, press reset, press bootloader and keep it while releasing reset, wait a bit and release bootloader, and start programing. All with the PIO0_3 to ground, nothing.I actually already tried with both PIO and flashmagic, both fails but the led on the blackmagic does go blinky a bit. FlashMagic fails with a fail to autobaud.Interestingly enough hooking up the logic analyzer I see that the RX/TX stays to high. I don't believe I need a pullup/pulldown on these lines as well, or do I?

author: ehughes
author_rank: Frequent Contributor
timestamp: May 31, 2019, 07:00:30 pm
content: The bootloader is in ROM. I have several designs with it and it works without issue.Have you tried programming via SWD? It sounds like something is wrong in your physical layout.

author: iMo
author_rank: Super Contributor
timestamp: June 01, 2019, 10:05:20 am
content: Quote1. press down USB_FToggle2. press down Reset3. release Reset4. release USB_FToggleall with the PIO0_3 to ground for UART bootloader.QuoteRx and Tx are idle High, that is ok.You do not need pulldowns, you do need an FTxxx or similar usb/UART dongle.I always recommend to use 1k resistors (or similar value) in series with Rx and Tx wires for protection reasons.Board TX ----1k------UARTusbdongle RXBoard RX ----1k-----UARTusbdongle TXBoard GND-----------UARTusbdongle GND

author: Headless Chicken
author_rank: Newbie
timestamp: June 01, 2019, 11:01:04 am
content: Quote from: ehughes on May 31, 2019, 07:00:30 pmAnd indeed something was ...One of the ground pin was floating. Solder that back and I get the USB as Mass storage.But now it is always booting in ISP mode, just to be sure I swapped the part, but it still only boots in ISP mode.I triple checked that PIO0_1 is to high, which it is, there is no glitch or anything, always at +3.3V.Looking at the boot process flowchart on page 396 of the documentation, it could be possible that the "user code valid" condition is failing.Quote from: imo on June 01, 2019, 10:05:20 amI mean they always stay high, and I'm not expecting them to stay high even when it is supposed to be flashingI'm using the UART interface on the blackmagic probe, but I'm not sure how to tell it, or if it uses by default the UART interface.I'm gonna give it another try later on today with a binary from the NXP IDE just in case.

author: rstofer
author_rank: Super Contributor
timestamp: June 01, 2019, 02:45:51 pm
content: I haven't used the 11U34 but on other variants (LPC2148, LPX2106), a magic number had to be in a particular place in the flash code. It was essentially the checksum of the vector values. At boot time the ISP engine adds up all the vectors and if it turns out to be 0, the user code is executed. This should be detailed in the datasheet or user manual.For the 2106, section 5.2 describes how this works:https://www.nxp.com/docs/en/user-guide/UM10275.pdf

author: Headless Chicken
author_rank: Newbie
timestamp: June 01, 2019, 08:58:50 pm
content: That was a good guess rstofer, I was also looking at that, trying to figure out what constitute a valid user code.In the meantime, I made a binary using the NXP IDE, I only managed to get a blank project (impossible to figure out what, package, sdk or what not, I needed to get the base libraries) but it had the checksum at 0x1c which my rejected binaries were missing.For future reference, thanks to this Github issuehttps://github.com/platformio/platform-nxplpc/issues/6I am now usinghttps://github.com/basilfx/lpc_checksumto patch my binaries and add the missing checksum that platformio seems not to put in.Thank you all for your help, I guess we can call this a solved case!

author: rstofer
author_rank: Super Contributor
timestamp: June 01, 2019, 09:03:31 pm
content: It wasn't really a guess... I have been down this road a ways.If your vectors always point to stubs in the .S file then the values never change and, once calculated, you are all set.