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.

LM4F232 USB problem: from bulk device to ROM bootloader

Other Parts Discussed in Thread: EK-LM3S9D90

USB bulk device Stellarisware example is running on LM4F232 eva board with no problem.

In another sw project, also ROM bootloader is running with no problem, but the merge is not obvious !

I am trying to invoke ROM bootloader with bulk device already connected, but don't work ...

Is possible to have a list of actions to do  or an example to implement this critical switch ?

thks

  • The two USB applications can work together, but you will either need to implement a run-time DFU(USB boot loader) portion for your bulk example or you can handle this manually with a direct call.  There is a boot example(boot_demo_usb) in the ek-lm3s9d90 software release that shows how to implement this feature.  That may be more that you want to handle but it will handle a software triggered switch to DFU mode.  The other option is to enter DFU mode manually by calling the rom due to some other event like a button press.

    The actual code switch to call the boot loader is the same either way and there is an example in the USBDDFUUpdateBegin() in usblib/device/usbddfu-rt.c.  Since you want to call the ROM rather than a flash based loader, the following line must be changed:

    (*((void (*)(void))(*(unsigned long *)0x2c)))();

    with

    ROM_UpdateUSB();

    This will disconnect the USB bulk device, reset the USB peripheral, disable all peripheral interrupts, wait about a second for the bus to settle and then call the boot loader.  This leaves all USB pin configuration and PLL settings untouched as the ROM entry point for update assumes that the PLL and pins are all configured.

  • I have implemented the application call with USBDDFUUpdateBegin() and put ROM_UpdateUSB(pucUSBBootROMInfo) with

    the USB DFU descriptor taken from 'boot_demo1'.

    I add to the project 'usbddfu-rt.c'  ver. 9107 but when program running, a reset take place.

    Analyzing USBDDFUUpdateBegin()  code,  I think there is an error:

    in the sequence of reset USB  should be first DISABLE, RESET and ENABLE.

    I put the function below with my modified code:

    void USBDDFUUpdateBegin(void)
    {
        //
        // Terminate the USB device and take us off the bus.

        USBDCDTerm(0);

        //
        // Disable all interrupts.

        MAP_IntMasterDisable();

        //
        // We must make sure we turn off SysTick and its interrupt
        // before entering the boot loader!

        MAP_SysTickIntDisable();
        MAP_SysTickDisable();

        //
        // Disable all processor interrupts.  Instead of disabling them
        // one at a time, a direct write to NVIC is done to disable all
        // peripheral interrupts.

        HWREG(NVIC_DIS0) = 0xffffffff;
        HWREG(NVIC_DIS1) = 0xffffffff;

        //
        // Reset the USB peripheral

    /*  ERROR ??????????????????????????????????
     MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0);
        MAP_SysCtlPeripheralReset(SYSCTL_PERIPH_USB0);
        MAP_SysCtlPeripheralDisable(SYSCTL_PERIPH_USB0);
    */
        MAP_SysCtlPeripheralDisable(SYSCTL_PERIPH_USB0);
        MAP_SysCtlPeripheralReset(SYSCTL_PERIPH_USB0);
     MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0);


        //
        // Wait for about a second.

        MAP_SysCtlDelay(MAP_SysCtlClockGet() / 3);

        //
        // Re-enable interrupts at the NVIC level.

        MAP_IntMasterEnable();

        //
        // Return control to the boot loader.  This is a call to the SVC
        // handler in the boot loader.

     ROM_UpdateUSB(pucUSBBootROMInfo);
    //    (*((void (*)(void))(*(unsigned long *)0x2c)))();


        while(1)    // Should never get here, but just in case.
        {
        }
    }

    With this function modified, the reset don't take place, but the DFU USB don't start:

    The PC is looping in address 0x100706C .. 0x10072A4  ( ROM bootloader ? )

    The USB lines D+ and D-  are  OFF to 0V without activity and LM Flash programmer don't see the DFU USB connected.

    I don't see in the code the  ROM_USBDevDisconnect(): is it necessary ?

    What is the problem ?

    thanks.

     

  • Perhaps I find another not correct thing about USB Description and  USBDDFUUpdateBegin() :

    I think that, after USB RESET and re-ENABLE , it is necessary to re-enable also USB PLL.

    Infact adding ROM_SysCtrlUSBPLLEnable()  command  to the  USBDDFUUpdateBegin(), finally the USB DFU start !!

    Tell me if my work is correct.

    If yes, pls put a raccomandation in my linked-in profile and upgrade my TI account  :-) !

    thks

     

  • Hi Marco,

    It sounds like you are now up, running, and able to perform USB DFU updates. I can look at this in a little more detail tomorrow to confirm your solution. I'll let you know what I find.

    Regards,

    Christian

  • Hi Christian,

    YES, now the switch of the USB context is working,

    the DFU work and LM flash programmer update the firmware correctly.

    Waiting for your confirm

    thks