This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Subject: [USB][Host][TM4C1237H6PZ] Problems with usb_stick_update.

Other Parts Discussed in Thread: TM4C1237H6PZ, LM3S3739

Hardware: our own board with a TM4C1237H6PZ, 16Mhz crystal, 50MHz MOSC;
          we have an USB Type A connector used for connecting usb sticks;
          the USB0ID and USB0VBUS will not be used as the pins are required
          for other purposes; the OTG/Device functionality of the micro
          are not used, only host.

Software:"official" ARM gcc compiler downloaded from <https://launchpad.net/gcc-arm-embedded>, version 4.8_2013q4;
          relevant compilation flags used: -Os -g3 -mthumb
                                           -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp
                                           -Dgcc -DPART_TM4C1237H6PZ -DTARGET_IS_BLIZZARD_RB1
                                           (tested also with -O0)
          TivaWare 2.0.1.11577
          project copied from SW-TM4C-2.0.1.11577/examples/boards/dk-tm4c123g/usb_stick_update

We changed the usb_stick_update.c file, function ConfigureUSBInterface(), to configure the correct
pins for the TM4C1237H6PZ: PJ0 and PJ1 (DP and DM) and PD2 (USB0EPEN).
We removed references to USB0ID and USB0VBUS.

void
ConfigureUSBInterface(void)
{
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);
    uDMAEnable();
    uDMAControlBaseSet(g_sDMAControlTable);

    SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOJ);

    // EPEN
    GPIOPinConfigure(GPIO_PD2_USB0EPEN);
    GPIOPinTypeUSBDigital(GPIO_PORTD_BASE, GPIO_PIN_2);

    // DP e DM
    GPIOPinTypeUSBAnalog(GPIO_PORTJ_BASE, GPIO_PIN_0 | GPIO_PIN_1);

    USBHCDRegisterDrivers(0, g_ppHostClassDrivers, NUM_CLASS_DRIVERS);
    g_psMSCInstance = USBHMSCDriveOpen(0, MSCCallback);
    USBHCDPowerConfigInit(0, USBHCD_VBUS_AUTO_HIGH | USBHCD_VBUS_FILTER);
    USBStackModeSet(0, eUSBModeForceHost, 0);

    // Wait 10ms for the pin to go low.
    SysCtlDelay(16667 * 100);

    // Initialize the host controller.
    USBHCDInit(0, g_pHCDPool, HCD_MEMORY_SIZE);
}


When we insert an USB stick it gets recognized and the enumeration process is properly finished;
the program then enters the ReadAppAndProgram() function and then USBHMSCDriveReady();

And here remains blocked forever:

USBHCDPipeRead (ui32Pipe=ui32Pipe@entry=0, pui8Data=pui8Data@entry=0x20000688 "\241\376", ui32Size=4294967278)
    at host/usbhostenum.c:2151
2151                if(g_sUSBHCD.psUSBINPipes[ui32PipeIdx].iState == ePipeDataReady)
(gdb) bt
#0  USBHCDPipeRead (ui32Pipe=ui32Pipe@entry=0, pui8Data=pui8Data@entry=0x20000688 "\241\376",
    ui32Size=4294967278) at host/usbhostenum.c:2151
#1  0x00002c62 in USBHSCSISendCommand (ui32InPipe=0, ui32OutPipe=0, psSCSICmd=psSCSICmd@entry=0x20000644,
    pui8Data=pui8Data@entry=0x20000688 "\241\376", pui32Size=pui32Size@entry=0x20000684) at host/usbhscsi.c:125
#2  0x00002d84 in USBHSCSIRequestSense (ui32InPipe=<optimized out>, ui32OutPipe=<optimized out>,
    pui8Data=pui8Data@entry=0x20000688 "\241\376", pui32Size=pui32Size@entry=0x20000684) at host/usbhscsi.c:589
#3  0x000013fc in USBHMSCDriveReady (psMSCInstance=0x2000079c) at host/usbhmsc.c:407
#4  0x0000029e in ReadAppAndProgram () at bootloader.c:370
#5  0x0000039a in UpdaterUSB () at bootloader.c:593
#6  0x00000496 in UpdaterMain () at bootloader.c:750
#7  0x000004ee in main () at bootloader.c:809


if we remove the USBHMSCDriveReady() call it remains stuck in the next function call (SimpleFsInit()).

It is blocked in a while(1) loop inside USBHCDPipeRead() in yours usblib; it seems that it fails in
sending SCSI commands.

We have an older board with a LM3S3739 with the "same" program and is working with the same USB stick.

We do not have the knowledge to debug the usblib or an USB transaction.

Do you see any problem in the code?
Can you give us a hint on were to start debugging the problem?
Do you have the dk-tm4c123g board? Can you try the usb_stick_update program and verify that it works?

Thank you

  • Hi Fabio,

         So you use the old usb_stick_update for Stellaris microcontroller and just modified some gpio pin configuration for TM4C1237H6PZ? Am, I correct?

         I think it would be more appropriate to modify usb_stick_update for Tiva microcontroller for your microcontroller.

    -kel