Prop2 FPGA files!!! - Updated 2 June 2018 - Final Version 32i

14344464849160

Comments

  • This is an interesting question... Have to check into this...
  • Ok, I check and looks like sequential packets are locked to the same clock, no matter what delay you put between them.

    So, I guess it's just the delay between sequential packets of the same transaction that is important.
  • jmgjmg Posts: 14,493
    Rayman wrote: »
    Ok, I check and looks like sequential packets are locked to the same clock, no matter what delay you put between them.

    So, I guess it's just the delay between sequential packets of the same transaction that is important.
    Nice to know.

    Can you easily check where the delay threshold is ? (4,5,6,7us?)
    Does the mouse simple fail to reply if that is too delayed ?

    If you nudge the 1.5MHz away from ideal, does that improve/worsen that threshold ?
    eg imagine the mouse has a RC osc that is not resyncing on every edge, that limits the time window it can decode, and it may be just enough to skew.
    In that case, matching the Mouse Osc would allow longer delays.

    ISTR some SW-USB designs that captured bits, then decoded later, and those could simply run out of capture room, with delays above PC-test-values ?
    Any sign of a crystal in the mouse ?
  • So, looking closer at that now, it appears that max delay is ~11 us. Don't know why I saw it at 7 us earlier...
  • jmgjmg Posts: 14,493
    Rayman wrote: »
    So, looking closer at that now, it appears that max delay is ~11 us. Don't know why I saw it at 7 us earlier...
    So appx 16 bit times fails, and 6 bit times is proven ok ?
    What can the P2 get that delay down to ? Is the min possible delay, ok with the mouse or is something needed there ?


  • Looking on the web for "maximum inter-packet USB delay" I'm seeing 7.5 bit times for some cases (for host to respond) and 6.5 bit times for others (for device to respond to host).
  • garryjgarryj Posts: 327
    edited 2016-05-08 - 23:41:23
    Lurker finally coming out...

    I've been following the development of the P2 for quite a while, and have used the P1 in the past (mostly spin , some pasm), but the discussions during P2 development have mostly been over my head, hence the continued lurking.

    But when smart pins became a reality and the P123-A9 board was available, I decided it was time to get my feet wet, as it were, with a goal of getting a USB low-speed keyboard interface working. It's just been in the last few days that I've gotten to the point where I understand the USB protocol enough to do some physical experimentation.

    Jmg's milestone is quite exciting -- I'm just at the stage where I can detect device connect/disconnect :blush:. I hope that in the future I can make a contribution to add to the great work y'all have done to make the P2 a reality!

    Edit: oops, that's rayman's milestone...
  • jmgjmg Posts: 14,493
    edited 2016-05-08 - 23:38:01
    Rayman wrote: »
    Looking on the web for "maximum inter-packet USB delay" I'm seeing 7.5 bit times for some cases (for host to respond) and 6.5 bit times for others (for device to respond to host).
    Is the case you have hit here, a change in bus direction, or just two adjacent (from P2-Host) packets ?


  • From the USB 2.0 specs:

    7.1.18.1 Low-/Full-Speed Bus Turn-around Time and Inter-packet Delay
    Inter-packet delays are measured from the SE0-to-J transition at the end of the EOP to the J-to-K transition that
    starts the next packet.
    A device must provide at least two bit times of inter-packet delay. The delay is measured at the responding
    device with a bit time defined in terms of the response. This provides adequate time for the device sending the
    EOP to drive J for one bit time and then turn off its output buffers.
    The host must provide at least two bit times of J after the SE0 of an EOP and the start of a new packet (TIPD). If
    a function is expected to provide a response to a host transmission, the maximum inter-packet delay for a
    function or hub with a detachable (TRSPIPD1) cable is 6.5 bit times measured at the Series B receptacle. If the
    device has a captive cable, the inter-packet delay (TRSPIPD2) must be less than 7.5 bit times as measured at the
    Series A plug. These timings apply to both full-speed and low-speed devices and the bit times are referenced to
    the data rate of the packet.
    The maximum inter-packet delay for a host response is 7.5 bit times measured at the host’s port pins. There is
    no maximum inter-packet delay between packets in unrelated transactions.
  • jmgjmg Posts: 14,493
    edited 2016-05-09 - 00:06:24
    garryj wrote: »
    ...
    The host must provide at least two bit times of J after the SE0 of an EOP and the start of a new packet (TIPD)..

    That seems the key info, so this should be within spec and hopefully still work down to 1.33us, and may work even lower ?

    Addit:
    jmg wrote:
    If you nudge the 1.5MHz away from ideal, does that improve/worsen that threshold ?

    Thinking some more about freq, the spec for LS is ±1.5%, so with a working setup, it could be useful to sweep across and outside that, and see where the Mouse falls over ?
    That should confirm margins, and also the Baud control...
  • Cluso99Cluso99 Posts: 16,660
    edited 2016-05-09 - 18:45:16
    So we must respond within 7.5 clocks. For FS, this is 12MHz or 83ns x 7.5 = 625ns.

    For P2, presume 160MHz, 2 clocks per instruction = 12.5ns.
    Therefore we have 500 50 instructions / time to calculate and verify CRC, formulate the response, and turn around pins and begin sending the packet.

    IIRC CRC takes, including the data shift/rotate, at least 5 instructions per bit. So a byte takes 8 x 5 = 40 instructions. so you would be likely that be ok for the first 10x instructions. But for larger packets, it is a more serious situation.
  • RaymanRayman Posts: 11,351
    edited 2016-05-09 - 01:58:09
    For low speed HID, I think we could get away with completely ignoring CRC.

    What we need to send is already known. And, the chances of an incoming error are very remote.

    But, we have ages to check CRC if we want at low speed.

    At high speed, I think CRC is more important and maybe more of a challenge.

    >Actually, I should say "Full Speed" above as "high speed" is USB 2.0 I think
  • JRetSapDoogJRetSapDoog Posts: 848
    edited 2016-05-09 - 04:40:55
    garryj wrote: »
    Lurker finally coming out...

    ...

    But when smart pins became a reality and the P123-A9 board was available, I decided it was time to get my feet wet, as it were, with a goal of getting a USB low-speed keyboard interface working.

    Don't be embarrassed about staying in the shadows for so long. It's understandable that some won't want to publically declare their interest before actual silicon. But now that you've declared, you're free!

    Seriously though, it's great to read that you and Rayman are working on HID protocols. It sounds hard, like you're partly working blind, which happens for early adopters. But I admire your persistence.

    Although I'm biased because I have interest in keyboards, I don't think we can have much confidence in the USB capabilities until someone gets a low-speed HID device working.

    Actually (as has been suggested elsewhere by another), it might be a good start if someone were able to communicate with a USB keyboard in the so-called "boot mode," even though that wouldn't test all of the USB stuff. Being able to connect a (USB or non-PS/2) keyboard to the P2 is an important milestone.

    My apologies for posting when I haven't rolled up my sleeves to try to help. But maybe it helps a bit to know that there are folks out here who are watching with keen interest. Good luck and thanks for sharing your progress and for collaborating.

  • MJBMJB Posts: 1,192
    Cluso99 wrote: »
    So we must respond within 7.5 clocks. For FS, this is 12MHz or 83ns x 7.5 = 625ns.

    For P2, presume 160MHz, 2 clocks per instruction = 12.5ns.
    Therefore we have 500 instructions / time to calculate and verify CRC, formulate the response, and turn around pins and begin sending the packet.
    625ns / 12.5ns = 50 not 500 !! ??
  • Cluso99 wrote: »
    So we must respond within 7.5 clocks. For FS, this is 12MHz or 83ns x 7.5 = 625ns.

    For P2, presume 160MHz, 2 clocks per instruction = 12.5ns.
    Therefore we have 500 instructions / time to calculate and verify CRC, formulate the response, and turn around pins and begin sending the packet.

    IIRC CRC takes, including the data shift/rotate, at least 5 instructions per bit. So a byte takes 8 x 5 = 40 instructions. so you would be likely that be ok for the first 10x instructions. But for larger packets, it is a more serious situation.

    50 instructions = 7.5bits at 12Mbps full speed USB and P2 @ 160Mhz.
    Best choose to do CRC byte by byte (not bitwise) as the data arrives so the computation is already mostly complete by the arrival of the last byte. With this approach there should then just need to be a "handful" (yet to be determined) of instructions to do the final CRC comparison check at the end and preparing the pin outputs etc before knowing whether to respond with the start of the sync. If 50 instructions is not sufficient for doing all that I'd be very surprised however I do recall Chip had some internal overhead cycles to control Smartpins but hopefully all together it should all still be quite a bit less than 100 clocks so that the P2 would not have to be run at its full speed just to support 12Mbps USB.
  • Thanks for pointing out the typo. Must have been half asleep due to delayed jet lag.
  • I've got the workings for a USB mouse driver working :)

    Just ignoring CRC and sending commands sniffed when mouse was connected to PC.

    I guess I don't know yet if it will work with any other mouse.
    But, this is the "amazon basics" mouse, low cost mouse so not too bad anyway.

    Anyway, I'm 100% sure now that P2 USB hardware will work for HID mouse.
  • Rayman wrote: »
    I've got the workings for a USB mouse driver working :)

    Just ignoring CRC and sending commands sniffed when mouse was connected to PC.

    I guess I don't know yet if it will work with any other mouse.
    But, this is the "amazon basics" mouse, low cost mouse so not too bad anyway.

    Anyway, I'm 100% sure now that P2 USB hardware will work for HID mouse.

    That's great! I'm really glad you tried all that out. In the next release, the status reporting has become a little better.
  • Rayman wrote: »
    I've got the workings for a USB mouse driver working :)

    Just ignoring CRC and sending commands sniffed when mouse was connected to PC.

    I guess I don't know yet if it will work with any other mouse.
    But, this is the "amazon basics" mouse, low cost mouse so not too bad anyway.

    Anyway, I'm 100% sure now that P2 USB hardware will work for HID mouse.

    Good start! Do you also stream the incoming data to hub as it arrives or just keep it in COG RAM? Will be really cool to get some full speed device working sometime soon too that exercises the entire path.
  • right now, I'm outputting the data to PC over serial port...

    I'm about to try Boot mode.
    Unfortunately, that means figuring out USB's CRC16.

    But, I have it now.
    Can use this web tool with hex data and look at the Modbus result:
    http://www.lammertbies.nl/comm/info/crc-calculation.html

    Then, have to invert all the bits. Then, you send LSByte first.
  • Nice progress Ray!
  • RaymanRayman Posts: 11,351
    edited 2016-05-16 - 23:48:57
    As for USB support I'm pretty happy.

    One thing I wish was easier is setting the inter-packet delay for when I need to send two packets in a row with a fixed, 6-7 USB clock spacing.

    Maybe it could be rigged so that after P2 sends one packet, it will automatically wait 6 USB clocks before starting to send the next packet?
  • jmgjmg Posts: 14,493
    Rayman wrote: »
    As for USB support I'm pretty happy.

    One thing I wish was easier is setting the inter-packet delay for when I need to send two packets in a row with a fixed, 6-7 USB clock spacing.

    Maybe it could be rigged so that after P2 sends one packet, it will automatically wait 6 USB clocks before starting to send the next packet?

    Something fixed could be dangerous ?
    I thought the P2 made simple delays easy ? - tho they do need to be SysCLK adjusted, but so does the USB CLK divider ?


  • Can a smart pin be set up as a timer to start when some edge condition occurs on the USB pins and then fire off some 6-7 USB clocks later.

    It could be a built in USB feature but embedding protocol into the hardware? Not sure if that is a good idea.

    (I'm no expert and never played on on television!)
  • cgraceycgracey Posts: 13,077
    edited 2016-05-21 - 05:02:14
    I'm getting the new release (V9) together.

    The A9 compiled okay with everything but 8 smart pins (P48..P55). It used 96% of the available logic. Fmax came in at only 68MHz, though, so I'm running it again with a different fitter seed to try to get it back up to ~74MHz. It's most likely that the 68MHz compilation would run fine at 80MHz, but I want to close the gap a bit.

    Is anyone interested in a BeMicro CV-A9 compile? I just need to be pointed to that .qsf file containing pin assignments that some of you made.

    How about the BeMicro CV-A2? I've done that one before for P2-Hot, so it can easily be done again.

    Otherwise, aside from the Prop123-A9 board, I'll compile for the DE2-115 and the DE0-Nano.
  • Now that the design is pretty much done I would suggest to do compiles for all of the above.
    The more testers now the better. :)
  • I have a BeMicroCV-A9 for testing later next week. I will find the pin outs I did for this a few weeks ago and put a link here.
  • Definitely the CV-A9 although I haven't gotten around to a pin assignment but I am planning on using the 80-pin edge connector so I can embed the module easily for early application specific boards rather than a "development" system.
  • AleAle Posts: 2,360
    I want a CV A2 ! Cluso made a qsf file for the Bemicro CV-A2... here, pretty please ?:

    forums.parallax.com/discussion/164058/p2-fpga-for-de0-nano-bemicrocv-bemicrocva9#latest
  • I'm still working on the documentation for the next release.

    I've covered LUT write sharing and LUT events, COGINIT with the dual-cog launching, the CORDIC missed-results event, and the COGATN attention mechanism. The events have been reorganized somewhat.

    Still left is the streamer with its new modes and the smart pins and their slightly new modes.

    Here is my working copy, in case anyone wants to read what's been done, so far:

    https://docs.google.com/a/parallax.com/document/d/1WVk_NHejFVTZzYv33SL1xPU5lHQXCiVwYS7DXK3Um2Y/edit?usp=sharing
Sign In or Register to comment.