Author Topic: Issues programming NXP LPC11U34  (Read 1846 times)

0 Members and 1 Guest are viewing this topic.

Offline Headless ChickenTopic starter

  • Newbie
  • Posts: 8
  • Country: de
Issues programming NXP LPC11U34
« on: May 30, 2019, 12:46:49 pm »
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 location
So 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  :o. 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,
 

Offline iMo

  • Super Contributor
  • ***
  • Posts: 5570
  • Country: va
Re: Issues programming NXP LPC11U34
« Reply #1 on: May 30, 2019, 01:03:42 pm »
« Last Edit: May 30, 2019, 01:12:16 pm by imo »
Readers discretion is advised..
 

Offline Headless ChickenTopic starter

  • Newbie
  • Posts: 8
  • Country: de
Re: Issues programming NXP LPC11U34
« Reply #2 on: May 30, 2019, 01:31:36 pm »
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.
 

Offline iMo

  • Super Contributor
  • ***
  • Posts: 5570
  • Country: va
Re: Issues programming NXP LPC11U34
« Reply #3 on: May 30, 2019, 02:00:46 pm »
Quote
Once ISP mode has been entered, the USB VBUS line PIO0_3 is checked. If high, then USB ISP will be entered. If low, UART ISP will be entered instead.
Your PIO0_3 is floating, afaik..

Place a 10k pullup there..
« Last Edit: May 30, 2019, 02:02:33 pm by imo »
Readers discretion is advised..
 

Offline Headless ChickenTopic starter

  • Newbie
  • Posts: 8
  • Country: de
Re: Issues programming NXP LPC11U34
« Reply #4 on: May 30, 2019, 02:50:43 pm »
I haven't included the full schematics but PIO0_3 pin is connected to a header with a jumper wire to VCC.
 

Offline dietert1

  • Super Contributor
  • ***
  • Posts: 2473
  • Country: br
    • CADT Homepage
Re: Issues programming NXP LPC11U34
« Reply #5 on: May 30, 2019, 03:06:47 pm »
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
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 28429
  • Country: nl
    • NCT Developments
Re: Issues programming NXP LPC11U34
« Reply #6 on: May 30, 2019, 06:26:12 pm »
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.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline Headless ChickenTopic starter

  • Newbie
  • Posts: 8
  • Country: de
Re: Issues programming NXP LPC11U34
« Reply #7 on: May 30, 2019, 08:37:17 pm »
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.
I 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 ...

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.
As 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+?
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 28429
  • Country: nl
    • NCT Developments
Re: Issues programming NXP LPC11U34
« Reply #8 on: May 30, 2019, 10:24:38 pm »
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.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline Headless ChickenTopic starter

  • Newbie
  • Posts: 8
  • Country: de
Re: Issues programming NXP LPC11U34
« Reply #9 on: May 31, 2019, 04:23:38 am »
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.
You 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 ...
 

Offline iMo

  • Super Contributor
  • ***
  • Posts: 5570
  • Country: va
Re: Issues programming NXP LPC11U34
« Reply #10 on: May 31, 2019, 06:23:08 am »
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:
Quote
USB_VBUS - A LOW level on this pin during reset starts the ISP command handler, a HIGH level starts the USB device enumeration.

I 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.

Quote
A LOW level during reset applied to the PIO0_1 pin is considered as an external hardware request to start the ISP command handler or the USB device enumeration. The state of PIO0_3 determines whether the UART or USB interface will be used (LPC1342/43 only).

Thus (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.
« Last Edit: May 31, 2019, 07:33:44 am by imo »
Readers discretion is advised..
 

Offline Headless ChickenTopic starter

  • Newbie
  • Posts: 8
  • Country: de
Re: Issues programming NXP LPC11U34
« Reply #11 on: May 31, 2019, 04:09:01 pm »
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?
 

Offline ehughes

  • Frequent Contributor
  • **
  • Posts: 410
  • Country: us
Re: Issues programming NXP LPC11U34
« Reply #12 on: May 31, 2019, 07:00:30 pm »
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.


« Last Edit: May 31, 2019, 07:03:04 pm by ehughes »
 

Offline iMo

  • Super Contributor
  • ***
  • Posts: 5570
  • Country: va
Re: Issues programming NXP LPC11U34
« Reply #13 on: June 01, 2019, 10:05:20 am »
Quote
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.

1. press down USB_FToggle
2. press down Reset
3. release Reset
4. release USB_FToggle
all with the PIO0_3 to ground for UART bootloader.

Quote
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?

Rx 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 RX
Board RX ----1k-----UARTusbdongle  TX
Board GND-----------UARTusbdongle GND
« Last Edit: June 01, 2019, 10:20:46 am by imo »
Readers discretion is advised..
 

Offline Headless ChickenTopic starter

  • Newbie
  • Posts: 8
  • Country: de
Re: Issues programming NXP LPC11U34
« Reply #14 on: June 01, 2019, 11:01:04 am »
It sounds like something is wrong in your physical layout.
And indeed something was ...  |O 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.

Rx and Tx are idle High, that is ok.

I mean they always stay high, and I'm not expecting them to stay high even when it is supposed to be flashing  ;D
I'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.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9963
  • Country: us
Re: Issues programming NXP LPC11U34
« Reply #15 on: June 01, 2019, 02:45:51 pm »
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
 

Offline Headless ChickenTopic starter

  • Newbie
  • Posts: 8
  • Country: de
Re: Issues programming NXP LPC11U34
« Reply #16 on: June 01, 2019, 08:58:50 pm »
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 issue https://github.com/platformio/platform-nxplpc/issues/6 I am now using https://github.com/basilfx/lpc_checksum to 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!
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9963
  • Country: us
Re: Issues programming NXP LPC11U34
« Reply #17 on: June 01, 2019, 09:03:31 pm »
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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf