lpc4357 USB,Ethernet with Fre RTOS getting Hardfault

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

lpc4357 USB,Ethernet with Fre RTOS getting Hardfault

727 Views
amarnath_jakkam
Contributor I

I am using LPC 4357 with free RTOS. I require USB and Ethernet communication. Iam using USB1 as my USB communication port. I configured two tasks for USB and ethernet using LPCopen library. But while running both tasks getting  hanged. please help me

here is my USB initilization

void intialize_USB_CDC(void){
USBD_API_INIT_PARAM_T usb_param;
USB_CORE_DESCS_T desc;
ErrorCode_t ret = LPC_OK;
USB_CORE_CTRL_T *pCtrl;

Chip_SCU_PinMuxSet(0x2, 5, (SCU_MODE_INACT | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_FUNC2)); /* P2_5 USB1_VBUS, MUST CONFIGURE THIS SIGNAL FOR USB1 NORMAL OPERATION */

/* enable clocks and pinmux */
USB_init_pin_clk();

/* Init USB API structure */
g_pUsbApi = (const USBD_API_T *) LPC_ROM_API->usbdApiBase;

/* initialize call back structures */
memset((void *) &usb_param, 0, sizeof(USBD_API_INIT_PARAM_T));
usb_param.usb_reg_base = LPC_USB_BASE;
usb_param.max_num_ep = 4;
usb_param.mem_base = USB_STACK_MEM_BASE;
usb_param.mem_size = USB_STACK_MEM_SIZE;

/* Set the USB descriptors */
desc.device_desc = (uint8_t *) USB_DeviceDescriptor;
desc.string_desc = (uint8_t *) USB_StringDescriptor;
#ifdef USE_USB0
desc.high_speed_desc = USB_HsConfigDescriptor;
desc.full_speed_desc = USB_FsConfigDescriptor;
desc.device_qualifier = (uint8_t *) USB_DeviceQualifier;
#else
/* Note, to pass USBCV test full-speed only devices should have both
* descriptor arrays point to same location and device_qualifier set
* to 0.
*/
desc.high_speed_desc = USB_FsConfigDescriptor;
desc.full_speed_desc = USB_FsConfigDescriptor;
desc.device_qualifier = 0;
#endif

/* USB Initialization */
ret = USBD_API->hw->Init(&g_hUsb, &desc, &usb_param);
if (ret == LPC_OK) {

/* WORKAROUND for artf45032 ROM driver BUG:
Due to a race condition there is the chance that a second NAK event will
occur before the default endpoint0 handler has completed its preparation
of the DMA engine for the first NAK event. This can cause certain fields
in the DMA descriptors to be in an invalid state when the USB controller
reads them, thereby causing a hang.
*/
pCtrl = (USB_CORE_CTRL_T *) g_hUsb; /* convert the handle to control structure */
g_Ep0BaseHdlr = pCtrl->ep_event_hdlr[0];/* retrieve the default EP0_OUT handler */
pCtrl->ep_event_hdlr[0] = EP0_patch;/* set our patch routine as EP0_OUT handler */

/* Init VCOM interface */
ret = vcom_init(g_hUsb, &desc, &usb_param);
if (ret == LPC_OK) {
/* enable USB interrupts */
NVIC_EnableIRQ(LPC_USB_IRQ);
/* now connect */
USBD_API->hw->Connect(g_hUsb, 1);
}

}
}

Ethernet configuration

static void setupEthernetHardware(void)
{
/* LED0 is used for the link status, on = PHY cable detected */


//New Board
DEBUGOUT("With out FPGA Baord\r\n");
Chip_SCU_PinMuxSet(0xC, 4, (SCU_PINIO_FAST | SCU_MODE_FUNC3));//TX_EN
Chip_SCU_PinMuxSet(0x2, 0, (SCU_MODE_PULLUP | SCU_MODE_FUNC7));//MDC

}

Labels (3)
0 Kudos
3 Replies

528 Views
jeremyzhou
NXP Employee
NXP Employee

Hi  Amarnath J,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
I'd like to know the more information about this issue, for instance, whether you can share the compile-able demo which can replicate the phenomenon and introduce the testing process, etc.
I'm looking forward to your reply.
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

528 Views
amarnath_jakkam
Contributor I

Hi Jeremyzhou,

   Thanks for the reply. I am using the lpc open 3.02 library. Here I am uploading sample code of freertos with USB and ethernet. extract this project in lpcopen_3_02_keil\LPC43xx_18xx\prj_mcb4357\keil. 

0 Kudos

528 Views
jeremyzhou
NXP Employee
NXP Employee

Hi  Amarnath J,
I think you'd better introduce the process of the replicate the Hard fault issue, as I haven't encountered it when I debug the demo.
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos