Hi,
I'm Jonny and this is the first time that i try to open a POST;
I'm trying to configure a TM4C123GH6PM microcontroller like an host device in order to have the possibility to connect a pen drive.
i'm using an example i found for the tm4c123g CAN+USB development board to configure my microcontroller; I have configure everything in the property of the project to use it for my device ( or better i hope there is no strange setting that i completely forget to set ).
When i try do debug it i found a strange error when i reach a precise point of the program; in the following i will try to give you some piece of my code and the exact point where i have the problem
CONFIGURATION OF THE USB ( BASICALLY I COPY IT FROM THE EXAMPLE )
*IMPORTANT : In my custom board the EPEN pin is active low so you will see that i have configure it for this behaviour*
ConfigureUSBInterface(void)
{
//
// Enable the uDMA controller and set up the control table base.
// This is required by usblib.
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);
uDMAEnable();
uDMAControlBaseSet(g_sDMAControlTable);
//
// Enable the USB controller.
//
//
// Set the USB pins to be controlled by the USB controller.
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
GPIOPinConfigure(GPIO_PC6_USB0EPEN);
GPIOPinTypeUSBDigital(GPIO_PORTC_BASE, GPIO_PIN_6);
GPIOPinConfigure(GPIO_PC7_USB0PFLT);
GPIOPinTypeUSBDigital(GPIO_PORTC_BASE, GPIO_PIN_7);
GPIOPinTypeUSBAnalog(GPIO_PORTD_BASE, GPIO_PIN_5 | GPIO_PIN_4);
GPIOPinTypeUSBAnalog(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);
SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0);
//
// Register the host class driver
//
USBHCDRegisterDrivers(0, g_ppHostClassDrivers, NUM_CLASS_DRIVERS);
//
// Open an instance of the mass storage class driver.
//
g_psMSCInstance = USBHMSCDriveOpen(0, MSCCallback);
//
// Initialize the power configuration. This sets the power enable signal
// to be active high and does not enable the power fault.
//
USBHCDPowerConfigInit(0, USBHCD_VBUS_AUTO_LOW | USBHCD_VBUS_FILTER );//| USBHCD_VBUS_FILTER
//
// Force the USB mode to host with no callback on mode changes since
// there should not be any.
//
USBStackModeSet(0, eUSBModeForceHost, 0);
//
// Wait 10ms for the pin to go low.
//
clock = SysCtlClockGet();
SysCtlDelay(SysCtlClockGet()/100);
//
// Initialize the host controller.
//
USBHCDInit(0, g_pHCDPool, HCD_MEMORY_SIZE);
}
*THIS IS THE EXACT POINT WHERE I HAVE THE PROBLEM*
So it seam like when i try to power on the USB the debug give me a fault
//////// ERROR I RECEIVE ON CODECOMPOSER
CORTEX_M4_0: Error connecting to the target
CORTEX_M4_0: Can't Run Target CPU: Debug Port error occurred.
///////
void
USBHostPwrEnable(uint32_t ui32Base)
{
//
// Check the arguments.
//
ASSERT(ui32Base == USB0_BASE);
//
// Enable the external power supply enable signal.
//
HWREGH(ui32Base + USB_O_EPC) |= USB_EPC_EPENDE; <--------this register configuration give me the fault
}
i have try a lot of different solution but nothing seam to work ; the pen drive has a led on it so i can see that it light on for 1 sec ;i measure the VBUS , the EPEN and the PFLT and everything is ok.
Thanks in advance for you help and for any other question just ask