Author Topic: how usb works from a client MCU  (Read 8725 times)

ulao

  • Frequent Contributor
  • ****
  • Posts: 172
how usb works from a client MCU
« on: July 16, 2018, 07:38:07 am »
I'm a little foggy on this. So I'm trying to understand how a MCU that uses USB without hardware would handle the interrupts. For sending interrupt  data I do understand it needs to fire an interrupt  based on specific timing.

i.e.  usb 1.1 at low speed on windows.

interrupts occur ever 8 ms.  but I also see this 1ms (keep alive) pulse. I also see control transfers send data starting on this pulse. What I'm seeing is that this pulse generates an interrupt when control transfers take place. So I'm a little confused why I see that? Would an MCU need to trigger an interrupt to receive a control transfer? Or would the MCU need to focus on the incoming data and neglect normal code on the chip (aside from the interrupts)?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: how usb works from a client MCU
« Reply #1 on: July 16, 2018, 08:42:34 am »
Device controllers typically use interrrupts with all transfer types to signal incoming data, sent data, and other events.

If you are asking about a device controller that doesn't have hardware support for USB, the hardest part is complying with USB's timing requirements. You would almost certainly be limited to low speed.

Here is one example:

http://www.sxlist.com/techref/io/serial/usb/atapchi/index.html

ulao

  • Frequent Contributor
  • ****
  • Posts: 172
Re: how usb works from a client MCU
« Reply #2 on: July 16, 2018, 10:20:46 am »
Yes I do (v-usb) the timing seems to be the bests part of the v-usb. the biggest down fall is the timing consumes most all of the cpu time. That just something I can live with on this chip for now.

What I do to avoid interrupts getting in the way of my other code, is time my other code to happen after the 8ms interruption.  This works ok and gives me 8ms to do my work. But what I seem to be having issues with is when I sent a control transfer. One of two things are occurring.

a. A control transfer is issuing an interrupt. This is causing an issue in my other code.

or

b. A control transfer must dedicate itself to the CPU so my other code can not happen.

What I need to figure out is what is it? A or b. And I'm not able to determine this. I think I can do more debugging to rule out b but a should wither be a requirement or not. I just can;t get that understood.

« Last Edit: July 16, 2018, 10:22:57 am by ulao »