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.

TM4C123GH6PM: Implement firmware update by USB Stick

Part Number: TM4C123GH6PM
Other Parts Discussed in Thread: TM4C123GH6PZ, EK-TM4C1294XL, TM4C123GH6PGE, TPS2052B

Dear, 

   I want to use the USB Stick for Firmware update. The following is my circuit diagram. Boot code I used usb_stick_update in dk-m4c123g in TivaWare.

I have special attention to APP STAR Address 0x4800 in my Application Code and setting 
However, when I press the button (Port F.4) while Power On, the program seems to have entered the Boot Code but there is no response. Please give advice .

Thanks & Best Regards

Leo Liao 

  • If the device contains only the code from "usb_stick_update" will it load an application code from the USB stick? You can use JTAG to check that the flash at 0x4800 is blank before, and contains code afterwards.
  •    I found that the usb_stick_update for DK-TM4C123G is using PL6 (USBDP) and PL7 (USBDM), 

    However, the MCU TM4C123GH6PZ I chose does not have PL6 and PL7.

    I tried to modify the ConfigureUSBInterface() of TivaWare_C_Series-2.1.4.178\examples\boards\dk-tm4c123g\usb_stick_update

    Changed from PL6.PL7 to PJ0.PJ1 

    Still not work, please give advice

    Blue words are my modify content

    Best Regards
    Leo Liao

    void
    ConfigureUSBInterface(void)
    {
    //
    // Enable the uDMA controller and set up the control table base.
    // This is required by usblib.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);
    uDMAEnable();
    uDMAControlBaseSet(g_sDMAControlTable);

    //
    // Enable the USB controller.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0);

    //
    // Set the USB pins to be controlled by the USB controller.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
    ROM_GPIOPinConfigure(GPIO_PG4_USB0EPEN);
    ROM_GPIOPinTypeUSBDigital(GPIO_PORTG_BASE, GPIO_PIN_4);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOJ);
    ROM_GPIOPinTypeUSBAnalog(GPIO_PORTJ_BASE, GPIO_PIN_0 | GPIO_PIN_1);
    ROM_GPIOPinTypeUSBAnalog(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);

    //
    // 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_HIGH | 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.
    //
    SysCtlDelay(SysCtlClockGet()/100);

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

    }

  • Hello Leo,

    What hardware is this running on? A custom board? The LaunchPad?

    Do you have connections for USBID and VBUS made so the TM4C can operate in Host Mode? Can you verify the VBUS voltage?

    From an API standpoint, those two calls should be sufficient as the USB0VBUS and USB0ID are still on Port B and USB0EPEN is still on Port G.
  • Dear Ralph,

       I found that the control polarity of the Power Switch (AP2141) I used is incorrect, the modified circuit as follow, I also tried to connect 

    USB0ID and USB0VBUS directly, Still fail, I put the waveform I measured on the web page,  see if you can give advice. By the way, there is no short circuit between USB0VBUS and USB0ID (EK-TM4C1294XL)

    EK-TM4C1294XL (Correct) 

    USB0VBUS and USB_DM

    Our own schematic (Error) 

    USB0VBUS and USB_DM

  • Hello Leo,

    I am travelling today so I haven't been able to look into this in detail today, I'll give you some feedback tomorrow.
  • Hello Leo,

    Sorry for the delay, looking at your schematic, I have to say I am not familiar with the AP2141. But even so, I do not understand at all why you need that BJT on it. It doesn't show anything like that in the recommended schematic.

    If you bypass the AP2141, does the USB operate correctly? I think that how the AP2141 is the root cause here, and since it's not a TI device I have limited feedback to offer.

    If you do see that that USB works when the AP2141 is bypassed, the only recommendation I could make is that I would investigate the timing of that signal against the specifications for the AP2141 and also the USB 2.0 specifications and make sure it is operating correctly with your modifications.

    Also I would ask you reference our system design guidelines and verify all recommendations in terms of schematic, layout etc. have been address for your system: www.ti.com/.../spma059.pdf
  • Hi Ralph,

        In the development board of DK-TM4C123G and EK-TM4C1294XL, There is an USB VBUS Load Switch TPS2052BDRB, you should know the purpose of this IC, Since our company has many AP2141WGs stocks, the function is the same as the TPS2052BDRB. Only the polarity of the control power output pin is different, so BJT is added for it.

         Your previous suggested USB0VBUS and USB0ID need to be connected together, bypass the AP2141WG, I tried but fail

        Finally, I attach my schematic and code, I hope you can come up with an effective solution.

     
    Because the code usb_stick_update in DK-TM4C123G is using TM4C123GH6PGE, but I am using
    TM4C123GH6PZ, blue word is my modified content

    void
    ConfigureUSBInterface(void)
    {
    //
    // Enable the uDMA controller and set up the control table base.
    // This is required by usblib.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);
    uDMAEnable();
    uDMAControlBaseSet(g_sDMAControlTable);

    //
    // Enable the USB controller.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0);

    //
    // Set the USB pins to be controlled by the USB controller.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
    ROM_GPIOPinConfigure(GPIO_PG4_USB0EPEN);
    ROM_GPIOPinTypeUSBDigital(GPIO_PORTG_BASE, GPIO_PIN_4);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOJ);
    ROM_GPIOPinTypeUSBAnalog(GPIO_PORTJ_BASE, GPIO_PIN_0 | GPIO_PIN_1);
    ROM_GPIOPinTypeUSBAnalog(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);

    //
    // 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_HIGH | 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.
    //
    SysCtlDelay(SysCtlClockGet()/100);

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

    }

  • Hello Leo,

    Hold on, I did not say that the USB0VBUS and USB0ID signals should be tied together!!

    That should never be done.

    USB0VBUS goes to the USB connector and provides power to the USB device.

    USB0ID also goes to the USB connector, and helps determine the kind of USB device plugged in per USB specs.

    They never are tied together.

    The power switch you are using that you are trying to use is meant to prevent excessive current flows during hot-swap situations, so my idea was to temporarily bypass the circuit just to test if the circuit is what is wrong, which really would just means not using USB0EPEN and USB0PFLT to control power to the device and just directly source it with VBUS. It sounds like that is not easy to do though, so I have an alternative debug method.

    Another test you can do instead would be to monitor the signals for USB0VBUS, USB0ID, USB0EPEN, USB0PFLT, and the voltage output of the TPS2052B on the LaunchPad and compare that to your system. This could reveal that one or more of those signals are not behaving in the same manner and offer insight on what could be the root cause.

    Also while on the topic of the power switch on your schematic, you should use USB0VBUS as the input for it, not 5V.

    Lastly I will ask again if you have reviewed the System Design Guidelines document at all? There are a number of very key layout requirements that need to be followed for USB, and you must verify this board follows them or you will not be able to get USB working. Once more the link for this is: www.ti.com/.../spma059.pdf