Why can't you use a cheap USB dongle to program the Propeller? - You can, but...
Cluso99
Posts: 18,069
This gets raised often, so here goes again...
(this is my take on what happened)
Chip realised that switching programs under windoze caused the comms status pins (DTR & RTS) to be reset when the COM port was released by a program. The next program would presumably then make these signals active. Under normal circumstances, using the DTR or RTS pin (at TTL level) would cause the prop to reset. When downloading a program to the prop it is normally held in SRAM and we do not bother to program the eeprom (it has a large but limited number of program cycles). If the prop is then reset, the code in SRAM is lost.
In other chips such as the favourite Arduino, etc, these chips are always downloaded to their Flash memory (also have a limited number of program cycles). So a reset after downloading is in order.
The Prop Solution...
By inverting the DTR signal by an npn transistor and using an RC network, the prop only resets on a transition of DTR (some download programs permit RTS to be selected) from active to inactive. No reset occurs on transition from inactive to active.
So, the download program in windoze sets DTR active (does nothing), then DTR inactive (forces reset on the prop), and then the download commences. Once the download is complete (say for example in PropTool) the user can exit this program and load PST (Parallax Serial Terminal). When PropTool exits (releases the COM PORT to be precise), DTR is already inactive, so nothing happens to the prop reset. PST now takes the COM PORT and DTR still remains inactive.
This is why the PropPlug has the transistor reset circuit.
So, if you add the transistor reset circuit to a cheap USB dongle you can save the cost of an expensive PropPlug. While I have not tried it, I have been told that a series capacitor from DTR to the Props Reset will also work. In this case though, I would think that the reset will occur slightly earlier because it will occur from the DTR inactive to active transition, rather than the following active to inactive transition.
If you use a cheap USB dongle, ensure that the USB chip is operating at 3V3 and not 5V, else you will require the series protection resistors in P30 & P31 (well actually only P32 since it is the input to the prop).
(this is my take on what happened)
Chip realised that switching programs under windoze caused the comms status pins (DTR & RTS) to be reset when the COM port was released by a program. The next program would presumably then make these signals active. Under normal circumstances, using the DTR or RTS pin (at TTL level) would cause the prop to reset. When downloading a program to the prop it is normally held in SRAM and we do not bother to program the eeprom (it has a large but limited number of program cycles). If the prop is then reset, the code in SRAM is lost.
In other chips such as the favourite Arduino, etc, these chips are always downloaded to their Flash memory (also have a limited number of program cycles). So a reset after downloading is in order.
The Prop Solution...
By inverting the DTR signal by an npn transistor and using an RC network, the prop only resets on a transition of DTR (some download programs permit RTS to be selected) from active to inactive. No reset occurs on transition from inactive to active.
So, the download program in windoze sets DTR active (does nothing), then DTR inactive (forces reset on the prop), and then the download commences. Once the download is complete (say for example in PropTool) the user can exit this program and load PST (Parallax Serial Terminal). When PropTool exits (releases the COM PORT to be precise), DTR is already inactive, so nothing happens to the prop reset. PST now takes the COM PORT and DTR still remains inactive.
This is why the PropPlug has the transistor reset circuit.
So, if you add the transistor reset circuit to a cheap USB dongle you can save the cost of an expensive PropPlug. While I have not tried it, I have been told that a series capacitor from DTR to the Props Reset will also work. In this case though, I would think that the reset will occur slightly earlier because it will occur from the DTR inactive to active transition, rather than the following active to inactive transition.
If you use a cheap USB dongle, ensure that the USB chip is operating at 3V3 and not 5V, else you will require the series protection resistors in P30 & P31 (well actually only P32 since it is the input to the prop).
Comments
I think Jazzed's new IDE might be getting close to the mark.
In the technical marketplace, the RS-232 specification is 4 or more lines. But some USB to RS232 provides just provided Tx and Rx. That was the original headache. But Cluso addresses issues of how the RS232 is handled.
Frankly, I started with building my own transistor interface from RS232 to Propeller - so these issues in Windows and other alternatives have never occurred to me.
You don't have to use a Parallax product. In fact, I bought a cheap USB to RS232 dongle locally and lucked out on it being compatible both in hardware and driver software. I also bought a Pololu line follower robot and the USB programmer for it has an optional choice that provides all 4 RS232 lines. It could be adapted.
I have a Propeller specific USB device as well.
But the reason people simply suggest buying the Parallax adapters is that you will NOT find yourself in the position of having guessed and been disappointed.
And BTW, the Propeller only requires 3 of the 4 lines; but that is rather trivial as you just don't see a lot of 3 line devices outside of a Parallax device for dedicated Propeller use.
The situation may be getting 'off into the weeds' by having other people producing IDEs and boards without some sort of peer review to assure they have a reliable scheme. But depending on Windows is always rather dicey. I was badly beat up by investing in a Vista computer; while W7 seems good. One never knows when M$ is going to do something foolish and pretend that nothing is wrong.
This modification adds a transistor, a MOSFET in this case, to act similar to the PropPlug.
See:
SPIN Problems Using Non-Parallax USB to TTL RS-232 Adapter.
Duane J
The transistor on the DTR line of the Prop Plug converts the push-pull output of the FT232R DTR pin to an open-collector output, which can be connected directly to the reset line. The circuit could be on the USB to serial converter, or it could be on the PCB with the Propeller microcontroller. Since their are more boards with Propeller microcontrollers than there are programming tools, it was most cost effective to put the circuit on the programming tool.
— David Carrier
Parallax Inc.
In answer to Cluso99's question
"Why can't you use a cheap USB dongle to program the Propeller? - You can, but..." you can't use the official propeller programming software. You have to use a third party program.
I guess if one were to invoke giant fake moon landing conspiracy theories, one could hypothetically suggest that Parallax would make more money selling the proptool than telling people to buy a $2 device that does the same thing. So there is little incentive to fix the Proptool. Or more specifically, to undo the "fix" about 3 years ago that stopped the Proptool using these devices.
And to that, one could counter that one of the first barriers to using a new microcontoller for a potential customer is the cost of an initial setup, and right now, the proptool costs more than the propeller chip, and if you could say that you can get into propeller programming for $15 instead of $30, that ought to be a selling point.
On the other hand....
The Proptool could do with some improvements anyway - intellisense, autocompletion, drop down menus for object methods, auto starting of the terminal after download, ability to use cheap $2 USB serial devices, so I'm delighted that Jazzed is doing all this because it solves many problems in one go.
However, a simple series capacitor should (and does in some circuits) work, but would still suffer from this windoze problem.
Drac has illustrated the cost problem. Add to this, the FT232RL chip is smt (and fairly fine pins too) and very expensive, the propplug has to be expensive. There are much cheaper solutions around today.
Drac pointed out a further problem that I was not aware of, and that is that some of the cheap dongles do not work (plus the transistor circuit) still do not work with the latest PropTool downloader. This seems to me that some of the dongles may have varying timing delays for DTR (or RTS) and that this and the PropTool delays and the Propeller's own timing, results in the download sequence being missed. Seems that any new download software is going to require adjustable reset timing to fine tune the result. I expect windowze will throw a few spanners into the mix here too.
If the problem were only a tiny pcb with the transistor circuit and series resistors on P30/31 then I could do this really cheap. But postage and packing cost kills it ($2.40 airmail and $1.00 for the padded bag). How on earth can a supplier in China sell you any device for $1 including postage and pack??? Seems our postal systems are being abused.
The FT232 can be configured so that DTR is inverted (with the Tool FTPROG)
This is a problem of the Windows driver and the buffer size inside the USB to serial chip. The boot protocol needs a continuos bitstream, but USB transmit in packets all 1 ms. So the chip needs to buffer some hundred bytes and the drivers needs a fast reaction if the buffer is nearly empty.
The PropTool has some timeouts set very short, this results in aborting the loading procedure when the gaps in the bitstream gets too long. The nasty thing is that the download works often with short code, and you get the abort only with big code and long download times.
Andy
Ah - now that would explain a lot. So - would a solution be to give the user access to those timeout values so you could adjust them?
Andy has thrown some more light onto this. I do now recall that larger programs were found to fail more frequently.
PropTool has an adjustable post reset delay. By default, mine is set to 90ms.
I agree, it is all to do with the timing and likely the USB timing. But windoze adds it bit too, by delaying and also by turning off DTR & RTS when the Com Port is released. If you are switching from PropTool to another terminal program, then if DTR (or RTS) is activated by this program, the prop will be reset, rendering the download (if only to hub) lost.
Without inverting the DTR (or RTS) downloading of code may work, but what happens if you switch to such a Terminal program if the reset occurs on the wrong edge? You will get the reset when the Terminal opens the COM port, so you can't work with that terminal. Normally the reset occurs when the terminal is closed, what is still a bit annoying but works.
Andy
— David Carrier
Parallax Inc.
Or course, if you turn on a computer, the DTR will go from 0V to -12V and if you reset on the negative going edge that will cause a reset to the board.
Andy's point about resetting when opening or closing a program is valid. Who knows what program is going to do what though.
My experience is that for about a year I built boards that reset on the negative edge, then for about a year I built boards that reset on the positive edge and I didn't really notice any difference. I think the edge you use is a bit of a red herring.
Also, changing the timing delay in the proptool makes no difference and does not fix the problem for cheap USB cables.
I think Andy in post #9 has the answer - it is the way the data is buffered. The answer to this whole question would be to ask how it was solved in software that we know works, like PZST.
Jazzed's IDE works out of the box for *all* the USB to serial adapters I have, including a $15 FT232 one and several unknown chipset $2 ones.
No need to change any settings in the software. Tested with both small programs direct to ram and ones over 32k that involved a preloader and being written to the SD card.
So if Jazzed can get Spin working on the IDE then the problem is solved