Shop OBEX P1 Docs P2 Docs Learn Events
Serial com problem between Prop and "Little Step-U"- stepper driver — Parallax Forums

Serial com problem between Prop and "Little Step-U"- stepper driver

SiriSiri Posts: 220
edited 2012-11-27 22:10 in Propeller 1
I am using the stepper motor driver "Little Step-U".I have connected the Prop to the Stepper as depicted in the circuit diagram(attached).
I am able to make the motor go clockwise as well as counterclockwise.I am able to use all the commands except 2 commands "" & "[noparse][[/noparse]V]".
These two are the only commands that sends data back to the Prop via the "SER OUT PIN" of the stepper.

Trouble shooting: 1.Data from the propeller can be seen on the scope
2.When the commands "" & "[noparse][[/noparse]V]" are sent they can be seen at the "SER IN PIN" of the stepper driver
3.The response to these commands are NOT seen at the "SER OUT PIN" of the Stepper Driver - when that pin is connected
to the Propeller.
4.When the connection to the Propeller is disconnected from the "SER OUT PIN" of the Stepper driver - the data can be
seen on the scope.

Attached are 2 scope scans.

The "Little Step-U" when connected to BS2 set-up works well with no exceptions.

Need help to resolve this issue.

Thanks

Siri

Post Edited (Siri) : 8/6/2008 2:57:20 AM GMT


Comments

  • SiriSiri Posts: 220
    edited 2008-08-06 02:57
    Sorry , I am unable to clear the underlined text.
    This was not intentionally done.

    Siri
  • StefanL38StefanL38 Posts: 2,292
    edited 2008-08-06 09:40
    hello Siri,

    i'm not familiar with the BS2. Does the BS2 have Pullup/Pulldown-resistors on the IO-PINS?

    Which Propellersetup are you using?

    Could you please really attach the circuit WITH ALL DETAILS how you connected the little-step-U to the prop.
    And could you please attach your SPIN-code. Otherwise it is really hard to even guess what the reason might be

    best regards

    Stefan
  • SiriSiri Posts: 220
    edited 2008-08-06 14:19
    Stefan,

    Thank you helping me.
    I have attached both the circuit diagram and the code for you.
    I tried to upload the "Little Step-U" specs as a PDF file but the server rejected it.If you need it it is there in the Parallax site - as they sell this Stepper Driver at their shop.

    The only thing I can't do is to get Data back from the Stepper driver - all other commands do function well.
    I am unable to receive any serial data from the Stepper driver.

    I can see data(scope) going to the stepper driver via the SER IN PIN but I do not see any data coming out of the SER OUT
    PIN.
    Strange enough - when the connection to the Propeller is disconnected from the Stepper driver I am able to see data coming out of the SER OUT PIN of the Stepper Driver.
    So The propeller is unable to receive the data for some reason.

    Siri
  • SiriSiri Posts: 220
    edited 2008-08-06 14:35
    Stefan,

    Here is the code the :

    [noparse][[/noparse] {{ PropellerVent StepperMotor"Little Step-U"motor driver" - Testing - 8/5/08 - with "DEBUG"

    Little Step-U connected as follows: Serial in - P10 --> as Rx to Prop
    Serial out - P11 --> as Tx from prop
    Busy - P12
    IP1 - connected to Reed SW1
    IP2 - connected to Reed SW2
    }}
    CON

    _clkmode = xtal1 + pll16x
    _xinfreq = 5_000_000



    VAR
    '

    OBJ


    Stepper: "Extended_FDSerial"
    BS2 : "BS2_Functions"


    PUB Main


    Stepper.start(11,10,1,2400) 'rx pin,tx pin,mode,baud rate
    BS2.Start(31,30) 'For DEBUG purpose

    StepInit



    PUB StepInit | mystring

    'Repeat
    Stepper.str(string("{J}")) 'Go counter clockwise until IP1
    waitcnt(clkfreq +cnt)
    Stepper.str(string("{K}")) 'Go clockwise untill IP2
    waitcnt(clkfreq *2 +cnt)
    Stepper.str(string("{E-65}")) 'Go counter clockwise 65 steps
    Repeat
    Stepper.str(string("{V}")) 'Read IP1 and IP2 state
    waitcnt(clkfreq/10+cnt)
    'BS2.Serin_Wait(11,@myString,"[noparse][[/noparse]",2400,1,8) 'Data format received " [noparse][[/noparse]a,b]"
    BS2.Debug_Str(string("Spin-Up World!",13))
    BS2.Debug_Str(string(" ",13))
    BS2.Debug_Str(@mystring)
    Stepper.str(string("{E45}"))
    waitcnt(clkfreq+cnt)




    {P.S : The code works as above as long as this line " BS2.Serin_Wait(11,@myString,"[noparse][[/noparse]",2400,1,8)"
    is deleted.
    Code also works with other serial objects.
    I chose BS2 functios for two reasons:1.I am have some knowledge of BS2
    2.I cannot use 2 instances of one object or another serial
    object that is derived from or dependant on another object that
    that used the same object

    Note: The "mystring" appears empty on the debug screen - after "Spin-Up World"

    }

    The code was sent octet-stream earlier -

    Siri
  • SiriSiri Posts: 220
    edited 2008-08-06 15:11
    Stefan,

    I made the the PIN 11 - serial in to the propeller an input " dira[noparse][[/noparse]11]~ " and try reading tha state of the pin using
    ina[noparse][[/noparse]11] and I get "1" (on the DEBUG scrren)- which means it is high right - What I do not under stand is why this is so.

    When I make the pin out-put using dira[noparse][[/noparse]11]~~ - then when I read the state of the pin using "ina[noparse][[/noparse]11]" - I get "0"
    on the DEBUG screen.

    What is the problem???

    Siri

    Code is as :

    {{ PropellerVent StepperMotor"Little Step-U"motor driver" - Testing - 8/5/08 - with "DEBUG"

    Little Step-U connected as follows: Serial in - P10 --> as Rx to Prop
    Serial out - P11 --> as Tx from prop
    Busy - P12
    IP1 - connected to Reed SW1
    IP2 - connected to Reed SW2
    }}
    CON

    _clkmode = xtal1 + pll16x
    _xinfreq = 5_000_000



    VAR
    '

    OBJ


    Stepper: "Extended_FDSerial"
    BS2 : "BS2_Functions"


    PUB Main


    Stepper.start(11,10,1,2400) 'rx pin,tx pin,mode,baud rate
    BS2.Start(31,30) 'For DEBUG purpose

    StepInit



    PUB StepInit | mystring



    Stepper.str(string("{J}")) 'Go counter clockwise until IP1
    waitcnt(clkfreq +cnt)
    Stepper.str(string("{K}")) 'Go clockwise untill IP2
    waitcnt(clkfreq *2 +cnt)
    Stepper.str(string("{E-65}")) 'Go counter clockwise 65 steps
    Repeat
    dira[noparse][[/noparse]11]~ ' DEBUG_BIN(value, Digits)
    BS2.DEBUG_BIN(ina[noparse][[/noparse]11],1)
    Stepper.str(string("{V}")) 'Read IP1 and IP2 state
    waitcnt(clkfreq/10+cnt)
    'BS2.Serin_Wait(11,@myString,"[noparse][[/noparse]",2400,1,8) 'Data format received " [noparse][[/noparse]a,b]"
    BS2.Debug_Str(string("Spin-Up World!",13))
    BS2.Debug_Str(string(" ",13))
    BS2.Debug_Str(@mystring)
    Stepper.str(string("{E45}"))
    waitcnt(clkfreq+cnt)




    {P.S : The code works as above as long as this line " BS2.Serin_Wait(11,@myString,"[noparse][[/noparse]",2400,1,8)"
    is deleted.
    Code also works with other serial objects.
    I chose BS2 functios for two reasons:1.I am have some knowledge of BS2
    2.I cannot use 2 instances of one object or another serial
    object that is derived from or dependant on another object that
    that used the same object

    Note: The "mystring" appears empty on the debug screen - after "Spin-Up World"

    }
  • StefanL38StefanL38 Posts: 2,292
    edited 2008-08-06 15:47
    hello Siri,

    as a quick answer:#

    one problem is you start Extended_FDSerial with PIN 11 as Rx-Pin

    Stepper.start(11,10,1,2400) 'rx pin,tx pin,mode,baud rate starts a new cog with the serialdriver.

    You should not use the same pin with two different cogs except you do know EXACTLY what you do with the pin
    Your Diagram shows that Propeller-PIN 14 is connected to littlestep serial-in and Propeller-PIN 15 is connected to littlestep serial-out
    So please check to which Propeller-Pins is it REALLY connected

    You are sending Stepper.str(string("{V}")) via the Extended_FDSerial-object
    If the hardware is connected right
    you can read out the answer by calling stepper.RxStr(@myString)
    calling BS2.Serin_Wait(11,@myString,"[noparse][[/noparse]",2400,1,8) messes up the IO-state of the PIN. The outa-modes of all cogs are logical ORed if i remember it right.

    Check if the BS2 has Pull-Up/Pull-down-resistors
    Try a 10k Pull-Up OR Pull-down-resistor between Prop-serial-in and +3.3V/GND (not both at the same time

    best regards

    Stefan

    Post Edited (StefanL38) : 8/6/2008 3:52:44 PM GMT
  • SiriSiri Posts: 220
    edited 2008-08-06 21:13
    Stefan,
    I have to initialize Extended_FDSerial with these pins(11,10) else the serial driver will not know which pins to send the data.
    These pins are used only for communications between the Prop and the Stepper driver.
    The prop is connected to the stepper via PIS 11&10.You were right the circuit diagram was modified during installing.

    I tried using a pull-up/pull-down resistors but no change.

    When I tried using Stepper.RxStr(@mystring) and removed the BS2 call - as before no data was received via the serial in PIN(11) of the prop.
    I have checked the hardware connections over and over again - checks out OK.
    Still if I disconnect the serial-out pin connection to the Prop - the Stepper driver sends out good serial data, which seem to
    stop when connected to the prop.
    It looks like for some reason the PIN 11 of the prop becomes an out-put once connected to the Stepper driver.

    Thanks again

    Siri
  • SiriSiri Posts: 220
    edited 2008-08-06 22:47
    Stefan,
    The U-stepper does put out a good serial out-put when the "{u"} &"{V}" command is sent.
    Attached is a scope tracing.
    But when connected to the prop there is no signal.

    I hope this will help to resolve the issue.
  • StefanL38StefanL38 Posts: 2,292
    edited 2008-08-07 10:49
    hello Siri,

    your call Stepper.start(11,10,1,2400)
    sets modebit no 0: meaning rx will be inverted
    try mode-value 0 and 2
    Stepper.start(11,10,0,2400)

    Stepper.start(11,10,2,2400)

    here a part of the comments of fullduplexserial which is used by Extended_FDSerial

    '' mode bit 0 = invert rx
    '' mode bit 1 = invert tx
    '' mode bit 2 = open-drain/source tx
    '' mode bit 3 = ignore tx echo on rx

    hm- seems not so easy to analyse via a forum.
    Nethertheless:

    We have to analyze the details.

    Did you reload the actual code to the EEPROM ?
    making REALLY sure that the posted code is running.

    Explaining: the TLA (three-letter-acronym) "LSU" means little-step-U.

    When Prop-PIn11 is connected to serial-out of LSU measure the voltage-DROP over the 1k-resistor between LSU and prop with your scope when expecting the answer from the LSU
    This means: ground of scope connected to Prop-Pin11 and + of scope connected to LSU-serial-out

    if you see nothing, change the scaling factor of the scope down stepwise towards millivolts

    additional measurings:
    What is the voltage measured DIRECTLY at the prop-pin11 when connected to the serialout of LSU?
    measured at the serial-out of the LSU?
    What is the voltage measured at the serial-out of LSU when the prop is CONNECTED?
    What is the voltage measured at the serial-out of LSU when the prop is DISconnected?

    Load a small testprg to the EEPROM that simply makes PIN11 an input

    do the following measurements: connect a 2kOhm-resistor to +5V
    connect the other end to PIN11 and measure the current
    and voltages between Ground and a.) serial-out of LSU

    load a small testprg to the EEPROM that simply makes PIN11 an output
    and set PIN11 to HIGH measure the current and voltages

    load a small testprg to the EEPROM that simply makes PIN11 an output
    and set PIN11 to LOW measure the current and voltages

    disconnect the resistor from the prop
    load your Little-Step-U-Test-code to the EEPROM
    connect the resistor to PIN11 and measure the current and voltages again

    What values do you get ?

    Analysing the output-impedance of the LSU:
    Connect a 1k-resistor to LSU-serialout. connect the other end to the left end of a 100kOhm-potentiometer.
    connect the "middle"-pin of the potentiometer to ground.
    Turn potentiometer to the end that the resistancevalue is 100k.
    Repeat your test with sending the command "U" to the LSU and measuring the voltage with your scope like in the file little-step-u2.doc
    Turn potentiometer to 75kOhm and repeat measuring

    Another try: place an OP-Amp (something like a LM358, LM324) supplied with 5V wired as a voltagefollower between little-U-Step and propeller
    the 1k-currentlimiter-resistor AFTER the OP-Amp. This works as a current-booster and impedance-adapter.

    best regards

    Stefan

    Post Edited (StefanL38) : 8/7/2008 10:58:34 AM GMT
  • SiriSiri Posts: 220
    edited 2008-08-07 20:48
    Steve,
    I changed the call from Stepper.start(11,10,0,2400) -
  • SiriSiri Posts: 220
    edited 2008-08-12 14:45
    Stefan,

    So far I have not been successful.I am going to try using a serial level shifter· to solve this problem.Is it

    agood idea.



    Siri
  • StefanL38StefanL38 Posts: 2,292
    edited 2008-08-12 20:32
    Hello Siri,

    in your previous screen-shot measuring the signal coming from LSU-serial-out
    the low-level is at 0,8V this should be low enough to be detected as a low on the propeller.

    So i think the proplem is somewhere else

    In the new scope-screenshot are you sure that you catched the timeperiod where the answer was sended out from LSU-serial-out?
    The voltage should go up and down similar to the situation when the prop is not connected to LSU-serial-out

    Measuring the voltagedrop across the 1k-resistor between Prop and LSU-serial-out

    Can you adjust your scope that the level of the red line goes down to -3V ?
    And then adjust the voltage-scale to 10 mV / DIV ?

    If not switch your scope to measuring AC
    And then adjust the voltage-scale to 10 mV / DIV

    We have to check if the current is going up and down at ALL even if it is a very small voltagedrop


    I made a mistake in my description:

    i think it will be good to explain why measuring this:
    if the prop-IO-PIN is switched as input it should have a high impedance (=resistance). The current should be very low

    if the prop-IO-PIN is switched as output the impedance should be low.
    If the IO-PIN is switched to high the current flowong THROUGH the 2kohm-resistor should be

    (5V - 3.3V) / 2000 ohm = 0,85 mA

    If the IO-PIN switched to high the current flowing THROUGH the 2kohm-resistor should be
    (5V - 0V) / 2000 ohm = 2,5 mA

    If the values are completly different there is something wrong
    Wiring or the IO-PIN itself.

    Do the following measurements: connect a 2kOhm-resistor to +5V
    connect the other end to PIN11 and measure the current
    flowing THROUGH the 2kOhm-resistor

    (that's what i meant in the previous post)

    load a small testprg to the EEPROM that simply makes PIN11 an output
    and set PIN11 to HIGH and measure the current
    flowing THROUGH the 2kOhm-resistor

    load a small testprg to the EEPROM that simply makes PIN11 an output
    and set PIN11 to LOW and measure the current
    flowing THROUGH the 2kOhm-resistor

    disconnect the resistor from the prop
    load your Little-Step-U-Test-code to the EEPROM
    connect the resistor to PIN11 and measure the current
    flowing THROUGH the 2kOhm-resistor again

    I would like to know if the LSU-serial-out can provide a similar current as
    your 5V-supply

    What is the voltage measured at the serial-out of LSU when the prop is DISconnected?
    Result : 5.04V and 0.03V at P 11 of prop.

    0.03V at P11 of prop. What was the IO-state of this IO-PIN while measuring ?

    If P11 is set as output and switched to high and nothing is connected to the IO-PIN the voltage
    should be around 3.3V. If switched to low it should be near to 0V.

    If this is not measured there is something wrong with the IO-PIN

    if P11 is set as input: DIRA[noparse][[/noparse]11] := 0

    connect P11 to ground
    then INA[noparse][[/noparse]11] should be 0

    connect P11 to +3.3V
    then INA[noparse][[/noparse]11] should be 1

    >4.When the test code is run changing dira[noparse][[/noparse]11]~~ and outa[noparse][[/noparse]11]~~ PIN 11 state = “0”
    >This really got me !!!

    A Testcode that did start only ONE cog?

    What results do you get with other IO-PINs doing this test ?

    quotation of the manual

    I/O Pins
    The Propeller has 32 I/O pins, 28 of which are entirely general purpose. Four I/O pins (28 -
    31) have a special purpose at Boot Up and are available for general purpose use afterwards;
    see the Boot Up Procedure section on page 18. After boot up, any I/O pins can be used by
    any cogs at any time since I/O pins are one of the common resources. It is up to the
    application developer to ensure that no two cogs try to use the same I/O pin for different
    purposes during run-time.
    Each cog has its own 32-bit I/O Direction Register and 32-bit I/O Output Register. The state
    of each cog’s Direction Register is OR’d with that of the previous cogs’ Direction Registers.
    Similarly, each cog’s output states is OR’d with that of the previous cogs’ output states. Note
    that each cog’s output states are made up of the OR’d states of its internal I/O hardware and
    that is all AND’d with its Direction Register’s states. The result is that each I/O pin’s
    direction and output state is the “wired-OR” of the entire cog collective. No electrical
    contention between cogs is possible, yet they can all still access the I/O pins simultaneously!
    The result of this I/O pin wiring configuration can easily be described in the following simple
    rules:
    A. A pin is an input only if no active cog sets it to an output.
    B. A pin outputs low only if all active cogs that set it to output also set it to low.
    C. A pin outputs high if any active cog sets it to an output and also sets it high.

    So for the tests it's very important to make sure that no other cogs are messing around with the
    IO-Pin registers DIRA and OUTA

    best regards

    Stefan
  • SiriSiri Posts: 220
    edited 2008-08-17 20:03
    Stefan,

    I finally solved the problem.
    I used a serial level adjuster between the Stepper driver and the propeller.By using the level adjuster
    The serial input PIN could be made an INPUT.Without the serial level adjuster the Serial IN pin remained
    an INPUT.

    Thanks for all your help.

    Regards,

    Siri
  • SiriSiri Posts: 220
    edited 2008-08-17 22:23
    Siri said...
    Stefan,

    I finally solved the problem.
    I used a serial level adjuster between the Stepper driver and the propeller.By using the level adjuster
    The serial input PIN could be made an INPUT.Without the serial level adjuster the Serial IN pin remained
    an OUTPUT.

    Thanks for all your help.

    Regards,

    Siri
  • PodionPodion Posts: 90
    edited 2012-11-27 22:10
    Hello Siri

    Can you post your code ? I have the same problem whit the "U" command..
Sign In or Register to comment.