lpcware

USB Example for LPC4370: Problem with changing the SFSUSB bit in SCU register

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by Vandar501 on Tue Sep 01 06:31:40 MST 2015
Hi everybody,

I'm quite new to ARM-Architecture and currently I'm trying to set up an USB1-HID-Connection between a Custom made Board using an LPC4370 and a Laptop (University Project). I'm using an HID example for LPC4370 and LPCXpresso for programming.

After reading carefully the section about USB1 in the LPC43xx Manual I found out that I have to set the USB-VBUS bit in the SFSUSB register, which is locate in the System Control Unit to HIGH to USB1.
First I changed it manually in the main section and the USB-Connection works. But then I found the place where this bit is set by the Example itself. The Location was in the Project-Folder "lpc_chip_43xx" in "chip_18xx_43xx.c" in function "Chip_USB1_Init" and looks like this:



void Chip_USB1_Init(void)
{
/* Setup and enable the PLL */
Chip_USB_PllSetup();

/* USB1 needs a 60MHz clock. To get it, a divider of 4 and then 2 are
   chained to make a divide by 8 function. Connect the output of
   divider D to the USB1 base clock. */
Chip_Clock_SetDivider(CLK_IDIV_A, CLKIN_USBPLL, 4);
Chip_Clock_SetDivider(CLK_IDIV_D, CLKIN_IDIVA, 2);
Chip_Clock_SetBaseClock(CLK_BASE_USB1, CLKIN_IDIVD, true, true);

/* enable USB main clock */
Chip_Clock_EnableBaseClock(CLK_BASE_USB1);
Chip_Clock_EnableOpts(CLK_MX_USB1, true, true, 1);
/* enable USB1_DP and USB1_DN on chip FS phy.*/
LPC_SCU->SFSUSB = 0x12;                                              <-------------- this is important
}



I tried to change that with LPC_SCU->SFSUSB = 0x13; to set the respective bit but nothing happens! I can even comment this line out but nothing happens either. Maybe its because the lpc_chip_43xx Project is somehow protected.

Outcomes