This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

MDK 4 Systick and USB

Hello, I have a working LPC1758 MDK-arm 4 program that is based on the HID example.

When I set the systick to 1ms or less USB enumination fails. At 10ms all is fine, I need 1 ms for other a2d tasks.

Any ideas?

  • Do your other tasks take >1ms, are you spinning in loops?

    What speed is the processor running?

    The Cortex-M3/4 will starve foreground tasks if an interrupt pends before an IRQ Handler completes, it will just tail-chain into the next handler.

    Check what pre-emption state/mode you have in the NVIC, and then what you have set for the IRQ and system handlers. Make sure the SysTick has the lowest priority.

  • Thanks - I will check.

    LPC1758 is running 100MHz
    No Task takes longer than 1ms
    Preempion is at 50mS (round robin)

    Very strange that if I set systick to 1.02mS then it works. My USB binterval is 2mS

  • I would suggest you try MDK 5 and latest middleware if possible.

  • I see this example did not use the RTOS
    C:\Keil_v5\ARM\Boards\Keil\MCB1700\RL\USB\Device\HID\

    But if you are adjust hte systick it sounds like you may be.

    If you adjust the Systick time, are you also modifying the Timer tick value [us] in the RTX_conf_CM.c

    http://www.keil.com/support/man/docs/rlarm/rlarm_ar_cfgtimer.htm

    Did you check the PLL, USB clock configuration settings in the system_LPC17xx.c file? Especially USBCLKCFG_Val?

    Double check all clock settings - timing is critical in USB applications.

    also, when debugging your application , make sure to check the Peripherals -> System Viewer -> USB window to see the USB register values.

    You can adjust the systick while running your code using the Peripherals -> Core Peripherals-> Systick timer.

    That way you don't have to recompile your project every time while fiddling with timings.

  • Thank you for your help.
    It looks as if tasks were "nose to tailing" and the usb was not getting in
    Increasing the systick by 5% fixed it