Add USB To Your Electronics Projects! - The USB Protocol Explained

Поделиться
HTML-код
  • Опубликовано: 2 фев 2025

Комментарии • 409

  • @SineLab
    @SineLab  Год назад +11

    For anyone wondering, here's a link to the SMD adapter: www.aliexpress.us/item/2251832624996364.html?spm=a2g0o.productlist.main.7.76c52ecbfcRb7K&algo_pvid=19f78b0c-252a-414f-99fe-3a8ca3f2ad5c&algo_exp_id=19f78b0c-252a-414f-99fe-3a8ca3f2ad5c-3&pdp_ext_f=%7B%22sku_id%22%3A%2264495190690%22%7D&pdp_npi=2%40dis%21USD%2111.8%219.91%21%21%21%21%21%40211bf12316751972869527289d06f4%2164495190690%21sea&curPageLogUid=S39oAQQcKzaA

    • @Jobbyhoyker
      @Jobbyhoyker 7 месяцев назад

      That link is dead is there a specific search term to find something similar.

    • @SineLab
      @SineLab  7 месяцев назад

      ​@@Jobbyhoyker You can search for "TQFP32 QFP32 TO DIP32 adapter".

    • @Jobbyhoyker
      @Jobbyhoyker 7 месяцев назад

      @@SineLab thanks

  • @unknownerorr2740
    @unknownerorr2740 Год назад +328

    I have no idea how I ended up here. I'm light years away from this level of engineering. But this video was explained so well. This seems really helpful! Thank you for making this!

    • @SineLab
      @SineLab  Год назад +19

      Thanks for watching! I'm sure you will find it more personally useful in the future. :)

    • @AutoFirePad
      @AutoFirePad Год назад +11

      These are your first steps...

    • @voice5sur5
      @voice5sur5 Год назад +3

      same i'm here and was able to watch 40% of the video despite having not skill or knowledge about what i'm watching. he did a good job.

    • @tissuepaper9962
      @tissuepaper9962 Год назад +7

      If you've ever successfully used Arduino to do anything, you can handle this. Everything you need to know to use USB on a day-to-day basis is in the chip documentation. Most of these details about the exact workings of the protocol aren't relevant if you just want to make something with USB capability, and you can always come back later when you need to understand more. Good luck.

    • @vking4784
      @vking4784 Год назад +1

      I use to watch this stuff and think just this but i'm now gratefull that i did i outstand in a lot of ways at work and at clubs in uni because i just enjoyed the subject and focused on whatever came at hand on youtube so just whatch whatever stuff comes along if you dont learn anything its still a great way to have a keywords to search for and in no time you'll be able to undstand a lot of complicated stuff .
      Good luck to you

  • @PhilXavierSierraJones
    @PhilXavierSierraJones 2 года назад +171

    If you *just* need serial connection to be turned into USB connection, CH340 (with some series of chips requiring even less external components than the rest, like CH340C) is a really, really cheap option.

    • @jan.tichavsky
      @jan.tichavsky 2 года назад +9

      Even better is to use the $1 RP2040 or whole Raspberry Pico board. USB with C or Python, plenty of power, good amount of I/O and the board is ready to use, embed in existing project.

    • @TheCuteZombie
      @TheCuteZombie 2 года назад

      The problem is, those implementations are already talked into exaustion by all other sources. Just type "diy USB" in any search engine and you are bombarded by usb to serial and the likes. Good for a cheap, fast and not customizable application, but horrendous for anyone actually trying to understand the protocol and create a more complex application.

    • @carlosgarcialalicata
      @carlosgarcialalicata 2 года назад +8

      I prefer CP2102N, smaller and even less external requirements

    • @urnoob5528
      @urnoob5528 2 года назад +1

      @@jan.tichavsky ch340 is like cheaper and easier to use
      dont even need to program.
      and by plenty of power, do u mean strapping a whole other microcontroller to ur device or do u mean it consumes more power
      did u read what the comment said? we just need an interface to usb. for example, for a microcontroller or cpu like 8051 and 6502, mybe these are too old, what about atmega328p which a lot of people still uses then? we could just add a hardwired usb chip like ch340
      nobody sane would put a rp2040 on there, at that point, just use the rp2040, and all the other parts in ur existing project has now become extra and obsolete
      8051 and 6502 are too old for commercial products, but who to judge u if u use them for home or hobbyist project? that is another reason to opt for a usb chip, rp2040 overkills and defeats the purpose, it seems ironic to use rp2040 as the usb interface while these older micros are the actual brain of the project
      of course this assumes that u didnt start ur project with rp2040 in mind but other components
      if u have thought of usb, u would have chosen the appropriate components in the first place, like rp2040

    • @Mr.Leeroy
      @Mr.Leeroy 2 года назад +2

      USB to TTL is only one class of USB spec. It won't do HID, Mass Storage, other..
      But, ofc, there are easier ways. Like Digispark based on tiny85 with premade libs, which can do some.

  • @SheeplessNW6
    @SheeplessNW6 2 года назад +46

    Oh wow! I had no idea those solderless SMD adaptors existed! The whole video was good, but that bit of information was life changing!

    • @SineLab
      @SineLab  2 года назад +6

      Those adapters are really handy

    • @myetis1990
      @myetis1990 2 года назад +6

      @@SineLab and expensive too :)

    • @Mr.Leeroy
      @Mr.Leeroy 2 года назад +2

      they are mainly aimed at pre-programming before assembly line, not prototyping.

    • @tissuepaper9962
      @tissuepaper9962 Год назад

      @@Mr.Leeroy I've also seen some companies using them as a way to make a universal development board for their whole range of chips. I want to say it was a TI board that I'm thinking of.

    • @teejay872
      @teejay872 Год назад

      @@myetis1990 They used to be in the hundert dollars pricerange. But you can get them for "cheap" in china nowdays.

  • @thompsonschwabbel6622
    @thompsonschwabbel6622 Год назад +7

    i've harvested a bunch of analog turning knobs, sliders, latching and tactile switches from a ancient fried 8-channel sony mixpult. I'm gonna use them to upgrade my flightsim setup; this video is worth its time in gold since i had no idea how to cross the analog-digital bridge. thank you a thousand times.

    • @SineLab
      @SineLab  Год назад +1

      Thank you for watching and good look with your project :)

  • @Mike98006
    @Mike98006 2 года назад +43

    Great introduction to USB programming. It would be nice to see a video explaining how HID interfaces work and how they correlate with the low-level USB transfers described in this video.

    • @SineLab
      @SineLab  2 года назад +7

      Thanks for the idea!

  • @jercos
    @jercos 2 года назад +57

    Excellent overview, though for nearly $4 in the current market, I'd favor an RP2040/pi pico over an atmega. PIOs can handle matrix scanning, sensor interfacing, and even a second USB, while the SIO peripheral offers the low-latency pin access often missing from 32-bit mcus.

    • @SineLab
      @SineLab  2 года назад +6

      Pick whichever solution works best for your project :)

    • @Mr.Leeroy
      @Mr.Leeroy 2 года назад +3

      RP2040 can be had at $1 nowadays.
      So, yeah, it or Pico is a winner at availability.
      This video, on the other hand, is clearly a low level hardware exercise, and AVRs are still a great foundation for that.

    • @PainterVierax
      @PainterVierax Год назад +2

      @@Mr.Leeroy RP2040 is not a great solution either.
      This chip has very weak current output capabilities (max 12mA) and often requires the addition of discrete transistors.
      It's great to have two cores but they are quite obsolete ARM Cortex M0.
      Then compared to classic AVR or PIC, those 32bit MCUs have a convoluted HAL when digging a bit into advanced programming and they rarely have integrated logic level shifters to communicate with the still very popular 5V logic.

    • @Mr.Leeroy
      @Mr.Leeroy Год назад +3

      @@PainterVierax It is a bad practice to connect IO directly anyway (in any industrial device). STM32 is guaranteeing even less current (9mA IIRC). Most of the pins on RP2040 are 5v tolerant and level shifter requires 2 FETs, that are dirt cheap, I see zero issue with that.

    • @PainterVierax
      @PainterVierax Год назад

      @@Mr.Leeroy Direct i/o is only a bad practice when you have non-rugged MCUs because I saw that on almost every PCB design embedding MCUs, SoCs or good old processors.
      Though industrial devices generally don't use USB but Canbus, RS485 or Ethernet which require proper transceivers nonetheless.
      A proper RP2040-based devboard means that a lot of discrete components have to be around.
      I don't preach for STM32 either. Its HAL is atrociously convoluted.

  • @soroush92
    @soroush92 2 года назад +4

    God knows how many times I tried to find a useful resource to get familiar with usb protocol. God bless u and ur family sir. I will follow u forever ♥️

  • @Listeningtomuzak
    @Listeningtomuzak Год назад +7

    I studied molecular biology. It’s amazing how DNA encodes its information so efficiently - i.e. at the most basic level our genes are coded following the same structure as the USB packet. There’s a binding site that allows for a protein complex to latch on upstream of the gene. Then that complex slides along the DNA, sniffing for the START sequence. Downstream of that is the body of the data, followed by a STOP sequence. At a higher level, there’s plenty of extra modifying data in and around the gene, as well as different interpretations of the data where chunks can be edited out. The bulk of this coding scheme evolved in very, very early life and every cell on earth depends on this established protocol. There’s so much more going on at the higher control level of gene translation that we still don’t understand - we need the brilliant minds of computer science to reveal to us how exactly the cell operates translation and gene expression.

    • @dc37009
      @dc37009 11 месяцев назад

      Beautifully illustrated ~Thanks !
      ...and I think your talking about immortal scale, beyond Rain Man. I think AI will have something helpful to say on the subject !

    • @pepe6666
      @pepe6666 4 месяца назад

      that is absolutely mind blowing. i would love to know more about that.

  • @alexstone691
    @alexstone691 2 года назад +189

    I thought finally a VUSB tutorial that a mortal can understand, most distributers dont ship to Serbia and locals are ripoff and dont have most modern ics

    • @SineLab
      @SineLab  2 года назад +44

      I've added V-USB to my list of future videos. ;)

    • @alexstone691
      @alexstone691 2 года назад +10

      @@SineLab I've made whole library with libusb without understanding the protocol, the video was quite useful not gonna lie

    • @lasskinn474
      @lasskinn474 2 года назад +4

      @@SineLab please do, it would get at least somewhat popular.

    • @jessyltr581
      @jessyltr581 2 года назад +3

      Seems like you could easily build a honnest buisness selling ics in Serbia then you'd beat competition through good customer support and parts availability.

    • @alexstone691
      @alexstone691 2 года назад +7

      @@jessyltr581 Probably not, the country is pretty corrupt and taxes are high so if any politician or anyone important has anything to do with existing companies then youre screwed

  • @StephenBrown85
    @StephenBrown85 2 года назад +12

    This was a really nice and concise intro - a lot of other videos on the topic are 45 minutes long and so boring I couldn't make it through!

    • @SineLab
      @SineLab  2 года назад +1

      Thank you for watching through it :)

    • @crossbones911
      @crossbones911 2 года назад +1

      I agree. It's a good primer.

  • @andrew2004sydney
    @andrew2004sydney Год назад +4

    Cool video, dude! I was expecting the USB FTDI UART merry-go-round ride, but instead we went on the USB roller coaster, underwater in the dark! Thanks

  • @lalchandra4590
    @lalchandra4590 Год назад +1

    Oh really this is 15 min long video. I think it's level is many hours of study in college. I shocked that this video's every frame is informative.
    Thanks for saving alot my time.

  • @RegisMichelLeclerc
    @RegisMichelLeclerc 2 года назад +11

    Ben Eater has made a video on the USB protocol explaining it from the oscilloscope point of view, with an implementation on 6502.

  • @snipsnap9995
    @snipsnap9995 2 года назад +2

    This is exactly the type of video I was looking for a few months ago! This is the perfect start for those who want to hack around with USB

  • @rusticbear195
    @rusticbear195 Год назад

    This is not at all what I was looking for, but I'm glad I got here. This was a wonderfully in depth guide

  • @SodAlmighty
    @SodAlmighty Год назад +1

    That was the most detailed and useful USB tutorial I've ever seen.

    • @SineLab
      @SineLab  Год назад

      I'm glad you found it helpful

  • @TriPham-j3b
    @TriPham-j3b 2 месяца назад

    Thanks!

    • @SineLab
      @SineLab  Месяц назад

      Thank you! I'm glad you enjoyed the video!

  • @aaronstanley6914
    @aaronstanley6914 Год назад +3

    Timestamps:
    @0:01 intro
    @1:00 selecting a microcontroller (why you need to be picky)
    @2:50 parts & circuit diagram.
    @3:57 USB protocol explained
    @12:32 Libraries to interface with USB protocol. Luff library FTW No need for drivers.
    @14:46 debugging programs.

  • @dalesmith8666
    @dalesmith8666 Год назад +2

    The absolute easiest USB chip to use is the Microchip PIC18F4550, DIP40! Plenty of examples, great datasheet, and applications notes. Been using these for years! No surface mount nonsense, either! An excellent book is Jan Axleson USB Complete, for those that want to learn and experiment.

  • @michalsebek2089
    @michalsebek2089 11 месяцев назад

    Fun fact, on Arduino Uno, the chip handling the USB-serial conversion is actually the ATmega 16U2 microcontroller. Furthermore, you can easily reprogram it to another purpose. Although its IO is very limited, it is connected to the main ATmega328P microcontroller through two pins (the ones that normally serve as the serial line), so you can use a serial protocol to exchange data between the two microcontrollers on-board.

  • @cognisent_
    @cognisent_ 2 года назад +1

    Well hello there, small channel that the RUclips algorithm decided to promote! This video was awesome! I had no idea I'd be learning about the bit level USB protocol this Saturday. I am going to try to commit kjkjkjkk to memory because that seems like some fun trivia to store. I'm about to go binge the rest of your videos and I'm excited to see what you make next! Thanks for making awesome content, new friend 🫂!

    • @SineLab
      @SineLab  2 года назад +1

      Thank you, enjoy all of the videos I have to offer :)

  • @stevekoehn1675
    @stevekoehn1675 2 года назад +5

    You explain these concepts so efficiently and clearly. My brain is getting older and this is what I need! Thanks

    • @SineLab
      @SineLab  2 года назад +1

      I'm glad I could help!

  • @cat22_a1
    @cat22_a1 2 года назад +2

    Years ago I was tasked with writing a raw USB driver from scratch for Itanium. It was quite a challenge but i eventually got it working. All I had to go by was the spec. We had no libraries or even a file system. Code was loaded by direct injection using a special card.

  • @GregMatoga
    @GregMatoga 2 года назад +9

    Sooo excited to test that out! Although, I have this lurking feeling of dread of programming a custom driver

    • @SineLab
      @SineLab  2 года назад +3

      Get ready to debug it! :)

    • @newmonengineering
      @newmonengineering 2 года назад +1

      I built a custom driver one time...Microsoft is not nice. Maybe Linux is better? I only programmed it for windows. It was a file based storage type driver and was an absolute nightmare. It did finally work after 6 months of playing with it. But like I say, Microsoft is not nice. It's a real pain to get working. So many parts to the puzzle and getting them all to work together is a serious pain. However now there are many HID compliant ways around drivers, it is probably the best route if you can modify one and use the standards they have for the various driverless devices in that category. All the best to you if you write a driver!

    • @BrightBlueJim
      @BrightBlueJim Год назад

      A very common thing, at least among electronics hobbyists, is to NOT program a custom driver. Many projects I've seen just use one of the standard Human Interface Devices, like keyboard, joystick, serial, or mass storage, with the most common being serial. This allows your "driver" to just be user code (i.e., not a device driver at all) that takes care of one side of a client/server relationship between the host and device.

  • @Delali
    @Delali 2 года назад +5

    This is really cool to learn. I kinda got a little lost mid-way but i think its because of all the technical terms.
    I'd definitely implement some of the ideas here soon on my channel. Always good to learn

  • @ZomB1986
    @ZomB1986 Год назад +2

    If it's not a keyboard or serial endpoint, then you *still* don't have to write drivers for your PC. You can make a regular application that interfaces with USB hardware, like I did with a LabSphere spectrometer with proprietary communications (reverse engineered with Wireshark). I even did it in Java.

  • @timewave02012
    @timewave02012 2 года назад +6

    On the software side, a lot of people have trouble grasping the concept of the HID report descriptor, and how it dictates the format of the HID reports, so that might be worth explaining if you're looking for topics. Canned driver/library code usually handles it poorly, with hardcoded report descriptors, and no obvious connection between the descriptor and the code that generates the reports.

    • @SineLab
      @SineLab  2 года назад +3

      Thanks, that's a good topic.

    • @mrkv4k
      @mrkv4k Год назад +1

      Great point. I'm building my own Joystick and this stuff gave me nightmares.

    • @timewave02012
      @timewave02012 Год назад +1

      @@mrkv4k Did you end up figuring it out?

    • @mrkv4k
      @mrkv4k Год назад +1

      @@timewave02012 Well, yes. After reading much of the USB documentation, going through some examples and a bit of try and error. I am using the PIC24FJ64GB004 uC and I managed to get it working with the Microchip Harmony example libarary, but I can't recommend it, because it's hard to extrapolate for an actuall application.
      I am building the mechanical part now, the electronic part is working and has a 32 possible button inputs and 7 analog channels (3-axis plus 4 sliders).

  • @jmhannnon
    @jmhannnon 7 месяцев назад

    The FTDI USB to serial adapter you showed at the beginning can also be used as a USB to GPIO adapter. Works great when you just need to control a few logic lines.

  • @TradieTrev
    @TradieTrev 2 года назад +1

    That's a damn good explanation, this is totally how they made the rubber ducky/bad usb devices!

  • @BalugaWhale37
    @BalugaWhale37 2 года назад +4

    Very comprehensive. The J/K explanation was most interesting.

    • @SineLab
      @SineLab  2 года назад

      Thank you! :)

  • @B.E.H.
    @B.E.H. Год назад +1

    Hi friend, please help me with a simple doubt (for you)!? How many VOLTS do we have in DATA LINE just plug-in a USB connector in the USB port of a computer???
    I need just make 2 LEDs blink after plug-in the USB to show me the data lines (D+ and D-) are OK, please help me with this little project. 😞

    • @SineLab
      @SineLab  Год назад +1

      The USB Power lines are 5V. The data lines are 3.3 volts.

    • @B.E.H.
      @B.E.H. Год назад +1

      @@SineLab Thanks friend... What about make 2 LED for D- and D+ lines, do you know to do that connection to blink?

  • @imdeadserious6102
    @imdeadserious6102 4 месяца назад +1

    1:10 Yeah but the 328 is a couple bucks and can be programmed through a usb to serial device and a couple wires. As long as you arent using, or have a disconnect to a device using the 2 serial data pins. Ive never seen a need for anything but a 28pin 328p-pu unless you have multiple serial devices, more io requirements, or a data storage limit as an issue (being only 32kb)
    If you want a full fledged screen, touchscreen etc then that jumps the boat to higher complexity usually as youll probably also be running some small software that would destroy the memory cap of an arduino

  • @MrRecorder1
    @MrRecorder1 2 года назад +60

    Just wondering: I totally expected you to mention the FTDI-series of chips here. If you purely want to ADD USB to your project, I would go for those. They are pricey, but you can in fact mostly ADD them and leave the rest of your design unchanged (serial communication channels are needed ofc). Also you can get fully fledged modules for quick setup. I typically end up using arduino's to add USB-support for devised however. I like their versatility. And for home projects, who really cares if you use 20 microcontrollers for a task that really would only require one :D

    • @SineLab
      @SineLab  2 года назад +16

      You are right, if all you need is serial then that would be the best option, along with cheaper alternatives like the CH340. This video was more about usb devices like keyboards, mice, etc. :)

    • @akkudakkupl
      @akkudakkupl 2 года назад

      @NRGY VIA is not the right chip to serve async serial. You want an uart for that

    • @akkudakkupl
      @akkudakkupl 2 года назад +1

      @NRGY Read up on asynchronous serial communication. You need an UART to recieve it, you could do it in software, but that will limit the speed a lot, in addition your computer will have to waste time on doing serial stuff instead of doing computing stuff.
      There are no 'fifo' lines in RS232, there is RX and TX.

    • @AJMansfield1
      @AJMansfield1 2 года назад +3

      Though even for a prototype it does sometimes feel a bit silly to have a USB serial uC talking to a GPIO expander uC talking to our applications uC talking to a GPS uC and a bluetooth uC and a battery charge controller uC which itself is talking to the battery's own protection uC...

    • @akkudakkupl
      @akkudakkupl 2 года назад

      @NRGY Read this en.wikipedia.org/wiki/Asynchronous_serial_communication

  • @HuskyNET
    @HuskyNET 2 года назад +2

    I think you’ve mixed up NACK and STALL at 9:46. NACK means error and STALL means device busy.

  • @Harve6988
    @Harve6988 3 месяца назад

    This is an amazing video! Thank you!
    As a noob to all this stuff, the one thing I didn't get from this, and had to go look up was that USB 1 and 2 are half duplex - I.e. only one of the host or device can send data at any one time.
    All throughout I was thinking - how do the device and the host use the same wires to communicate - and the answer is they don't- the host sends a packet and then the device responds.
    Was also wondering why the clock has to be so accurate, but thinking about it obviously has to detect the up and down transitions on the D+ and D- lines, without missing any of the transitions.

  • @e74av
    @e74av 2 года назад +1

    One of the most interesting videos lately :)

    • @SineLab
      @SineLab  2 года назад

      Thank you for watching :)

  • @mrtechie6810
    @mrtechie6810 Год назад +1

    Great! Now how would one change those pesky WiFi devices to use Ethernet? For example the Sonoff TH16.
    I need a remote smart thermostat on the building roof, and there is no WiFi AP there, so I would like to run a cable or use Ethernet over powerline.

  • @myetis1990
    @myetis1990 2 года назад +1

    thank you for the great content. cant wait to see the next video about usb. hope it will be a mass storage class tutorial. or DFU

  • @terencebossert9749
    @terencebossert9749 24 дня назад

    At around 7:40 the narration conflicts with the graphic about the EOP. I think the graphic is is right with JJ SE0, but the narration makes it out to be SE0 SE0 J.

  • @colinmcintyre1769
    @colinmcintyre1769 Год назад +1

    I didn't know I needed this. Thank you.

    • @SineLab
      @SineLab  Год назад +1

      You're welcome :)

  • @Cs13762
    @Cs13762 7 месяцев назад

    I love seeing videos like this with half a million views!

  • @chrisw1462
    @chrisw1462 2 года назад +5

    Definitely looking forward to more of this series. I've been interested in making my own USB projects for quite some time, and have had to rely on things like the CH340 serial to USB chips and ESP32-2 and 3 microcontrollers that have built in USB.

    • @cutterboard4144
      @cutterboard4144 2 года назад

      Its super simple with arduino and the right µc. i personally like to use the atmega32u4 "leonardo". But a few months ago i got my hands on some ESP32 chips with wlan and i might switch to them for future projects.

    • @urnoob5528
      @urnoob5528 2 года назад +2

      and he still talked about built in usb, so in actuality u were left hanging

  • @epolpier
    @epolpier 2 года назад +1

    Endpoint0 is not only for configuration. There are many classes that use it for "normal" communication using class specific requests.

  • @plinble
    @plinble 4 месяца назад

    Easier to use virtual serial over USB? No need to write drivers either? High data throughput or high power is a different kettle of fish, grab your 12V for motors from USB -C?

  • @patrickallaire229
    @patrickallaire229 2 месяца назад

    What do you think about ATMEGA16-16PU which is big enough for easy handling / soldering and in 2.54mm standard. Yes, it's way bigger than the proposed chip but way easy to solder or sit on a breadboard.

  • @pepe6666
    @pepe6666 4 месяца назад

    thanks man this is the video i needed to see. saved this for my reference.

  • @ElectroWolf_Arts
    @ElectroWolf_Arts Год назад

    the signal in 5:53 which one produces that pattern ?? the PC or the Device (keyboard for example) ?

  • @YTInnovativeSolution
    @YTInnovativeSolution 11 месяцев назад

    So what you are saying is.....
    USB protocol is very similar to automotive CAN Bus communications and since auto makers also have 'K-Line' communications, that could be related too. Thanks for the info. Well delivered with the graphics.

  • @djmips
    @djmips 2 года назад +1

    Nice! I've always wanted to know this but had a big mental block about reading up on it since the documentation is vast.

    • @SineLab
      @SineLab  2 года назад +1

      Yes, the datasheet is overly complicated

  • @alexandru-cosminvintila6115
    @alexandru-cosminvintila6115 2 года назад +1

    how about sending commands to a 3d printer via usb(the 3d printer has a ch340 that transforms usb data to serial for the 3d printer mcu)? Can this be a viable solution for sending, let's say G28 gcode command(go to home) to the 3d printer? Thank you,

  • @ServiceOrchestramegastore
    @ServiceOrchestramegastore Год назад

    Actually there are lot to learn in this tutorial than the topic. TFS!!

  • @BrightBlueJim
    @BrightBlueJim Год назад +1

    Everything was going great, up until the moment where you directed us to edit our Makefile. Since at no point in in either the description or the video itself, do you mention what your development environment is, I'm left hanging, and this is never resolved. Perhaps there is an earlier video in which you explain this, but just to let you know, I've never seen your channel before; I was just led there by a RUclips recommendation. It would be a big help if you could either state somewhere in the video or description what video I should go to if I'm not familiar with your video series or build environment. Not even your website is helpful in this - there is no "start here" introduction that I could find.
    And just to let you know, I am no beginner when it comes to microcontroller-based development; I have been working with Intel, Atmel, and ST microcontrollers for decades, so this isn't just an "I'm a noob and I don't know what I'm doing" comment. It is kind of a convention that you state what your tools are, so that at the very least your viewers can go elsewhere to get up to speed on that.

  • @dr_bobs_music
    @dr_bobs_music 8 месяцев назад

    I'm looking for a wireless USB extender, that is, one part acts like the male "A" end, the other acts like the female "A" end, and they connect by radio link. Neither the host nor the appliance know it's there. It would appear to be a cable, except the female/appliance end would supply the 5V power. Can you please point me to such a device?

  • @carlosbah4623
    @carlosbah4623 Год назад

    Just discovered this channel! Very good. ¡Gracias por compartir!

  • @BDCDT-LeucAnh
    @BDCDT-LeucAnh 7 месяцев назад

    awesome video! Seeing you use a WM makes me miss it so much. I used to play with dwm, i3wm a lot. Now I just use gnome but maybe someday I'll comeback to what I prefer.

  • @robonator2945
    @robonator2945 2 года назад +1

    This is only tangentially related but, how possible is it to have a device which reads input FROM a usb device? Specifically I've been wanting to work on getting a yubikey HMAC challenge response to interface with some of my circuits for authentication, but, well, usb is such a complicated standard I don't really know where to even start on trying to implement something like that.

    • @DFPercush
      @DFPercush 2 года назад

      Same wire protocol, but you're acting as the host instead of the device. You control the timing of everything by sending the Token packets and then receiving the response. Use Wireshark and see what happens when you plug the Yubikey into your PC. Or if it's just a personal project, it might be worth using a raspberry pi or similar device to bridge between the usb and GPIO. Just don't do the dumb of "short this pin to open the lock". There are USB driver chips as well, and serial -> usb bridges, but I don't have much experience with those.

    • @Mr.Leeroy
      @Mr.Leeroy 2 года назад

      you may probably drop yubikey requirement altogether simplifying task greatly. Otherwise, dealing with USB host side and producing drivers for it is no easy journey.
      There are specialized cryptography chips (SPI, IIC..), that offload functions just like that of main MCU, and some of them may already have existing libraries to interface with.
      Using them could be a lot easier.
      There are higher end MCUs that include such blocks on die.
      Things like TOTP (which uses HMAC btw) could be implemented with general purpose MCUs, it all comes down to storage for sercrets and how hard it is to extract them.

  • @HenkvanHoek
    @HenkvanHoek 2 года назад +2

    I like the explanation a lot. Question, where did you get the smd adapter. I could not find it.

    • @SineLab
      @SineLab  2 года назад +3

      Here is a link to one on aliexpress: www.aliexpress.us/item/2251832624996364.html?spm=a2g0o.productlist.main.7.76c52ecbfcRb7K&algo_pvid=19f78b0c-252a-414f-99fe-3a8ca3f2ad5c&algo_exp_id=19f78b0c-252a-414f-99fe-3a8ca3f2ad5c-3&pdp_ext_f=%7B%22sku_id%22%3A%2264495190690%22%7D&pdp_npi=2%40dis%21USD%2111.8%219.91%21%21%21%21%21%40211bf12316751972869527289d06f4%2164495190690%21sea&curPageLogUid=S39oAQQcKzaA

    • @HenkvanHoek
      @HenkvanHoek 2 года назад

      @@SineLab ordered. Thanks!

  • @dmytrokyrychuk7049
    @dmytrokyrychuk7049 3 месяца назад

    Is there a similar video about other protocols, such as UART?

  • @michaelzlprime
    @michaelzlprime 2 года назад +1

    Great and concise guide!

  • @TheRailroad99
    @TheRailroad99 10 месяцев назад

    The hardware part was a great overview!
    The software one was a little too fast however. Just editing the callback does not explain at all how the stack works. (How to configure multiple/custom endpoints etc)

  • @A_Canadian_In_Poland
    @A_Canadian_In_Poland Год назад

    The Arduino board has a ATMega16U2 on it, pre-programmed as a USB to serial converter. Perhaps showing a project using it?

    • @SineLab
      @SineLab  Год назад

      That would make for an interesting project

  • @trollobite1629
    @trollobite1629 10 месяцев назад

    RS232 is a long way from being dead, it is literally everywhere especially in networking. You will find it on Cisco, Infeneria/Transmode, Cienna etc, it's so prevalent we have to carry USB to RS232 converter leads.

  • @qzorn4440
    @qzorn4440 2 года назад

    wow after this I think I will stick to something simple like USB4 Thunderbolt. 🤣 Thank a lot for the great description.

  • @JyrkiKoivisto
    @JyrkiKoivisto 11 месяцев назад

    I once coded a device driver for AROS operating system (vusbhc (virtual usb host contoller), hosted on Linux) that talked to the Amiga "native" usb stack and used the user space libusb on Linux to talk to the real usb hardware, a stack inside of a stack... :)

    • @JyrkiKoivisto
      @JyrkiKoivisto 11 месяцев назад

      ruclips.net/video/BsEUUgSfAK0/видео.htmlsi=806HN-iQ5J1ogvEs

  • @richpaul6806
    @richpaul6806 Год назад

    Im curious about that solderless adapter. Can you give some more information on where to buy something like that? Ive never seen one before.

    • @SineLab
      @SineLab  Год назад

      Here's a link to one: www.aliexpress.us/item/2251832624996364.html?spm=a2g0o.productlist.main.7.76c52ecbfcRb7K&algo_pvid=19f78b0c-252a-414f-99fe-3a8ca3f2ad5c&algo_exp_id=19f78b0c-252a-414f-99fe-3a8ca3f2ad5c-3&pdp_ext_f=%7B%22sku_id%22%3A%2264495190690%22%7D&pdp_npi=2%40dis%21USD%2111.8%219.91%21%21%21%21%21%40211bf12316751972869527289d06f4%2164495190690%21sea&curPageLogUid=S39oAQQcKzaA

  • @alexanderskusnov5119
    @alexanderskusnov5119 9 месяцев назад +1

    Small cable length?

  • @1billthekid
    @1billthekid Год назад

    I'm no electronics wiz, but since this would "supposedly" USBify everything, how easy would it be to add a USB port to an Amiga computer using your implementation? Would it mean utilizing the Amigas' serial port to do that? Thanks for the video!

    • @SineLab
      @SineLab  Год назад

      Depends on what you plan on doing. If it is going to act as a device, then my method would work. If it needs to be a host, you should look for a micrcontroller with USB host capability.

  • @MishTheMash
    @MishTheMash 2 года назад +1

    PFFFT, Finally somebody decided to do a clear explanation of this.

    • @SineLab
      @SineLab  2 года назад

      It was about time.

  • @Code12x
    @Code12x 5 месяцев назад

    This is incredible. thank you!

  • @Ticktok_of_Oz
    @Ticktok_of_Oz 6 месяцев назад

    You mention about making a custom usb driver for a device at one point and that there would be a future video. This is something I've been interested in for a while, but haven't had much luck and haven't been able to find any guides or documentation for that. Are you still planning on making a video for that?

  • @MrVipulLal
    @MrVipulLal Год назад +1

    Great explanation. Many thanks 🙏

    • @SineLab
      @SineLab  Год назад

      I'm glad you found it helpful!

  • @Gastell0
    @Gastell0 2 года назад

    Native serial ports are still present on many business workstations, which is nice

    • @Mr.Leeroy
      @Mr.Leeroy 2 года назад +1

      they are on all consumer motherboards I know, just as a header and not IO plate connector.
      Look up COM port in a manual pdf for yours.

  • @jonahy-m2099
    @jonahy-m2099 2 года назад +2

    Great job👍😊

  • @EStLouisAsassin
    @EStLouisAsassin Год назад

    @SineLab
    Is it possible to convert an isa signal to usb? If not with this device,could you recommend a card that could accomplish this? Thanks !

  • @xzddakfdmiug5832
    @xzddakfdmiug5832 2 года назад

    Thanks for covering this interesting and popular protocol.

    • @SineLab
      @SineLab  2 года назад

      Thanks for watching!

  • @SB-qm5wg
    @SB-qm5wg 2 года назад

    Excellent video. Good info. I enjoyed that. TY

    • @SineLab
      @SineLab  2 года назад

      Thanks for watching!

  • @JoseGustavoAbreuMurta
    @JoseGustavoAbreuMurta Год назад

    Very good explanation about USB. Thank you

  • @fpgaguy
    @fpgaguy Год назад

    Very nicely done, and as a surprise you use vi, very nice indeed.

    • @SineLab
      @SineLab  Год назад

      Vi/Vim is a programmer's best friend :)

    • @fpgaguy
      @fpgaguy Год назад

      @@SineLab I have been using since 85 but started when I first brought up Unix box at home I built from bsd 4 sources Back then there was not much X so it used termcap to a vt102.

  • @sgwong513
    @sgwong513 2 года назад

    great explanation. good to know how usb works.

  • @edwardvanhazendonk
    @edwardvanhazendonk 2 года назад +1

    Great explanation, good to understand and as always protocols are not always straight forward.

  • @joseakasoniq7577
    @joseakasoniq7577 Год назад

    One question. I have a pair of old CDJ´s (DENON DN-S3000) so they only work with CD and are able to read MP3 files. I was wondering if there is a possibility to hack this devices installing a USB Port instead of using CDs.

  • @e-exp
    @e-exp 2 года назад

    Hi, the ATMEGA328 does handle USB 1.0 protocols with VUSB library and a 12MHz clock :)

    • @dekus80
      @dekus80 2 года назад

      Who cares about this junk from 90s when there are a lot of 32bit MC with hw usb cost less than a $. Or you can take tiny ch340e that doesn't need external quartz and get usb uart.

    • @e-exp
      @e-exp 2 года назад

      @@dekus80 The 8-bit MCUs are build more tough due to bigger lithography use. This is why they work at 5V and are more immune to high voltage spikes like from a welder or a plasma cutter. Also when comparing to devices like ARM cortex m0 they mostly do similar performance.

    • @dekus80
      @dekus80 2 года назад

      @@e-exp Did you ever heard about stm8, which is under 15 years old and a cut above avr, even in 8bit. With a full debugger via 2$ stlink, with all the settings on the fly in the code and cheaper that avr even in 8bit 'died' for me in that time.
      But now new mcus 32 bit. When 32bit is already cheaper, more productive, with rich peripherals and with lower power consumption in performance. Riscv Ch32v203 runs at 144mhz, has dma, 12bit adc, usb, can and so on (f103 somw clone) and all these even in tssop20. Runs at 4.6mA+ at 72mhz, less $. What is your performance at 4.6mA and price characteristics. Lol. Just amazing perseverance. And 16+ arithmetic on 8bit to call emulation functions same as on 32bit? Lol. And emulating hw usb in your case with 328 instead of mcu above with hw usb. We say that hedgehogs pricked but ate a cactus. For 3$ you have MB of flash and hundreds mhz performance. Ever wireless mcu modules (not just chip) for 2$ you can program and flash.
      32bit has already broken the bar of 10 cents. ch32v003 10 cents 32bit riscv mcu. Works at 5v. Ever at this price has 32bit arithmetic, 3 timers (with systick) and dma and 48mhz.
      The argument about lithography laughed. It remains to tell about spacecraft. We're talking general purpose.

    • @urnoob5528
      @urnoob5528 2 года назад +1

      @@dekus80 obviously a lot of people, including the millions who use arduino uno
      and old is a non argument, yes these are unsuitable for commercial production
      but are u trying to judge people who uses them for home or hobbyist project? they just want to use those, so what?
      people want to use 8051 and 6502, that is the entire purpose of their project, and who r u to judge that?
      and one thing to note is that these have magnitudes more documentations and community support

    • @dekus80
      @dekus80 2 года назад

      @@urnoob5528 I am also a hobbyist. And I didn’t earn a penny on my knowledge and skills in microcontrollers. At the same time, I even know assembler of different architectures avr, 51, stm8, arm, riscv. It all depends on laziness. I studied everything simply by pdf manual from manufacturers where you get reliable knowledge from the source. I can buy unknown for me uc, download manual, read quickly and start programming. And not waiste time on RUclips videos and bloggers with unknown competence. That is why I so freely choose the MC that is interesting for me for the task, and not one MC for everything.
      Some guys for their HAL arduino take 328. It was 13 years ago!! At that time it was possible to choose avr. But if you want to study now you'll first see 328 and arduino. And you will not see anything more. People do not even understand that there is something else. About the manuals on the uc to inderstand it. It turns out a vicious circle! The same thing from year to year, when everything around has already changed, you just need to take off the blinders and start watching on your own.
      I'm not saying that you need to look up to me, but at least open your eyes and somehow change your approach to learning. Now it look like you proves that the 2010 smartphone is better, that causes only smile when I use 202x devices and they are of a completely different level.

  • @lfmtube
    @lfmtube Год назад

    Very useful and well made video. Thank you

  • @RixtronixLAB
    @RixtronixLAB Год назад +1

    Nice info, thanks for sharing it :)

    • @SineLab
      @SineLab  Год назад

      You're welcome! :)

  • @HollyTroll
    @HollyTroll 2 года назад

    this was very very informative - thank you!

    • @SineLab
      @SineLab  Год назад

      You're welcome! Thanks for watching!

  • @-AnyWho
    @-AnyWho Год назад

    i have a old led battery powered closet light that i never used cuz i don't buy batteries so i got a old usb cable cut one end off and soldered the black and red wire to the two main battery terminals and mounted it by my keyboard and plugged it in usb port on pc. now i have a night light for keyboard and it shuts off when i turn pc off ...

  • @NOW-IS
    @NOW-IS Год назад

    Could USB (at least hardware layer) be used for a custom low power bus system with one master and many slaves?

  • @marcdraco2189
    @marcdraco2189 10 месяцев назад

    One minor thing, you appear to have misunderstood how balanced lines (D+/D-) work. Unless you were oversimplifying, there's more here than "simple" noise rejection.
    For example, I haven't tried this with USB, but a balanced pair doesn't need a ground to work. In fact the ground doesn't need to be connected at all because the difference in voltage between the two lines creates the signal when it's mixed at a differential amplifier.
    A much earlier use for this sort of thing is in "phantom powered" microphones which use the two "data" lines here to supply power to a small audio amplifier (strictly an impedance converter). Each line carries +48V (in theory, in practise it never reaches that when in circuit) out to the microphone with and two (opposing signals) on way back. However, some of these mics are "self-powered" and only need to use the two inner cables to send the sound back to the preamp. The outer screen is used as a Faraday shield and doesn't have to be connected to the circuit ground (and it can even create issues if it is).
    Ground (0 volts) is a reference. Any point in a circuit can be "ground" and in fact, at AC, both sides of a simple circuit look like ground. But since ground is a reference, in some cases the actual voltage between circuit ground and "earth" ground can be 1000s of volts. In cases like this differential signals completely isolate everything from that and each end (transmitter/receiver) can have its own idea of what "0 volts" is.

    • @raffazaver
      @raffazaver 3 месяца назад

      I am too stupid to understand what I just read

  • @sagar73594
    @sagar73594 Год назад

    Great Scott, good one.

  • @zetaconvex1987
    @zetaconvex1987 2 года назад

    Niceley explained. You obviously know more than me. Just a point: I think the differential pair is to help with clock drift. It's nice to see a an MCU with USB support, although I have never dealt with standalone chips. My soldering isn't up to it. I go for boards that I can plug in. I've implemented a USB driver using an RP2040 and tinyusb. Amazingly, it actually works given the complexity of USB.

    • @tiger12506
      @tiger12506 2 года назад +4

      The differential pair is for noise. You can subtract the one signal from the other to completely remove any "common-mode" noise -- that is, noise that is common to both wires (external noise). Further, equal and opposite voltages result in equal and opposite magnetic fields that cancel each other out in a twisted pair. The KJKJKJKK sync at the start of each packet is what fixes clock drift.

    • @zetaconvex1987
      @zetaconvex1987 2 года назад +1

      @@tiger12506 My bad. I think I mean the whole JK thing. If you have a stream of zeros, for example, which is quite common, the lines will toggle, helping to mitigate clock drift.

    • @BrightBlueJim
      @BrightBlueJim Год назад

      @@zetaconvex1987 That's actually part of the NRZI protocol, which unlike RS-232, does not assume that you have fixed and stable clocking, allowing the receiver (or device, in USB parlance) to synchronize with the clock on a bit-by-bit basis rather than between characters. NRZI always has at least one transition per bit. It also has the advantage of always having the same amount of time high and low, on every bit, which allows for connections that must be isolated through a transformer, since establishing the high and low references is simple. In practice, USB interfaces are rarely if ever actually isolated, expecting that the devices can always be set to use the same ground as the host, but the design allows for it just the same.

  • @dymastro788
    @dymastro788 2 года назад

    Amazing content, looking forward to future video's

    • @SineLab
      @SineLab  2 года назад +1

      Stay tuned :)

  • @komplikatorful
    @komplikatorful 2 года назад

    How much ram does this library use? I'm wondering because it seems that Atmega16 is just 1k SRAM which is really not *that* much if you do want to have some more complicated peripherals connected etc...

    • @kesor6
      @kesor6 2 года назад

      The ATmega32U4 has twice as much memory as the ATmega16U4. And you can also use the Flash and EEPROM for extra code space.

    • @komplikatorful
      @komplikatorful 2 года назад

      @@kesor6 I know but EEPROM & Flash will not necessarily help me with RAM that much if the library eats up 90% of my 1k of RAM 😅 I'm asking specifically because of the USB complexity - you have to have some buffers (guessing ~100-150 bytes per endpoint) and you will have to have atleast few (config, serial data, maybe more). Then you will have to have some circular buffer for serial communication, lets say 64 bytes for each direction (rx and tx). It can add up quickly - hence the question 🙂

  • @Harm10412
    @Harm10412 Год назад

    This was an awesome video!

  • @ShirishJadav162
    @ShirishJadav162 Год назад

    I want to make a small usb uart host such that I can connect some Arduino to its usb to collect serial data and store.. basically a usb serial data logger. Yes i can also log direct serial data but it's for a device that does not have gpio for seperate uart and sends data over usb serial. Any good suggestions ? Currently I do with raspberry pi but I want smaller simpler solution if possible.

  • @Zhaymoor
    @Zhaymoor 2 года назад

    Great explanation, thank you

  • @Umski
    @Umski Год назад

    About 20 years ago my 4th year project supervisor at uni casually suggested that I could implement a USB interface on an FPGA - needless to say it didn’t progress past a paper-based feasibility study 😂 I was following up to the J/K sync 🤯

    • @SineLab
      @SineLab  Год назад

      What a project that could have been!

  • @Quazee137
    @Quazee137 Год назад

    Here is a though for a project. Use the RPi Pico with a 2.8" up to a 4" LCD display. Create icons for keys in a 4 by (5 or 6) matrix. With this you can have more than one set of usable macros. Have two keys for moving through the other sets. I see all these keypad type of macros key but they use mechanical keys with fixed icons on them. Hold both up/down same time to go into upload mode for keypad the icons and macros.
    ATM I am playing with MMBasic on the Picos sadly no USB HID abilities.
    For my current use as controllers it just works. I only need minicom and the pico.
    Just musing after looking at the many ways here on youtube. Have FUN.😄
    I have a box of Arduino's in many forms along with STM32 boards just starting to learn to play with them.
    LOL forgot to say the LCD needs touch.

  • @c1ph3rpunk
    @c1ph3rpunk Год назад

    Ben Eater has an excellent video on how the USB protocol works.

  • @RoamingAdhocrat
    @RoamingAdhocrat 2 года назад

    ooooh. this is relevant to my interests. subbed!!

    • @SineLab
      @SineLab  2 года назад

      Awesome, thank you!