Shop OBEX P1 Docs P2 Docs Learn Events
USB seems to be PITA — Parallax Forums

USB seems to be PITA

But, would be great selling point for P2 IMHO..

Hope Chip can figure it out.

I wouldn't be upset if crystal had to be a certain value to make it all work btw...

«1

Comments

  • jmgjmg Posts: 15,148
    edited 2016-03-17 04:01
    Rayman wrote: »
    But, would be great selling point for P2 IMHO..

    Hope Chip can figure it out.

    I wouldn't be upset if crystal had to be a certain value to make it all work btw...
    I think he had Rx pretty much sorted, which means (well?) over halfway there.

    Initial tests would be ideally at 12 * N MHz (N >= 4), but I think even 80MHz will be ok, as it will give /7/7/6 in the NCO & the sampling error is less than the 20.833ns of 48MHz

    Depends on if the targets use Analog PLL, or DPLL, and I think DPLL are used on all devices I have seen.

    LS USB should come for free, with FS USB, and may be easier to trouble shoot.
  • cgraceycgracey Posts: 14,133
    It's coming together. The Verilog code blossomed into a big mess, so now I'm starting over from a transmit perspective. This has been a huge headache that's been slow going. Yesterday I even took a detour to rethink the programmable pin mode.
  • potatoheadpotatohead Posts: 10,254
    edited 2016-03-17 04:12
    For what it's worth, doing USB is worth it. Go Chip!

    Did you guys see Western Digital produced a special hard disk for the Pi? It's running over USB. Having that one really common comms capability, in addition to serial, spi, etc... is going to make lots of devices accessible and useful.
  • jmgjmg Posts: 15,148
    potatohead wrote: »
    Did you guys see Western Digital produced a special hard disk for the Pi? It's running over USB.
    Interesting move - I can find this PR

    "The WD PiDrive 314GB device is based on Western Digital's proven, high-volume 500GB platform with design changes made specifically for Raspberry Pi. Customizations made to the drive's magnetic recording and electrical system operating set-points align with Raspberry Pi's USB data and power design to reduce the electrical power load of the hard drive on Raspberry Pi, while still maintaining sufficient performance to deliver maximum USB data transfer rate."

    Not clear why the drop from 500GB to 314GB ? - and also not mentioned are numbers on the 'Customizations' ?

    Wonder if it works ok on a USB FS port ?

    This will make the SD boot dictate, look a more of a kludge...
  • jmg wrote: »
    Not clear why the drop from 500GB to 314GB ?

    Now it's pi hundred MB (3.14 X 100).

  • jmgjmg Posts: 15,148
    altosack wrote: »
    jmg wrote: »
    Not clear why the drop from 500GB to 314GB ?

    Now it's pi hundred MB (3.14 X 100).
    hehe, so it is ! - Completely missed that, I was looking for technical reasons, related to magnetic recording...
  • Yeah, I choked on that too JMG.
  • I still have to disagree that USB is worth it. I know I'm beating a dead horse here, but...

    The fact that Chip is struggling to get it implemented isn't a statement about his abilities, it's a statement that this is not a good fit for the P2.

    For hobbyists wanting USB host functionality, there are already a variety of inexpensive USB Host Shields that provide easy integration with existing smart cell capability. If your only desire is to hook up mouse and keyboard, USB-to-PS2 adapters are readily available and cheap and should work quite nicely with the existing smart cells. And for commercial USB host applications, there are a variety of ICs that already provide more functionality than that which Chip will be adding.

    If, on the other hand, you want to implement a USB device, there are also a variety of existing breakout boards and bridge ICs that are already available and more capable. Not only that, but adding USB support in P2 does not get you around having to deal with the VID/PID issue, writing custom drivers, etc.

    And, as I pointed out once before, adding this capability to every smart cell is a waste of resources! Very few of the pins will actually be used for USB, if at all. I'm sure there will be a rare case where multiple USB interfaces will be used, but the chip should not be designed around the rare use cases.

    Just leave USB out.
  • I'm with Seairth here.

    Of course if adding USB is really just a couple days away, and the ramifications of adding USB (such as requiring VID/PID registration, driver distribution for multiple OS "gasp", cost, etc.. etc..) are really not significant, then maybe having USB now might as well be.

    But if this extra feature is really a troublesome one, with many dark days ahead, and potential for many unknown twists and turns- then I've gotta speak that leaving it out for now and rather focusing on finishing up the feature-set that is already in hand seems to me a more logical path forward.

    Partly my logic is, that with the release of P2 you will regain control of your time, and also be generating income that can be slated to support development of a future version with USB support back on your own pace.

    And from a practical standpoint, dedicated chips for USB are so well accepted now. I'm not sure you could increase the retail price of a current P2 by the value of a USB chip inside. Plus USB is also moving on standards wise. P2 with USB 1 or 2 now may be less than useful with USB 3 comes out. It's a kind of moving target.


    I remember fondly my daughters happiness when JK Rowling released the first of the Harry Potter books. And then her joy as each successive book came along. I feel that had JK waited until the full saga was complete, that the infamous cult of HP may never have been, and perhaps the educational value for millions of young fans missed. As was true of Star Wars trilogy too no doubt, for those of an elevated persuasion.

    P2, I feel, will do great things without USB.
    And Chip, I feel, your mind will be free to achieve even greater things once the next P2 is released.

    So do please accept some support from us- if you were to consider wrapping this feature for next time. You've already done so much of which we remain forever in awe.



  • If I'm asked to vote, then I have to vote with the "skip USB" crowd. AliExpress just told me today that I can get a USB to TTL dongle for $0.79! The arguments by the two gents above make sense to me.

    Get the "final" FPGA ready and released for testing and as the Smart Pins get used by more people, there may be things that are needed for completeness or make more sense to have in All Smart Pins may better fit that real estate.
  • I am with Seairth too.

    There are plenty of USB ICs out there from low speed (12 Mbps), to medium speed (480 Mbps), to high speed (5 Gbps).

    BTW, the FT232H/FT2232H has a fast synchronous 245 parallel FIFO mode and the datasheet claims 35 MBytes/s. The FTDI outputs a 60 MHz clock and sends 8 parallel bits.

    I think It would be much more worth the effort to adapt the P2 streamer to this fast 245 FIFO. Also, a 245 mode seems kind of generic and can be used for any other communication purposes.
  • Dave HeinDave Hein Posts: 6,347
    edited 2016-03-17 14:15
    Chip just posted that "it's coming together", and now everybody wants to abandon USB. Let's give Chip a little more time to see if he can pull it off instead of posting discouraging comments.
  • VonSzarvas wrote: »
    And from a practical standpoint, dedicated chips for USB are so well accepted now. I'm not sure you could increase the retail price of a current P2 by the value of a USB chip inside. Plus USB is also moving on standards wise. P2 with USB 1 or 2 now may be less than useful with USB 3 comes out.

    uh! Well, how to say this ... you know it is Q1 2016 now, right ;-D.

    You can order FT600 or FT601 at digikey for less than US $10 (single quantities).

    They are USB 3.0 and are able to do stream 16 bits (FT600) or 32 bits (FT601) at 100 MHz. The datasheet also said that can talk at 66 MHz, but this is not clear. BTW, can the P2 streamer handle this?

    Yes, they are stocked !!! (FT600 344 pcs., and FT601 531 pcs.).


  • ErNaErNa Posts: 1,742
    Ya, even if I vote for fast time to market, Chip sees a sea of gates and imagines building blocks that can be connected to realize useful functions. As an outsider it is hard to imagine what he imagines. So my advice: if I am stuck, I start over or in the night decide: what is ready is enough, freeze design, any options to the next revision. In the case of IC-masks (cost!) this decision is hard to make, but must be done anyway. A little more time, let's say: up to Easter.
  • Dave Hein wrote: »
    Chip just posted that "it's coming together", and now everybody wants to abandon USB. Let's give Chip a little more time to see if he can pull it off instead of posting discouraging comments.

    Actually, I (and others) said to abandon USB several weeks ago. And Chip has been saying "it's coming together" (in one way or another) for several weeks as well. Don't let USB be driven by the Sunk Cost Fallacy!
  • How stable are USB protocols/driver requirements? Does building silicon with USBx make sense when the P2 will be used for years in the future, while the next best thing since USB may already be in development and pop up in the near future? (those delicate little pins are annoying.) Then, built in USB as a feature may end up being just a yawn.

  • Ken GraceyKen Gracey Posts: 7,386
    edited 2016-03-17 15:34
    I have more experience working with Chip than anybody on these forums (46 years worth). I am more acquainted with the history of Parallax development cycles, Chip's mindset as a creator of technology (vs market-driven designs), Parallax business ROI, and the manner in which the Parallax team will need to respond to the completed product.

    Supporting Chip is opposite of what you may think - it's in the interest of every possible stakeholder to finish Propeller 2 without USB support now, and consider adding it on a future revision. Roll back to a prior GitHub version, make it work and go to fabrication.

    Products have specifications and release dates. At Parallax, specifications are a combination of being market and engineering-driven. There's a union of these two circles of possibilities that represent the ideal outcome. The size of each circle could represent the time required to provide the specification (above, I read that USB could "come for free" - wow!), with the overlap size being the financial viability. The specifications from marketing say that Propeller 2 has A/D, more RAM, faster speed and more I/O. Code protect is a requested feature from the highest volume customers. The engineering circle includes many amazing things: Smart I/O, video functionality, and now USB.

    Now, what size would you draw each circle, and how much overlap would you give them? Keep in mind this overlap area represents ROI. Considering you are all engineers or engineering-minded, does it look right? Now picture yourself as a businessman, investor or accountant. Does it look any different?

    I almost forgot about the role of specifications and schedule. You can fill in the blanks here, but normally specifications are dropped to reach release dates, not added to extend them.

    Chip, I realize you're almost done. Even though you're almost done, you have my 100% support to roll back, test and finish. The last month or two of experience have been extremely valuable in terms of knowledge that can be applied on the next round of development.

    We've been here before, several times. Enthusiasm gets ahold of us, the die and complexity grow, what looks easy is not, the chip goes on a diet and gets scaled back. For people to get my point maybe I need to be extreme like a politician so you remember what I write because it is so silly and irrelevant to the topic. I'll do that, then, and leave you with this: be like Oprah and put P2 on a diet - for every pound she looses her supporters and financials go berserk! Parallax needs a bit of the Oprah hype and success to support this project.

    Ken Gracey

    P.S. I have been told I have a special way of squashing discussions and accompanying engineering enthusiasm. That needn't happen here. Carry on as you do, sharing your thoughts!
  • Ken,
    I agree pretty strongly with you. The P2 sans USB is already a feature rich device that I can't wait to have as a final product in chip form. I realize that having USB "built in" would be nice and a lot of other MCUs have it, but it's certainly not the end of the world to not have it. We've all done quite well with the P1 even though it doesn't have it, because it's pretty trivial to use an FTDI (or other) USB chip to get it.

    Chip,
    Let's get P2 out the door, and then you can work on P2.5 (or whatever you want to call it) that has some of these extras like built in USB.
  • cgraceycgracey Posts: 14,133
    edited 2016-03-17 17:37
    Guys, thanks for all your input and support.

    What's been taking so long with USB is not exactly technical. The whole thing has just been unpleasant. USB is an ugly little wad of pointy concepts, and it seems to me that the driving impetus behind it was to force people into making custom silicon while roping them into a system of tribute. This is opposite of fun and free, and so it's been a slog to get through.

    Today I should have the transmitter done. Then, I'll bring the receiver in. It's really not that much silicon. I don't think the testing for this is all that complex, either. It's going to be more about getting the software interface straight, so that writing code for it is not ugly.
  • Cluso99Cluso99 Posts: 18,069
    My take on USB was to get 2 helper instructions, one for bit reading and one for crc calculation. Both were simple. Then a cog would be used to assemble the bytes including unstuffing and crc calculation. The same cog would transmit the bits.

    Isn't that what some of these 16 cogs are for?

    Unfortunately, without the helper instructions and 96MHz, the USB task is just that much harder. Add that to the moving target, and the possibility of a full byte assembling hardware, I have just sat on the sidelines, and developed some P1 stuff instead.
  • cgraceycgracey Posts: 14,133
    Cluso99 wrote: »
    My take on USB was to get 2 helper instructions, one for bit reading and one for crc calculation. Both were simple. Then a cog would be used to assemble the bytes including unstuffing and crc calculation. The same cog would transmit the bits.

    Isn't that what some of these 16 cogs are for?

    Unfortunately, without the helper instructions and 96MHz, the USB task is just that much harder. Add that to the moving target, and the possibility of a full byte assembling hardware, I have just sat on the sidelines, and developed some P1 stuff instead.

    There are some I/O driving requirements that make things tight, like needing to control DIR and OUT simultaneously. The smart pin does this now by leaving DIR on, but changing the high/low modes (1.5k/15k/drive/float) on each clock cycle. We'll do it right, but without the CRC stuff.
  • Chip, without the CRC bit would our USB hardware support a fully-compliant bridge functionality (the FTDI stuff)?

    Ken Gracey
  • It seems like a general purpose CRC calculator would be useful USB as well as other serial protocols. The gate count should be fairly small. Isn't it just a shift register with XOR gates?
  • TubularTubular Posts: 4,622
    edited 2016-03-17 19:11
    Chip, lets do USB/ethernet in the next silicon. The v7 image seems mostly solid and ticks all the initial goals off.

    I think we all sense USB unpleasant, and hoping someone else would deal with its unpleasantness so we wouldn't have to. Trouble is it's probably unpleasant all the way up, from this bit level stuff up to drivers and beyond.

    We can have a lot of fun with the chip as it stands in the v7 image. We may even be able to achieve usb using the programmable state machine modes by sacrificing a few cascaded pins, and operating at a multiple of 12MHz

  • jmgjmg Posts: 15,148
    cgracey wrote: »
    Today I should have the transmitter done. Then, I'll bring the receiver in. It's really not that much silicon. I don't think the testing for this is all that complex, either. It's going to be more about getting the software interface straight, so that writing code for it is not ugly.

    Great, Sounds very close.
    Ramon wrote:
    BTW, the FT232H/FT2232H has a fast synchronous 245 parallel FIFO mode and the datasheet claims 35 MBytes/s. The FTDI outputs a 60 MHz clock and sends 8 parallel bits.

    I think It would be much more worth the effort to adapt the P2 streamer to this fast 245 FIFO. Also, a 245 mode seems kind of generic and can be used for any other communication purposes.

    Certainly, these faster chips need to be supported, as the planned USB is LS/FS only, and the streamer can pump data far faster than FS USB.
    They should not be overlooked - I believe both paths are needed.

    I have always assumed talk of 'the streamer' included simple handshake / FIFO lines for connection to other hardware, but given Chip's more recent questions I'm not certain of this ?
    Ramon wrote:
    You can order FT600 or FT601 at digikey for less than US $10 (single quantities).

    They are USB 3.0 and are able to do stream 16 bits (FT600) or 32 bits (FT601) at 100 MHz. The datasheet also said that can talk at 66 MHz, but this is not clear. BTW, can the P2 streamer handle this?

    Yes, they are stocked !!! (FT600 344 pcs., and FT601 531 pcs.).

    The FT600 looks a little tougher than FT232H, as it seems to have only two CLK choices, and requires the P2 is a slave to that clock.
    Possibly a P2 > 132MHz might manage this ?
    Not sure how to test this tho ?
  • jmgjmg Posts: 15,148
    Ken Gracey wrote: »
    Chip, without the CRC bit would our USB hardware support a fully-compliant bridge functionality (the FTDI stuff)?

    CRC is needed somewhere, it is a question of HW? at the pin?, or in SW ?
    Dave Hein wrote: »
    It seems like a general purpose CRC calculator would be useful USB as well as other serial protocols. The gate count should be fairly small. Isn't it just a shift register with XOR gates?

    I'd try the USB flow with SW CRC, and see what the real-world issues are.
    If the SW cannot keep up, then that makes a stronger case for Logic-CRC

    If it was needed, maybe CRC-Logic could slip into the Cordic ?
    That has only one copy, and the turn-around speed for Cordic may be ok here.

    This should be able to support both LS and FS USB ?
    Early testing could be on LS USB, then FS, as the code is tuned.
  • jmgjmg Posts: 15,148
    mindrobots wrote: »
    AliExpress just told me today that I can get a USB to TTL dongle for $0.79!
    Yes, entry level USB is cheap, but the details matter.

    P2 will be able to manage both HOST and DEVICE, which none of the sub $1 parts can, and P2 will be able to push USB to full FS bandwidth.
    When you actually test many of the cheap USB parts, they struggle to do above 1~2MBd sustained flows.

    It seems closer to $1.50 is needed, to get what I'd call proper Full Speed operation.

  • jmg wrote: »
    Ken Gracey wrote: »
    Chip, without the CRC bit would our USB hardware support a fully-compliant bridge functionality (the FTDI stuff)?

    CRC is needed somewhere, it is a question of HW? at the pin?, or in SW ?
    Dave Hein wrote: »
    It seems like a general purpose CRC calculator would be useful USB as well as other serial protocols. The gate count should be fairly small. Isn't it just a shift register with XOR gates?

    I'd try the USB flow with SW CRC, and see what the real-world issues are.
    If the SW cannot keep up, then that makes a stronger case for Logic-CRC

    If it was needed, maybe CRC-Logic could slip into the Cordic ?
    That has only one copy, and the turn-around speed for Cordic may be ok here.

    This should be able to support both LS and FS USB ?
    Early testing could be on LS USB, then FS, as the code is tuned.

    But, as you point out (though I know it's not your intent), there are just way too many questions that still need to be answered. This is part of my concern about adding hardware USB support at this point in time. Once it's added, then we MUST make sure that both device and host implementations will work correctly. And that MUST be done before the P2 can be finalized. Not only that, but if we apply the same due diligence that we've applied to the rest of the current implementation, we will need to make sure that the hardware is as optimized and easy to use as possible. If we know anything about Chip's ideals, we know won't release the P2 until he's sure it's done right. And that will take a non-trivial amount of time for something as complex as USB.

    Having said all that, Chip's prior comment makes it clear that he absolutely intends to implement the USB hardware support, so I hope that those who want baked-in USB are already working on a software stack, test code, etc. As soon as Chip's released an image, it's the software that will be holding up the his ability to call the design complete.
  • Cluso99Cluso99 Posts: 18,069
    FWIW, we do not require the 5bit crc as most of the message is constant and can be pre-calculated. There are 2 main variants of CRC16, the IBM (USB) and CCITT. IIRC I tested both these in P1 software.
  • jmgjmg Posts: 15,148
    Seairth wrote: »
    Having said all that, Chip's prior comment makes it clear that he absolutely intends to implement the USB hardware support, so I hope that those who want baked-in USB are already working on a software stack, test code, etc. As soon as Chip's released an image, it's the software that will be holding up the his ability to call the design complete.
    Agreed, but Chip's pre-release testing will include handling basic USB signaling, and the messy bit-level stuff is done - and tested, as you either (NRZI+Bit-Stuff) right, or it simply fails to work.

    A parallel 'ghost' RX is how I would test the Rx side - clip the P2 onto a working USB link, (eg FT23x already on PCB) and test until you can extract what the FT23x sees.
    Then, start adding replies on another USB pin pair, until the scope says they 'line-up' with FT23x replies.
    When all that looks ok, live connects can be tested.

    Chip says "I don't think the testing for this is all that complex, either. It's going to be more about getting the software interface straight, so that writing code for it is not ugly."

This discussion has been closed.