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

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

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

639 Views
lpcware
NXP Employee
NXP Employee
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.
Labels (1)
0 Kudos
2 Replies

516 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Vandar501 on Wed Sep 23 01:10:30 MST 2015
Hi mc,

thanks it works! I thought the debugging build all projects, even the Includes. But still I am a bit confused about the bit that was set wrong. Because without changing this bit the USB-Connection won't work, but it should because its a USB-HID-Example...

0 Kudos

516 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Wed Sep 02 13:56:15 MST 2015
Hi Vandar501,
This function is inside chip library Did you build chip library project?
Which tool chain are you using?
0 Kudos