Bit Bang FT232 to Control SPI Devices

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 มิ.ย. 2024
  • Using C# to control individual pin states of FTDI USB-to-serial converters, I can bit-bang SPI devices! Here I demonstrate how to simulate clock, data, and chip select lines to control the AD9850 DDS (radio frequency synthesizer). I also also explore a bug that causes the output of the FT-232R to have funky timing (a problem which doesn't occur in the FT-232H).
    Project page:
    www.swharden.com/wp/2018-06-0...
    Code Demos used in this Video:
    github.com/swharden/AVR-proje...
    Polished FtdiDDS Program (to control AD9850):
    github.com/swharden/AVR-proje...
    More information can be found at my website: www.SWHarden.com
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 47

  • @rudymisek6032
    @rudymisek6032 2 ปีที่แล้ว

    This is so cool!! Never thought of using a FTDI converter like this, posibilities are endless. Thank you for making this video :)

  • @ArsenioDev
    @ArsenioDev 6 ปีที่แล้ว +1

    Fantastic video, knew the FTDI could do this but never found a nice clear resource like this. Thanks!

    • @swharden
      @swharden  6 ปีที่แล้ว +1

      Arsenio Dev I always wished there were a clear resource for how to do this, so I made one! Glad you found it useful

  • @goofypettiger
    @goofypettiger 2 ปีที่แล้ว

    Excellent video. Thank you for releasing this.

  • @HacksterIo
    @HacksterIo 6 ปีที่แล้ว +2

    Great video, Scott!

  • @chrismartin8489
    @chrismartin8489 ปีที่แล้ว

    Excellent video. This helped me understand a problem I was having writing software to control an 8-channel relay board using the FTDI chip. Even when disconnected I was getting responses as if the board was connected. Then I watched your video and figured it out: I have a USB to serial converter on my PC too!! I would have never figured this out without your video. Now, how can I NOT recognize the USB to Serial converter?

  • @videolabguy
    @videolabguy 2 ปีที่แล้ว +2

    Thank you. This was one of the first videos that did not bury me alive in excess complexity. For my upcoming project, I would like to have four 8 bit parallel ports. This could be two bidirectional 8 bit ports. Two ports, one for a 2 way data bus and the other a control and status port. I need to move many gigabytes of video data into and out of memory sims for a solid state video recorder project I have in mind. Not necessarily in real time. But, faster is better. Obviously.
    Think animation capture and video looping (up to almost two hours) of SD non compressed video. For my way of thinking this is WAY easier than serial data. I think the terms "serial and parallel: have become corrupted since my Z80/M68000 days of assembly language programming. Searches for "parallel ports" only turns up deep BS about Centronics printer ports! Geez!!!! I fell behind with so called high level languages which, to me anyway, are extremely complex to deal with. Especially direct IO functions. Yes, I am a pure hardware guy.
    Thanks again, your video has gotten my toe in the door.

  • @blakenorthrup
    @blakenorthrup 3 ปีที่แล้ว

    Sub'd. The electronics/programming world is so interesting, and I am about to start a few projects.

  • @yunusemresarac1079
    @yunusemresarac1079 ปีที่แล้ว +1

    this video is very understandable, you explained it very well, thank you very much, it is a very good content

  • @shreeyatyagi
    @shreeyatyagi 5 ปีที่แล้ว

    OMG!! love your website!!

  • @wirechair
    @wirechair 6 ปีที่แล้ว +2

    u are a genius

  • @LuisPedroSoaresMarnotoGasparLo
    @LuisPedroSoaresMarnotoGasparLo 10 หลายเดือนก่อน

    Do you think it is possible to do this using the cheaper CH340 chip? It has RTS and DTR signals, but I'm not sure It's possible to control RX and TX like you did, individually...

  • @ichabodsescape1885
    @ichabodsescape1885 3 ปีที่แล้ว

    Thank You so much for this very clear video, It solved 90 percent of my problems. I just need the additional c# code to read a pin with a button. I can't find a clear answer on the ftdi site or the internet. Is it as simple as ftdi.Read (dataBuffer, 8, ref bytesRead): //? When I do this the console just flashes without a reading. THX again.

  • @MrIsrael3000
    @MrIsrael3000 ปีที่แล้ว

    does it make sense to use this to check a regular magnetic door sensor? sending +5v to the sensor it will respond with +5v if is closed, I know it is not intended for that, can this damage the port? what is the disadvantage/risk in doing something like that, any alternative/recommendation?

  • @monkfoobar
    @monkfoobar ปีที่แล้ว

    Labeling got the subscription

  • @aggibson74
    @aggibson74 4 ปีที่แล้ว +1

    Nice video. Can you also bit-bang inputs so that I could read a SPI ADC?

    • @swharden
      @swharden  4 ปีที่แล้ว +2

      Yes, but since bit-bang reads are slow you must make sure your device is sending data pretty slowly

  • @steevek
    @steevek 4 ปีที่แล้ว

    Dear sir, I noticed inside video that the FTDI USB-to-serial converter had a squarely external crystal (must be connected to the FT232R chip). But in the market some of the converters uses internal oscillator. And it could become permanently unusable when run with FT Prog! This warning message shown in the FDTI utility web page. If this is correct, anyway to around with the possible damage issue? Many Thanks

    • @swharden
      @swharden  4 ปีที่แล้ว

      FTProg can be used to configure the oscillator source for the chip. If you use FTProg to configure your chip to require an external oscillator, and no external oscillator exists, your chip will obviously no longer function. This is why the warning exists, and the solution is simply to not do this. I'd feel safe using FTProg as long as I paid close attention to ensure the oscillator settings were always valid.

    • @steevek
      @steevek 4 ปีที่แล้ว

      Scott Harden thank you for your advice and the video

  • @SwapPartLLC
    @SwapPartLLC ปีที่แล้ว

    I've spent 2 days trying to get one of these to program a PIC18. Still not working, but I think it's because of the erratic clock signal. Apparently the issue goes away if you use an external oscillator. I just happened to have a 12MHz oscillator, so I superglued it on the chip and connected it with some magnet wire. But, when I try changing the settings with FT Prog, it keeps reverting back to the internal oscillator. It turns out that the chip is a clone. No surprise there though. I ordered a couple genuine chips from DigiKey, and also an FT232H. On the bright side, at least now I know the crazy clock isn't my code.

    • @SwapPartLLC
      @SwapPartLLC ปีที่แล้ว

      OK, so I can now confirm that the clock issue does not exist with authentic FTDI chips (FT232RNL) from Digikey. I paid $7.60 each for 2 modules, and then $15.87 (including shipping and tax) for the 2 authentic chips. That comes out to $15.53 each. For what it's worth, it's still cheaper than buying a module from FTDI.

  • @monaemhossaintipu9257
    @monaemhossaintipu9257 5 ปีที่แล้ว

    Can i use FT232 to connet USB keyboard with my ArduinoMega.Board:
    FT232RL FT232 FTDI USB To TTL 3.3V 5.5V Serial Adapter Module Board

    • @swharden
      @swharden  5 ปีที่แล้ว

      unfortunately no, the FTDI chip just provides a serial port to devices which can accept USB devices. Your ArduinoMega could act like a USB keyboard to a computer, but you cannot plug a USB keyboard into an Arduino. It looks like Arduino can read the output of older PS/2 style keyboards!

  • @WalterGreenIII
    @WalterGreenIII 3 ปีที่แล้ว

    Using a FDTI FT-232 to send data data and clock seemed very easy, looks like if I send data to a single by writing to it means I could possibly send NEC protocols using just the FTDI device. Logical '0' - in the NEC Protocol would be a 562.5µs pulse burst followed by a 562.5µs space, with a total transmit time of 1.125ms modulated at 38.222khz. Logical '1' - in the NEC Protocol would be a 562.5µs pulse burst followed by a 1.6875ms space, with a total transmit time of 2.25ms again modulated at 38.222khz. This would connect to a IR photo-transistor and IR LED, then again I could instead use a VS1838B Infrared receiver and the signal received by this device already demodulated. Otherwise a better choice for me is to send and receive the NEC signal as pure TTL level data. You see my stereo has jacks in the back for sending and receiving the NEC Protocols through either an external sensor, or by daisy chaining the components and have one of them act as a receiver for the other stereo components. In fact, my dual deck cassette has no IR receiver built in and relies solely on the receivers IR receiver.

    • @WalterGreenIII
      @WalterGreenIII 3 ปีที่แล้ว

      P.S. I forgot to mention... The NEC protocol sends a leader, then sends 32bits of data. Control Byte followed by it's inverse, Data Byte followed by it's inverse. When I say inverse I should say 1's compliment. And I believe it sends the data lsb first for each byte, Anyway, sounds simple, I also need to decode that protocol too, should be just as easy...

  • @theartofflying3108
    @theartofflying3108 3 ปีที่แล้ว

    How to use it to make programing for servomechanism ??

  • @avonfonds2567
    @avonfonds2567 3 ปีที่แล้ว

    Hello is there any chance I can do this with java with jssc lib thanks?

    • @swharden
      @swharden  3 ปีที่แล้ว

      It seems likely, but I'm not familiar with the modern Java libraries that interact with FTDI devices. The FTDI website may have documentation on this topic

  • @taranagnew436
    @taranagnew436 4 ปีที่แล้ว

    what are the differences between visual studio and visual studio code and witch one is better for coding also what does $" do?

    • @swharden
      @swharden  4 ปีที่แล้ว

      visual studio code is a fancy text editor that can be used to write in any programming language (C, HTML, Python, etc). Visual studio is more commonly used to write applications using Microsoft languages (C#, F#, visual basic, etc).

    • @taranagnew436
      @taranagnew436 4 ปีที่แล้ว

      @@swharden ok thanks

  • @friendlybear5924
    @friendlybear5924 4 ปีที่แล้ว

    17:18 That must be painful to watch xD.

  • @-indeed8285
    @-indeed8285 ปีที่แล้ว

    20:10
    FT232H -> has better time chip
    FT232R -> does not have that.

  • @pow9606
    @pow9606 3 ปีที่แล้ว

    Nice tutorial. Don't understand what your trying to say at 19:14. "Looks really bad" means nothing to me. Don't understand it.

    • @swharden
      @swharden  3 ปีที่แล้ว

      Hi POW, the issue is that due to a FTDI clock bug, it cannot output square pulses. The problem is further described and demonstrated here: swharden.com/blog/2018-06-03-bit-bang-ftdi-usb-to-serial-converters-to-drive-spi-devices/#beware-of-the-ft232r-bit-bang-bug

  • @mr.horror3858
    @mr.horror3858 5 ปีที่แล้ว

    you remind me of a teenage fred gwynn

  • @troymcdonald
    @troymcdonald ปีที่แล้ว

    While I appreciate this, most people are going to do a GUI since that’s what most people are use to…

  • @choudharyom1
    @choudharyom1 2 ปีที่แล้ว

    fuck i am from future......

  • @gkdotclass
    @gkdotclass 6 ปีที่แล้ว

    If you're going to use Saleae clones in public at least have the decency to not rip-off their livelihood by using cracked versions of their logic analyser software. You can use the open source Sigrok or, you know, just buy their hardware in the first place...
    Btw is that a FTDI fake chip too?

    • @swharden
      @swharden  6 ปีที่แล้ว +1

      JM thanks for your concern!
      The topic of cheap eBay analyzers vs official hardware was discussed in the video and on the website post (which promotes purchasing official Saleae hardware and includes links to their product page).
      I was unaware of the open source software Sigrok, thanks for suggesting it!
      The integrity of the FTDI chip is unknown, and was a sourcing choice of whoever produced the breakout board.

    • @swharden
      @swharden  6 ปีที่แล้ว +4

      I got an email from someone saying that the timing problem described at 19:00 is only a bug in genuine FTDI chps. It seems the chips I use in this video are indeed genuine, otherwise the big-banging would be working better!