P1 FullDuplexSerial.spin
pic18f2550
Posts: 400
Hello,
how can I tell that there is no PC connected to the propeller?
because the PC is not connected there is a buffer overflow and the application hangs.
Modified FullDuplexSerial.spin attached.
Renamed from FullDuplexSerial.spin to pic_FullDuplexSerial.spin.
Comments
Seems like a simple handshake sequence would help out. Ping the PC with the Propeller and look for a specific response within a given time window. There is an rxtime() method that will return -1 if there is no response.
I have examined this hanging a little closer.
The cause is in the initialization, here it hangs.
It does not even come to the output routine.
Therefore a check with timeout is not possible.
I think you can check if RX is high because when connected it goes low (or the other way around?)
I used this because older Parallax boards where resetting when sending out w/o USB connected
Mike
In short, when the FTDI chip is not connected to the cable it pulls juice from pin 30 (tx, idle) which in turn triggers a reset for the prop.
Better would have been to supply the operating voltage of the FTDI chip with 2 diodes from the internal 5v and the USB voltage.
So I have to live with that on the starter kit, unfortunately there are no resistors on RX and TX to fix the problem.
richtig.
on never boards they corrected it, but pe-starterkit and other older boards have the issue not fixed.
The solution was to check if USB is there or not and then NOT send any data, it is TX from the prop feeding the FTDI and then it does a reset.
As long as you not send anything, things are fine. And you need to check RX (Pin 31) to find out IF something is connected to the FTDI Usb. Because if then it is on the Idle state else floating
That is how to check for.
Mike
Why doesn't anyone adjust the code on the GIT so that this doesn't happen?
I have attached the modified "FullDuplexSerial.spin" in #1.
May it find its way to Git.
It seems like the calling app should stop of throw an error if FDS cannot be started. Why burden every method in FDS with a condition that almost never happens.
I don't know how many demo boards of this type of Parallax are in circulation but they all have the same problem. You can not solder resistors afterwards.
To be more precise, it also affects all prop sticks with FDI chip when the resistors are missing in the circuit.
I noticed the problem earlier at the HIVE project, so several custom builds could have the same problem.
I have changed so far that the feedback is 0 just as if the application can not start because no COG is free.
But you could also return -1 and specify the error.
Why should errors be ignored? It is not a C.
Well, the change is not so extensive that there would not be a bit of space, or even eat gigantic resources.
Not everyone is so deep in the matter that he can solve it easily, you should pay attention to the beginners, after all, it's about business, every resigned customer is a lost customer.
I do not want to force anyone to take over something, but if someone wants ... here you go.
For me, the problem is solved and secured in the library for further projects.
I have also tested the changes on other pins.
unfortunately it is not always successful.
The change only applies when a FDI is connected.
I decided to change the start routine a little bit.
I simply pass a 5th parrameter.
This is the most memory saving.
I suggest you identify your version as I do with mine -- all of my programs are prepended with "Jm_" The reason for this suggestion is that adding another parameter to the start() method means this version is not compatible with 100s of programs already written that use the old fullduplexserial.spin or even my jm_fullduplexserial.spin.
Ok, I will do it tomorrow and change it to #1.