Hi all,
I am using F28M36x device. For that usb_dev_serial code i am taking from F28M35x( someone suggest this in forum, because F28M36x was building ). In this usb_dev_serial project transmitter is working fine with my device. But receiver is not working. See my code below. Please help me ASAP.
###############################################################################################################################################
int
main(void)
{
unsigned char pucData[15];
unsigned long ulLength;
// Disable Protection
HWREG(SYSCTL_MWRALLOW) = 0xA5A5A5A5;
// Setup main clock tree for 75MHz - M3 and 150MHz - C28x
SysCtlClockConfigSet(SYSCTL_SYSDIV_1 | SYSCTL_M3SSDIV_2 | SYSCTL_USE_PLL |
(SYSCTL_SPLLIMULT_M & 0x0F));
// Setup USB clock tree for 60MHz
// 20MHz * 12 / 4 = 60
SysCtlUSBPLLConfigSet(
(SYSCTL_UPLLIMULT_M & 12) | SYSCTL_UPLLCLKSRC_X1 | SYSCTL_UPLLEN);
// Setup pins for USB operation
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
GPIOPinTypeUSBAnalog(GPIO_PORTF_BASE, GPIO_PIN_6);
GPIOPinTypeUSBAnalog(GPIO_PORTG_BASE, GPIO_PIN_2 | GPIO_PIN_5 | GPIO_PIN_6);
// Enable the UART.
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
// Enable and configure the UART RX and TX pins
// Set GPIO E4 and E5 as UART.
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
GPIOPinTypeUART(GPIO_PORTE_BASE, GPIO_PIN_4 | GPIO_PIN_5);
GPIOPinConfigure(GPIO_PE4_U0RX);
GPIOPinConfigure(GPIO_PE5_U0TX);
// Set the default UART configuration.
UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(SYSTEM_CLOCK_SPEED), 115200,
UART_CONFIG_WLEN_8 | UART_CONFIG_PAR_NONE |
UART_CONFIG_STOP_ONE);
UARTFIFOLevelSet(UART0_BASE, UART_FIFO_TX4_8, UART_FIFO_RX4_8);
// Configure and enable UART interrupts.
UARTIntClear(UART0_BASE, UARTIntStatus(UART0_BASE, false));
UARTIntEnable(UART0_BASE, (UART_INT_OE | UART_INT_BE | UART_INT_PE |
UART_INT_FE | UART_INT_RT | UART_INT_RX));
// Initialize the transmit and receive buffers.
USBBufferInit(&g_sTxBuffer);
USBBufferInit(&g_sRxBuffer);
// Register interrupt handler in the RAM vector table
IntRegister(INT_USB0, USB0DeviceIntHandler);
IntRegister(INT_UART0, USBUARTIntHandler);
// Set the USB stack mode to Device mode with VBUS monitoring.
USBStackModeSet(0, USB_MODE_DEVICE, 0);
// Pass the device information to the USB library and place the device
// on the bus.
USBDCDCInit(0, &g_sCDCDevice);
// Enable interrupts now that the application is ready to start.
IntEnable(INT_UART0);
UARTIntEnable(0, UART_INT_TX);
UARTIntEnable(0, UART_INT_RX);
// Main application loop.
ulLength = 0;
while(1)
{
ulLength = USBBufferRead((tUSBBuffer *)&g_sRxBuffer,pucData,15);
if (ulLength )
{
USBBufferWrite((tUSBBuffer *)&g_sTxBuffer,&pucData,15);
ulLength = 0;
}
}
}
###############################################################################################################################################
Sometimes i get some collapsed value.( e.g input is "Texas instruments" means some times "ments Tesas" , "instrum Texas", "Texas Texas instrum")
Please help me to fix this problem.