Issue initializing USBFSD on LPC55S69

cancel
Showing results for 
Search instead for 
Did you mean: 

Issue initializing USBFSD on LPC55S69

456 Views
nickray
Contributor I

I'm trying to write a Rust USB FS device driver for the LPC55S6x chips, using the LPC55S69-EVK board.

I'm using gdb to connect via JLinkGDBServer to a J-Link OB.

Following section 41.3 of UM11126, I'm trying to set DEV_ENABLE in the USBFSH PortMode register. This fails, and I can't even read out the value of this bit. Instead JLinkGDBServer starts losing connection to the device.

Is there any known reason why reading and writing the portmode might fail? Possibly some detail specific to the EVK board?

To make matters worse, I can no longer connect at all:

Connecting to target...ERROR: InitTarget(): PCode returned with error code -1

ERROR: Could not connect to target.

And even mass erasing flash via JFlashLite with J10 set fails.

So while I wait for a replacement board, any pointers are very much appreciated.

Labels (2)
Tags (1)
0 Kudos
2 Replies

282 Views
nickray
Contributor I

I managed to solve my issue: USB0CLKDIV.HALT needs to be cleared.

- when using the 96MHz clock, flash wait cycles need to be set to 8 via the field FMCTIM in the register FMCCR of SYSCON.

- very much harder figure out for me was that USB0CLKDIV has a reset HALT value of 1 (not running), this needs to be explicitly cleared. The CLOCK_SetClkDiv function in the sample code manages to hide this quite well!! As it has a code path that explicitly sets the bit, vs implicitly clearing it when assigning "divisor minus one". Since I use a register-access layer generated from the SVD, this was completely non-obvious to me.

0 Kudos

282 Views
FelipeGarcia
NXP TechSupport
NXP TechSupport

Hi Nicolas,

 

Regarding the debug access I recommend you to check the following post and try booting into ISP mode.

Regaining debug access to target MCU 

Regarding the PortMode register issue, please make sure you turn on the USB PHY in PDRUNCFG0 register. Also you need to Enable port mode configuration by setting the USB0_HOSTS in the AHBCLKCTRL2 register.

 

I recommend you to check our examples from the SDK so you have a better approach to what you need to do in order to implement your own USB driver. You can download the SDK from the following link.

Welcome | MCUXpresso SDK Builder 

Hope it helps!

 

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