PDA

View Full Version : Solved Prop-SD-server and Windws/Linux cmd-tools. HELP-Reset with usb?



msrobots
03-16-2012, 06:41 AM
I wrote some simple c-code to create cmd-line tools for windows and linux to connect to the Prop-SD-server (http://forums.parallax.com/showthread.php?138673-Prop-SD-server-and-Prop-SD-client).

Everything works fine with prop-plug and reset disconnected but with onbord usb the propeller RESETS when i open the com-port on the pc.

since C is not my preferred language i took @RossH's PayLoad and RS232 code and started from there.

translating SD-client SPIN code to C. Everything works with prop-plug (w/o reset connected) but SD-server resets with onbord usb.

I am sure it is RTS (CTS?) but how to prevent this ? I attach the C source. It is short.

90651 90652 90653 90655

all 3 files use the same RS232c .h lib as PayLoad.

All work together with Prop-SD-server.

they should compile ala

gcc -o copytosd copytosd.c rs232.h

i cross-compile on windows for arm and they work there as well - thanks to @RossH

but what to do against the reset ? do i need to put a jumper there and cut my beautiful GG-Board ?

any help welcome

here are 3 windows-executables ready to use ...

90803


Mike

Ltech
03-16-2012, 08:58 AM
Is it not just removing the "enable programming" jumper on Spinneret when finish config ?
I never tried but .....

Cluso99
03-16-2012, 10:20 AM
I am no sure what you are referring to about onboard usb. I presume you are meaning the FTDI circuitry is on the board?

DTR is normally used to reset the prop, and it is DTR going inactive that actually performs the reset (with the transistor circuit).

Now I am going to have a guess at what you mean...
I presume the reset is occuring between downloading each file? If so, what is happening is that the DTR signal is being cycled at the pc end. You need to avoid this or you will get the reset unless you modify the board. I have not looked at your code as I am not a c programmer either.

However, if you can control the pc end software, just ensure the DTR signal remains inactive and you should be fine. This is the way the transistor reset circuit works. If DTR goes active, then as soon as it returns inactive you will get a reset.

Hope this helps.

msrobots
03-16-2012, 09:32 PM
Yes @Ltech, the spinnerette has a jumper to prevent that. But not all Propeller-Boards have. So I try to fix that on PC side.

The Prop-SD-server is not a web-server on the spinnerette, it is something like Novell Netware 1.0 for Propellers.

and this commandline tools shold make it easy to copy files between PC and Prop-SD-Card without removing the sd out of the prop.

Yes @Closo99. I was referring to the FDTI chip and yes you guessed exactly right. DTR it is OK.


in the C source rs232.c on opening the port is a comment stating:

// first set everything except baud rate (doing this drops DTR) ?
a little later then
// then set baud rate (doing this avoids raising DTR) ?
and on the end
ClrDTR(comport_number);

what i still am missing is what state DTR shoud have to avoid reset ? HI ? LOW ?

a reset in payload seems to toggle DTR (I do NOT use that part) like
SetDTR(port);
mdelay(RESET_TIME);
ClrDTR(port);
mdelay(RESET_TIME);

i seem to have some mental block there - i feel like not seeing the forrest because of all of those trees around me ...

Mike

Cluso99
03-16-2012, 10:37 PM
DTR should remain inactive. Now, DTR at the ttl (prop pin) is /DTR meaning that a low is active. On RS232 DTR=+V is active.

The transistor circuit triggers the reset pulse when DTR goes from the active to inactive state. This is how the PropTool can transition to another Terminal program without triggering a reset. Otherwise, windoze would make DTR inactive between programs and this would have triggered a prop reset. Now, any program can run, but the moment it sets DTR active, then when it releases the com port next the transition from active to inactive will trigger a reset.

Hope this helps.

msrobots
03-16-2012, 11:47 PM
thank you @cluso99 - Aaah - the fog is clearing - now I am back to printf-debug to track this down.

i am using c because my primary target for it is a arm7-device for my propeller.
So debugging is kind of unusal painful runnig gui on the prop and crosscompiling c on windows for use on arm-linux... could have had a v8 ...

Mike

msrobots
03-19-2012, 06:45 AM
So I could partly solve the problem.

the cmdline-tools work now in Windows without ressetting the prop-SD-server. In Linux I still need to disconnect RESET.

I put the files in the first post and add a link to the main prop-SD-thread (http://forums.parallax.com/showthread.php?138673-Prop-SD-server-and-Prop-SD-client).

Mike