LPC5528 ISP on USB0

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

LPC5528 ISP on USB0

Jump to solution
2,878 Views
jplathuile
Contributor III

HI,

I have made a board with an LPC5528, and wired it to receive ISP from USB0, according to LPC55S2x/LPC552x Data sheet on page 2 and UM11126 on page 140.

At a time in the version of the UM there was no note "To enable USB0-FS ISP mode, see the BOOT_CFG (USB_SPEED. attached PFRexcel sheet) needs to be set." (which can't be set without a programmer and if I had a programmer I won't use ISP)

I have read from other topic that this problem is known.

Is the USB0 usable for ISP? (And how to)

Regards

JP

Labels (1)
1 Solution
2,832 Views
converse
Senior Contributor V

It could be a device permissions issue. Make sure you have read/write access to the usb hid device.

View solution in original post

8 Replies
1,444 Views
emblink182
Contributor III

Because disabled USB0 in ISP mode is a common problem, and NXP doesn't provide any code samples to enable it I will leave a code sample that will allow to unlock the USB 0 FS ISP mode. I have tested it with LPC5528 and it works, I was able to update the firmware in ISP mode with USB_0 and the blhost.exe tool more than 50 times without errors.

bool Usb0IspModeEnable(void)
{
    // This info is from a LPC55S6x_LPC55S2x_LPC552x Protected Flash Region v1.3.ods
    // which is an attachment to the UM11126 LPC55S6x/LPC55S2x/LPC552x User Manual
    // The register is configured to enable the USB FS ISP interface.
    #define FLASH_CMPA_BOOT_CFG_USB_ISP_MODE_MASK     (((1U << 9| (1U << 10)))
    #define FLASH_CMPA_BOOT_CFG_USB_ISP_MODE_SHIFT    (9U)
    #define FLASH_CMPA_BOOT_CFG_USB0_FS_ISP_MODE      (1U)
    #define FLASH_CMPA_BOOT_CFG_USB1_HS_ISP_MODE      (2U)

    static cmpa_cfg_info_t cmpa = {0};
    const uint32_t size = sizeof(cmpa);
   
    uint32_t status = FFR_GetCustomerData(&flashConfig, (uint8_t *)&cmpa, 0x0, size);
    if (status != kStatus_FLASH_Success) {
        return false;
    }

    cmpa.bootCfg &= (~FLASH_CMPA_BOOT_CFG_USB_ISP_MODE_MASK);  // clear bits
    cmpa.bootCfg |=
        ((FLASH_CMPA_BOOT_CFG_USB0_FS_ISP_MODE << FLASH_CMPA_BOOT_CFG_USB_ISP_MODE_SHIFT)
         & FLASH_CMPA_BOOT_CFG_USB_ISP_MODE_MASK);
   
    status = FFR_CustFactoryPageWrite(&flashConfig, (uint8_t *)&cmpa, 0);
    if (status != kStatus_FLASH_Success) {
        return false;
    }

    return true;
}
0 Kudos
2,837 Views
jplathuile
Contributor III

HI,

All LPC 5XXX are not the same and this one will not appear as a mass storage.
I shall use blhost to download the firmware.
But command:


./blhost -u 0x1fc9,0x0021 list-memory
return :
Error: UsbHidPeripheral() cannot open USB HID device (vid=0x1fc9, pid=0x0021, sn=)

but the chip enumerate has an hid device!!!


I think this chip is burned.

 

Regards

JP

0 Kudos
2,833 Views
converse
Senior Contributor V

It could be a device permissions issue. Make sure you have read/write access to the usb hid device.

2,817 Views
jplathuile
Contributor III

HI,

Changed permission to /dev/usb/hiddev0

and executed as root
sudo ./blhost -u 0x1fc9,0x0021 list-memory

and it work Yessssss !!!!!

Tks

JP

0 Kudos
2,863 Views
jplathuile
Contributor III

Hi,

I already have made a successful development with a LPC51U68 with hundred of downloading via ISP on USB0 and internal osc, without any problem.

My actual board is wired on USB0 and had no crystal, I have wired USB1 with flying wires and a 16 Meg crystal. With this arrangement I can enumerate the board on my computer.
Flying wire can't be a solution, soldering on 0.2mm pad is not reliable and I have to come back to USB0.

From now how to set BOOT_CFG?

JP

 

0 Kudos
2,862 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

If you really want to enable the USB0, the only way is set the CMPA : BOOT_CFG bit9 as 1.

then reset the chip. The ISP USB0 is enabled.

Becareful!!! Configure the CMPA area maybe lock the chip, pls take care of it.

ZhangJennie_0-1634896795688.png

 

Please note, if the ISP USB0 can't work on your side, we can't support by software. the limitation is on BOOTROM code. the only workaround is use ISP USB1.

Thanks,

Jun Zhang

0 Kudos
2,855 Views
jplathuile
Contributor III

The LPC5528 enumerate but doesn't open as a memory.

(Reset 0 and ISP 0 then reset 1 then isp 1)

Here is the result of :

lsusb -d1fc9:0021 -v

Bus 001 Device 059: ID 1fc9:0021 NXP Semiconductors USB COMPOSITE DEVICE
Couldn't open device, some information will be missing


Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x1fc9 NXP Semiconductors
idProduct 0x0021
bcdDevice 3.00
iManufacturer 1
iProduct 2
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0029
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xc0
Self Powered
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 3
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.00
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 76
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x003c 1x 60 bytes
bInterval 3
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x003c 1x 60 bytes
bInterval 3

 

dmesg :

[ 7849.331349] usb 1-9: USB disconnect, device number 59
[ 7851.111083] usb 1-9: new high-speed USB device number 60 using xhci_hcd
[ 7851.260231] usb 1-9: New USB device found, idVendor=1fc9, idProduct=0021, bcdDevice= 3.00
[ 7851.260253] usb 1-9: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 7851.260263] usb 1-9: Product: USB COMPOSITE DEVICE
[ 7851.260272] usb 1-9: Manufacturer: NXP SEMICONDUCTOR INC.
[ 7851.268191] hid-generic 0003:1FC9:0021.0032: hiddev0,hidraw1: USB HID v1.00 Device [NXP SEMICONDUCTOR INC. USB COMPOSITE DEVICE] on usb-0000:00:14.0-9/input0

 

 

JP

0 Kudos
2,869 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi JP,

You are right, ISP USB0 Boot is not enabled in CMPA by default. User can enable ISP USB0 boot  by configure  BOOT_CFG.

However according to our test and feedback from customer, sometimes ISP USB0 boot doesn't work well. This is because USB0 clock resource is from internal FRO, and bootrom doesn't support FRO trim. Thus when outside environment changes, for example temperature high or low, it doesn't work stable.

So I don't suggest using ISP USB0 . We have requested document team to remove ISP USB0 from UM.

ISP USB1 boot has no issue, if user wants to use ISP USB boot, I suggest using ISP USB1.

Hope this helps,

Jun Zhang

 

0 Kudos