Hello i have recently gotten my hands on the launchpad with the tm4c123g
I am now trying to get the launchpad connected to the PC as a mass storage device using the usblib that i downloaded from here:
http://www.ti.com/tool/sw-tm4c
My (Basic) code looks like this:
// ******************************************************************************************* // // System clock settings // // ******************************************************************************************* // Set clock settings to the default of 12.5Mhz, used crystal is 16 Mhz uint32_t RCC = (SYSCTL_RCC_XTAL_16MHZ | SYSCTL_RCC_USESYSDIV | (0x15 << SYSCTL_RCC_SYSDIV_S) ); // Oscillator is a 16MhZ crystal, PLL is used so SYSDIV is needed (defaults to 15 for 12.5Mhz clock) SYSCTL_RCC_R = RCC; // Override certain register values of the RCC register with the values of the RCC2 register so that we can set the clock speed to 80Mhz uint32_t RCC2 = (SYSCTL_RCC2_USERCC2 | SYSCTL_RCC2_DIV400 | (2 << SYSCTL_RCC2_SYSDIV2_S) ); SYSCTL_RCC2_R = RCC2; //*************************************************************** // // string descriptors for USB // //*************************************************************** // language const uint8_t langDescriptor[] = { 4, // 1st byte gives descriptor length in bytes. USB_DTYPE_STRING, // Descriptor type USBShort(USB_LANG_EN_US) // Language code in 2 bytes (0x0409) }; // Manufacturer const uint8_t manuDescriptor[] = { ( 7 + 1 ) * 2 , // 1st byte gives descriptor length in bytes. USB_DTYPE_STRING, // Descriptor type 'A', 0, 'r', 0, 't', 0, 'i', 0, 'n', 0, 'i', 0, 's', 0, }; // Product const uint8_t productDescriptor[] = { ( 7 + 1 ) * 2 , // 1st byte gives descriptor length in bytes. USB_DTYPE_STRING, // Descriptor type 'A', 0, 'r', 0, 't', 0, 'i', 0, 'n', 0, 'i', 0, 's', 0, }; // Serial number const uint8_t serialDescriptor[] = { ( 7 + 1 ) * 2 , // 1st byte gives descriptor length in bytes. USB_DTYPE_STRING, // Descriptor type 'A', 0, 'r', 0, 't', 0, 'i', 0, 'n', 0, 'i', 0, 's', 0, }; const uint8_t * const stringDescriptors[] = { langDescriptor, manuDescriptor, productDescriptor, serialDescriptor, productDescriptor, productDescriptor }; tUSBDMSCDevice deviceInfo = { USB_VID_TI_1CBE, // UID USB_PID_MSC, // PID "Artinis ", // Vendor "PortaProto ", // Product "0.01", // Revision 500, // Power usage USB_CONF_ATTR_SELF_PWR, // Power type, bus powered stringDescriptors, // String descriptors 6, { USBDMSCStorageOpen, USBDMSCStorageClose, USBDMSCStorageRead, USBDMSCStorageWrite, USBDMSCStorageNumBlocks }, usbEventCallback, // USB callback function 0 // We dont use DMA }; void* result = USBDMSCInit(0, &deviceInfo); while(1);
Now when running this code as soon as it enters the main i get these errors in the debug window:
And the device enters the FaultISR(void) routine.
When is remove the tUSBDMSCDevice struct initialization and replace it with the following:
/*tUSBDMSCDevice deviceInfo = { USB_VID_TI_1CBE, // UID USB_PID_MSC, // PID "Artinis ", // Vendor "PortaProto ", // Product "0.01", // Revision 500, // Power usage USB_CONF_ATTR_SELF_PWR, // Power type, bus powered stringDescriptors, // String descriptors 6, { USBDMSCStorageOpen, USBDMSCStorageClose, USBDMSCStorageRead, USBDMSCStorageWrite, USBDMSCStorageNumBlocks }, usbEventCallback, // USB callback function 0 // We dont use DMA }; void *result = USBDMSCInit(0, &deviceInfo);*/ void *result = USBDMSCInit(0, NULL);
The code runs fine! (without usb offcourse)
Can anyone help me with debugging this problem? The code compiles without error or warnings.
Thank you,
Sisco