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.

TM4C1294NCPDT: USB_host_msc demo for TM4C1294XL

Part Number: TM4C1294NCPDT

Hi,

I have been trying to understand the sample code for interfacing with a memory stick. I have been looking at the usb_host_msc example. There is something there that is really confusing me and I was hoping someone could please clarify this. I opened the project using Keil. In the startup file, there are two interrupts that were declared. I have been searching everywhere and I could not find the interrupt service routine. I have been trying to understand what the purpose of these interrupts are for in this application. The SysTick interrupt was enabled in main. Just as an experiment, I commented this out and the program still worked okay. Could please someone clarify if these two interrupts are used on this example and if so, where can I find the ISR or what's the purpose of these. Also, pls. correct me if I am wrong, but it seems like the code relies on polling in order to detect the presence of the stick? Or is it an Interrupt that gets triggered? 

Thank you very much.

AJ

        EXTERN  SysTickIntHandler
        EXTERN  USB0OTGModeIntHandler

;******************************************************************************
;
; The vector table.
;
;******************************************************************************
        EXPORT  __Vectors
__Vectors
        DCD     StackMem + Stack            ; Top of Stack
        DCD     Reset_Handler               ; Reset Handler
        DCD     NmiSR                       ; NMI Handler
        DCD     FaultISR                    ; Hard Fault Handler
        DCD     IntDefaultHandler           ; The MPU fault handler
        DCD     IntDefaultHandler           ; The bus fault handler
        DCD     IntDefaultHandler           ; The usage fault handler
        DCD     0                           ; Reserved
        DCD     0                           ; Reserved
        DCD     0                           ; Reserved
        DCD     0                           ; Reserved
        DCD     IntDefaultHandler           ; SVCall handler
        DCD     IntDefaultHandler           ; Debug monitor handler
        DCD     0                           ; Reserved
        DCD     IntDefaultHandler           ; The PendSV handler
        DCD     SysTickIntHandler           ; The SysTick handler
        DCD     IntDefaultHandler           ; GPIO Port A
        DCD     IntDefaultHandler           ; GPIO Port B
        DCD     IntDefaultHandler           ; GPIO Port C
        DCD     IntDefaultHandler           ; GPIO Port D
        DCD     IntDefaultHandler           ; GPIO Port E
        DCD     IntDefaultHandler           ; UART0 Rx and Tx
        DCD     IntDefaultHandler           ; UART1 Rx and Tx
        DCD     IntDefaultHandler           ; SSI0 Rx and Tx
        DCD     IntDefaultHandler           ; I2C0 Master and Slave
        DCD     IntDefaultHandler           ; PWM Fault
        DCD     IntDefaultHandler           ; PWM Generator 0
        DCD     IntDefaultHandler           ; PWM Generator 1
        DCD     IntDefaultHandler           ; PWM Generator 2
        DCD     IntDefaultHandler           ; Quadrature Encoder 0
        DCD     IntDefaultHandler           ; ADC Sequence 0
        DCD     IntDefaultHandler           ; ADC Sequence 1
        DCD     IntDefaultHandler           ; ADC Sequence 2
        DCD     IntDefaultHandler           ; ADC Sequence 3
        DCD     IntDefaultHandler           ; Watchdog timer
        DCD     IntDefaultHandler           ; Timer 0 subtimer A
        DCD     IntDefaultHandler           ; Timer 0 subtimer B
        DCD     IntDefaultHandler           ; Timer 1 subtimer A
        DCD     IntDefaultHandler           ; Timer 1 subtimer B
        DCD     IntDefaultHandler           ; Timer 2 subtimer A
        DCD     IntDefaultHandler           ; Timer 2 subtimer B
        DCD     IntDefaultHandler           ; Analog Comparator 0
        DCD     IntDefaultHandler           ; Analog Comparator 1
        DCD     IntDefaultHandler           ; Analog Comparator 2
        DCD     IntDefaultHandler           ; System Control (PLL, OSC, BO)
        DCD     IntDefaultHandler           ; FLASH Control
        DCD     IntDefaultHandler           ; GPIO Port F
        DCD     IntDefaultHandler           ; GPIO Port G
        DCD     IntDefaultHandler           ; GPIO Port H
        DCD     IntDefaultHandler           ; UART2 Rx and Tx
        DCD     IntDefaultHandler           ; SSI1 Rx and Tx
        DCD     IntDefaultHandler           ; Timer 3 subtimer A
        DCD     IntDefaultHandler           ; Timer 3 subtimer B
        DCD     IntDefaultHandler           ; I2C1 Master and Slave
        DCD     IntDefaultHandler           ; CAN0
        DCD     IntDefaultHandler           ; CAN1
        DCD     IntDefaultHandler           ; Ethernet
        DCD     IntDefaultHandler           ; Hibernate
        DCD     USB0OTGModeIntHandler       ; USB0
        DCD     IntDefaultHandler           ; PWM Generator 3
        DCD     IntDefaultHandler           ; uDMA Software Transfer
        DCD     IntDefaultHandler           ; uDMA Error
        DCD     IntDefaultHandler           ; ADC1 Sequence 0
        DCD     IntDefaultHandler           ; ADC1 Sequence 1
        DCD     IntDefaultHandler           ; ADC1 Sequence 2
        DCD     IntDefaultHandler           ; ADC1 Sequence 3
        DCD     IntDefaultHandler           ; External Bus Interface 0
        DCD     IntDefaultHandler           ; GPIO Port J
        DCD     IntDefaultHandler           ; GPIO Port K
        DCD     IntDefaultHandler           ; GPIO Port L
        DCD     IntDefaultHandler           ; SSI2 Rx and Tx
        DCD     IntDefaultHandler           ; SSI3 Rx and Tx
        DCD     IntDefaultHandler           ; UART3 Rx and Tx
        DCD     IntDefaultHandler           ; UART4 Rx and Tx

  • Hi

    I finally found the SysTick Handler. I must have just missed it while doing a find all files. Anyway, I noticed that it calculates the number of ms ticks and this value is an input to the USBOTGMain function. My additional question is, why does this function need to be called periodically? And what does it mean when the user guide says

    "This function is the main routine for the USB controller when using the library in OTG mode.
    This routine must be called periodically by the main application outside of a callback context.
    The ui32MsTicks value is used for basic timing needed by the USB library when operating in
    OTG mode. This allows for a simple cooperative system to access the the OTG controller driver
    interface without the need for an RTOS. All time critical operations are handled in interrupt
    context but all longer operations are run from the this function to allow them to block and wait
    for completion without holding off other interrupts."

    I have never had any experience working with an application that involves OTG so all this is pretty new to me.

    Thanks

    AJ
  • In general, interrupt service routines should be kept very short. If a lot of computation needs to be done, and it is not highly time critical, the interrupt routine will simply set a flag that some work must be done. Then in some main loop, the flag is periodically checked and if set, the necessary work is done. This is what if being done here. The function USBOTGMain is checking for timeouts or state changes.