Author Topic: Alternatives to FTDI USB to UART converter  (Read 136372 times)

0 Members and 1 Guest are viewing this topic.

Offline ChipguyTopic starter

  • Supporter
  • ****
  • Posts: 320
  • Country: de
Re: Alternatives to FTDI USB to UART converter
« Reply #50 on: November 04, 2014, 07:38:03 pm »
Hi !

Today's alternative to FTDI was the Microchip PIC18F14K50 which comes on a nice little board from Olimex.
https://www.olimex.com/Products/Modules/Interface/MOD-USB-RS232/open-source-hardware

The driver is just the .inf and .cat file and it works just fine  :-+
The software can be downloaded from the Olimex Website two.
It compiles in MPLAB 8.46 and the free C18 lite compiler which can also be downloaded from Microchip  :-+
I used a PICKit2 to program it, but I had to solder some wires and a connector on the board since they use some weird ass bulgarian 1.25mm connector. They seem not to even offer an adapter cable  :--

Since I also need RS485 I modified the C sourcecode in order to get a data direction control signal on RC6.
And it works now  :-+ :-+

Still have to check the signals with a logic analyzer but first tests worked fine.

Getting the link from Olimex I just realized that they offer that module also with RS485 from the looks.
So I would not needed to have figured that out on my own. Maybe that's an |O
Anyway, learning to understand the code is still way better than getting everything done and then being screwed when something's not working ok.

Cheers,
Chipguy

PS: Sorry forgot to take some pictures.



Where is that smoke coming from?
 

Offline benSTmax

  • Regular Contributor
  • *
  • Posts: 87
Re: Alternatives to FTDI USB to UART converter
« Reply #51 on: November 05, 2014, 08:16:34 am »
Hi Chipguy,

This is a really nice alternative. How much flash was still left unoccupied?
The available flash can be used to pack maybe the rest of the system functionality ...
 

Offline ChipguyTopic starter

  • Supporter
  • ****
  • Posts: 320
  • Country: de
Re: Alternatives to FTDI USB to UART converter
« Reply #52 on: November 05, 2014, 08:53:53 am »
This is a really nice alternative. How much flash was still left unoccupied?
The available flash can be used to pack maybe the rest of the system functionality ...
Hi benSTmax,

For some reason the code starts at 0x1000, IRQ stuff occupies around 0x0000 to 0x0020 (32 byte)
The code ends at 0x2BEA so you look at 7146(dec) byte of code(0x1000 to 0x2BEA), ending at address 0x2BEA or 11242(dec)
The memory range ends ad 0x3FFF or 16383 (dec) (16Kbyte flash), so there is still plenty of space left.
That's what I can see from the windows "Program Memory"

Cheers,
Chipguy
« Last Edit: November 05, 2014, 12:22:55 pm by Chipguy »
Where is that smoke coming from?
 

Offline benSTmax

  • Regular Contributor
  • *
  • Posts: 87
Re: Alternatives to FTDI USB to UART converter
« Reply #53 on: November 05, 2014, 10:22:17 am »
Quote
The code ends at 0x2BEA so you look at 7146(dec) words of code(0x1000 to 0x2BEA), ending at address 0x2BEA or 11242(dec)
The memory range ends ad 0x3FFF or 16383 (dec) , so there is still plenty of space left.

I will explore the possibility of using microcontrollers with built-in USB rather than adding another chip only for the USB connectivity. As long as there is a source code available (for the USB part) it makes much more sense to use a single chip (micro) rather than 2 (micro & USB converter chip)
 

Offline ChipguyTopic starter

  • Supporter
  • ****
  • Posts: 320
  • Country: de
Re: Alternatives to FTDI USB to UART converter
« Reply #54 on: November 05, 2014, 12:24:38 pm »
Quote
I will explore the possibility of using microcontrollers with built-in USB rather than adding another chip only for the USB connectivity. As long as there is a source code available (for the USB part) it makes much more sense to use a single chip (micro) rather than 2 (micro & USB converter chip)
Totally agree.
The software is free and can be downloaded from the Olimex site.
However it contains the Microchip USB stack.
There is an alternative USB stack though out there.
Where is that smoke coming from?
 

Offline ChipguyTopic starter

  • Supporter
  • ****
  • Posts: 320
  • Country: de
Re: Alternatives to FTDI USB to UART converter
« Reply #55 on: November 06, 2014, 08:11:35 pm »
Hi !

Still playing with the PIC18F14K50 on the Olimex "MOD-USB-RS232" board:
https://www.olimex.com/Products/Modules/Interface/MOD-USB-RS232/open-source-hardware

I already got RS485 direction control to work a few days ago and I tackled the battery charger detection today.
If I am not mistaken the PIC has a silicon issue: Ports RA0 and RA1 do not even work, even with all USB functionality disabled and the Chip not in Debug mode, so no PGD and PGC function on these pins. They just read 0, even when they are clearly at 3.3V
So I abandoned using these as inputs and did it a bit different.

Just 2 pieces 82K Ohm resistors connected to other port pins and a bit of modification of the USB stack make the battery charger detections works smoothly. I will explain everything in a documentation I am planning to release along with the source code of the modified project.

I will also release the hex files for those who just want to program the firmware into the PIC.
So I plan to do:

The PIC18F14K50 with reference schematics, capable of RS485 and optional (2nd hex file) battery charger detection.
Dunno if I should bother also to implement RTC/CTS functionality. I don't need it.

There is more to come. Stay tuned.

This is a picture from the thing as it was a day ago, it has already changed, added the resistors for charger detection.







Cheers,
Chipguy
[/quote]
Where is that smoke coming from?
 

Offline benSTmax

  • Regular Contributor
  • *
  • Posts: 87
Re: Alternatives to FTDI USB to UART converter
« Reply #56 on: November 07, 2014, 08:26:33 am »
Hi Chipguy,

Congratulations for achieving all these in such a short time!
It is great you also managed to integrate the battery charger detection. I didn't know it was possible to achieve this using a couple of pins and resistors.  :D
Sometime ago I used a Freescale JM-series as a USB-UART converter but no battery detection.
 

Offline ChipguyTopic starter

  • Supporter
  • ****
  • Posts: 320
  • Country: de
Re: Alternatives to FTDI USB to UART converter
« Reply #57 on: November 07, 2014, 06:49:16 pm »
Hi !

Update on the PIC18F14K50:
Today I refined the battery charger detection, I can now determine with kind of power supply is connected to the PIC.

So in this article I am going into a bit more detail about the power supplies

The first kind is a Phihong PSB05R-050Q, it has both D+ and D- pins pulled to 3.3V by a voltage divider.
You know: Don't turn it on, take it apart. In this case (sonic welding) I needed a handsaw.



The second one is the ITE AC024-53100:
This one has 2 USB ports, one "Smart out" with that little SOT-23 chip and another one with D+ and - shorted,
you can see that above the little SOT-23 chip.



The third kind which I don't have a photo of is just nothing connected to the USB D+ and D- at all.


Here is the reverse engineered output circuit of the Phihong compared to a simple shorted one:
In The Phihong its like a 3K Ohms pull up to 3.3V. That's what the impedance of the voltage dividers is.



There is more to come... stay tuned!

Cheers,
Chipguy


Where is that smoke coming from?
 

Offline ChipguyTopic starter

  • Supporter
  • ****
  • Posts: 320
  • Country: de
Re: Alternatives to FTDI USB to UART converter
« Reply #58 on: November 07, 2014, 09:53:16 pm »
Hi !

Below is the schematic for the modified Olimex module plus the Eagle files:
Where is that smoke coming from?
 

Offline ivan747

  • Super Contributor
  • ***
  • Posts: 2045
  • Country: us
Re: Alternatives to FTDI USB to UART converter
« Reply #59 on: November 07, 2014, 11:45:34 pm »
Wow! this MCP2221 is incredible. I just wish it did SPI  :(

MCP2210 does SPI exclusively (plus some IO), and it's HID, like the I2C mode in the 2221. It's still free of proprietary drivers, it's all regular HID. Microchip has no say in it. As someone implied in another thread, these are just factory programmed 20 pin USB PICs, by the looks of the pinouts.
« Last Edit: November 08, 2014, 12:15:05 am by ivan747 »
 

Offline ivan747

  • Super Contributor
  • ***
  • Posts: 2045
  • Country: us
Re: Alternatives to FTDI USB to UART converter
« Reply #60 on: November 08, 2014, 12:21:26 am »
Does anybody have experience with Microchip drivers? Their chips seem pretty attractive and are a lot cheaper than an ATmega.

In my experience, the chip (MCP2210) just enumerates as HID  the driver provider is reported as Microsoft, last time I checked. (if it were a USB-UART like the MCP2200 it would enumerate as a CDC, but whether it really requires the Microchip drivers, I'm not sure, at the moment I'm reading the datasheet).
« Last Edit: November 08, 2014, 12:28:10 am by ivan747 »
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4196
  • Country: us
Re: Alternatives to FTDI USB to UART converter
« Reply #61 on: November 08, 2014, 02:03:16 am »
Quote
Arduino drivers are pounded to death all over the world every day
For some "small" definition of "pounded", considering that the Arduino doesn't use anything more than TX/RX, is far enough off of some speeds that it only works because the devices it's communicating with is off the same amount in the same direction.  Other vendors were very slow to support OSes other than windows (although at the moment, the state of support seems pretty good.)  FTDI *was* trustworthy.  Almost everything else will need careful analysis and testing (I guess, for any real product, any chip needs careful analysis and testing.  "It works fine in lots of arduinos" is not "careful analysis and testing.")

And there's that nagging thought "why do so many of the proprietary USB/Serial chips NOT use the default CDC protocol/drivers?" (Jan says "CDC/ACM doesn't allow you to read CTS, and is probably slower than custom drivers.")

 

Offline ChipguyTopic starter

  • Supporter
  • ****
  • Posts: 320
  • Country: de
Re: Alternatives to FTDI USB to UART converter
« Reply #62 on: November 08, 2014, 07:07:44 am »

Does anybody have experience with Microchip drivers? Their chips seem pretty attractive and are a lot cheaper than an ATmega.

Sorry just saw your question about the drivers.
Yes, I have some experience with the drivers, there are no specific drivers from Microchip.
It uses the CDC (Communication Device Class) driver "usbser.sys" which already comes with Windows.
I have this driver already on my Windows 7 machine.

All that is needed from Microchip, and already delivered is the *.inf file and to round that up with driver certification they also deliver the catalog file *.cat (meow) with it.

I found one issue in the driver already, or since it is a M$ driver I should say "feature".
When you are connected to the COM port via a terminal program and you unplug the USB-UART converter and plug it in again the terminal program would not find the COM port again. Even a restart of the terminal program does not work until you disconnect to the COM port or close the terminal program first and then unplug the USB device.

Cheers,
Chipguy
Where is that smoke coming from?
 

Online Fungus

  • Super Contributor
  • ***
  • Posts: 16561
  • Country: 00
Re: Alternatives to FTDI USB to UART converter
« Reply #63 on: November 08, 2014, 01:11:29 pm »
Arduino doesn't use anything more than TX/RX, is far enough off of some speeds that it only works because the devices it's communicating with is off the same amount in the same direction.

That's because of the crystals they use. The common RS232 baud rates were chosen by telecoms engineers and the Arduino crystals are usually some integer number of MHz. There's bound to be a noticeable mismatch at higher rates.

The solution is to clock the ATmega at a multiple of 115200 that still works with USB (maybe 11.52MHz?)

 

Offline TheBay

  • Supporter
  • ****
  • Posts: 1016
  • Country: wales
Re: Alternatives to FTDI USB to UART converter
« Reply #64 on: November 09, 2014, 09:29:58 pm »
I like CP2102's personally!
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4196
  • Country: us
Re: Alternatives to FTDI USB to UART converter
« Reply #65 on: November 10, 2014, 12:24:34 am »
Quote
The solution is to clock the ATmega at a multiple of 115200 that still works with USB (maybe 11.52MHz?)
Read the datasheet.   The PLL that generates the USB clock must have an 8MHz input, and there's a prescaler, so your choice is 8MHz or 16MHz crystals.  Period.

A perfect illustration.  If you're going to throw away FTDI because of some political reason that wouldn't have affected you anyway, you HAVE created yourself a bunch of additional work.
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26755
  • Country: nl
    • NCT Developments
Re: Alternatives to FTDI USB to UART converter
« Reply #66 on: November 10, 2014, 01:59:50 am »
I wouldn't put it that way. It makes sense to use a microcontroller with USB instead of two seperate chips. A crystal is cheaper than an FT232.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline M@rcel

  • Newbie
  • Posts: 8
Re: Alternatives to FTDI USB to UART converter
« Reply #67 on: November 10, 2014, 11:45:49 pm »
...

I used a PICKit2 to program it, but I had to solder some wires and a connector on the board since they use some weird ass bulgarian 1.25mm connector. They seem not to even offer an adapter cable  :--

...

I use this for conversion to connect to ICD3:
https://www.olimex.com/Products/PIC/Programmers/PIC-ICSP/
 

Offline ChipguyTopic starter

  • Supporter
  • ****
  • Posts: 320
  • Country: de
Re: Alternatives to FTDI USB to UART converter
« Reply #68 on: November 11, 2014, 05:53:44 am »
I use this for conversion to connect to ICD3:
https://www.olimex.com/Products/PIC/Programmers/PIC-ICSP/
Ahh thanks for sharing this link. I was wondering that they should have an adapter of some sort.
I got my Olimex kit from Farnell, ang guess what: They also sell the adapter ;)
Where is that smoke coming from?
 

Offline ChipguyTopic starter

  • Supporter
  • ****
  • Posts: 320
  • Country: de
Re: Alternatives to FTDI USB to UART converter
« Reply #69 on: November 14, 2014, 06:19:15 pm »
Hi !

Update : Got some USB-RS485 (alternatively RS232 with 5V TTL level) adapter ready for prototyping.
This one is a bit smaller than the USB-RS485-WE PCB in the cable from FTDI, however it lags the 2 LEDs.

Sorry the design had to be made in Altium Designer, while the other project, the USB-PIC18 tinkerboard is made in Eagle and all through hole.

Here are some first impressions:
Where is that smoke coming from?
 

Offline ivan747

  • Super Contributor
  • ***
  • Posts: 2045
  • Country: us
Re: Alternatives to FTDI USB to UART converter
« Reply #70 on: November 14, 2014, 07:30:18 pm »
How reliable is that USB shield soldering going to be? I think it's an interesting concept. That looks very very compact, it could be molded inside a typical USB-A cable.
 

Offline ChipguyTopic starter

  • Supporter
  • ****
  • Posts: 320
  • Country: de
Re: Alternatives to FTDI USB to UART converter
« Reply #71 on: November 14, 2014, 08:10:56 pm »
It is meant to be molded that's why it is so compact.
The tool for the molding already exists, so I have to stick with that very USB-A connector and a pre determined variety of cable diameters.
The PCB will be produced on standard pick and place machines while the connector and cable are most likely going to be handsoldered.

Where is that smoke coming from?
 

Offline benSTmax

  • Regular Contributor
  • *
  • Posts: 87
Re: Alternatives to FTDI USB to UART converter
« Reply #72 on: November 14, 2014, 08:33:29 pm »
Excellent work, Chipguy.
These kind of adapters are always in great demand ...
 

Offline m12lrpv

  • Regular Contributor
  • *
  • Posts: 175
  • Country: au
Re: Alternatives to FTDI USB to UART converter
« Reply #73 on: November 14, 2014, 09:31:50 pm »
Thanks Chipguy. As someone who really just uses atmel chips and icsp I never really cared about serial and usb.

Recently that changed and I've moved into usb and serial programming and your efforts here have really helped me to understand what options are out there and how it all works.


 

Offline ChipguyTopic starter

  • Supporter
  • ****
  • Posts: 320
  • Country: de
Re: Alternatives to FTDI USB to UART converter
« Reply #74 on: November 26, 2014, 06:33:28 pm »
Hi !

Update: Today the boards arrived and I managed to put the parts on it. See the picture below.
I already programmed it and the USB side does work fine  ;D
It's nice that the PIC uses D+ and D- also as programming interface. I only need one extra pad for /MCLR to program the MCU.

And thanks to Mike vom Mike's electric stuff I sucessfully tried his methode of soldering QFNs  :-+
However I must say it only works with a beefy Metcal solder iron.

Once it is all tested I am going to release both, the RS485 and a RS232 version as OSHW.
I also have the schematics for a fully through hole design which is more like an evauation board.
And of course the software will be released as well, open source.

Cheers,
Chipguy

Where is that smoke coming from?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf