Shop OBEX P1 Docs P2 Docs Learn Events
Position Controller from Motor Mount kit — Parallax Forums

Position Controller from Motor Mount kit

TrishTrish Posts: 10
edited 2009-04-16 04:45 in Robotics
I'm the new member to the forum (but certainly not new to Parallax products!)

The Position Controller from the new Motor Mount and Wheel Kit has a single data line to send and receive information about the encoder.

I am not using any Basic Stamps, instead, I'm using an ARM processor. This particular development board that I have, has 2 separate pins to communicate through UART - one pin to receive, one pin to transmit.

The description of the data line says that its function is "Communication line used to send and receive data - connect to single-wire UART bus."

How in the world do I physically connect two pins from my microprocessor, to that single data line on the Position Controller? I've googled around and there was a lengthy MAXIM explanation how I might make an I/O Pin a master for the bus.

The whole reason for this is because I only want to be able to query the position of the wheels - I'm bypassing the control and sending PWM straight to the HB-25.

So, any ideas? Any references you guys can make?

Thanks in advance!
Trish smile.gif

Comments

  • TrishTrish Posts: 10
    edited 2008-07-09 22:11
    I just re-read the pdf and the schematic that they provided on page 18 shows that they use an ATMELtiny2313 processor on the Position Controller. Ports D0 and D1 are receive and transmit, respectively. They have those two pins tied together (with a 2.2k resistor) on the transmit pin. These pins together create the single-wire uart line - I THINK.

    I'm not sure, but can I repeat this on my ARM board?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ___________________________________________
    "It's not procrastination, it's a tactical delay." ~Worf
  • MSDTechMSDTech Posts: 342
    edited 2008-07-11 02:12
    Actually any pin can be used for serial communications. Lookup the Serin and Serout commands.
  • TrishTrish Posts: 10
    edited 2008-07-11 04:55
    I took a look closer at the user's manual and it looks like the dedicated SOUT and SIN pins that I was looking at is used for the Stamp Editor to download. But you're right, it looks like any pin can take serial communication.

    The interesting thing is the processors that they use for the BS's and BS2's are Microchip's PIC or from Ubicom. I'd be curious to see how they handled their dedicated serial lines in order to have the BS's have serial lines on any pin.

    Nevertheless, this still doesn't solve my problem. [noparse]:o[/noparse](

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "It's not procrastination, it's a tactical delay." ~Worf
  • Kevin McCulloughKevin McCullough Posts: 62
    edited 2008-07-11 16:06
    Hi Trish,

    Sorry for the delay in responding to your post. It is true that the Position Controller uses an ATtiny2313, and that the Tx pin (PD1) is connected to the Rx pin (PD0) via a 2.2k resistor. This resistor makes the Tx pin drive the bus more softly, and protects the pin if bus contention happens to occur (which shouldn't happen if your code is correct smilewinkgrin.gif).

    As you read in the product documentation, up to four position controllers can be connected on the same single-wire serial bus. It might seem like a problem to connect all four if one of the Tx pins is trying to drive the line high through a 2.2k resistor while the other three are trying to drive the line low. However, this is not a problem due to an interesting configuration of the Tx pin on the UART (serial port). Whenever the Tx pin is not actively transmitting data, it remains an input pin - high impedance. Therefore the above scenario works because the Tx pin is trying to drive the line high through a 2.2k resistor while the other three Tx pins just look like open circuits (because they are not actively trying to send data at the same time). This detail is not apparent by just looking at the schematic.

    This should now provide some insight as to how you should connect and configure the pins on your microcontroller. Connect the Tx and Rx pins together to create your single-wire serial bus. Configure the Tx pin to return to an input pin (high impedance) whenever it is not transmitting. Also, you do not need a 2.2k resistor in series with the Tx pin (like on the Position Controller) since that microcontroller will take priority on the bus.

    Attached is a .pdf of an example circuit schematic for this application.

    Another consideration, that is also not apparent by looking at the schematic, is that internal pull-up resistors are used on the Tx pins when they are set as inputs. This makes the Tx pins somewhat less "high"-impedance than they would otherwise be; however, this ensures that the bus doesn't float around (potentially triggering false data) when no devices are driving it.

    Good luck! Don't hesistate to ask if you have any other questions! smile.gif
    -Kevin
  • TrishTrish Posts: 10
    edited 2008-07-11 18:02
    Thanks for the response Kevin! I'll hook these pins up and make sure that I do, in fact, go to a high impedance when I switch to an input setting on the TxD.

    I'll let everyone know how it turns out.

    turn.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "It's not procrastination, it's a tactical delay." ~Worf
  • TrishTrish Posts: 10
    edited 2008-08-13 17:58
    Hey Kevin (sorry for the super long delay),

    I just got my system up and working and now I'm actually ready to use the single-wired UART on the Position Controller. I just realized something. Normally all the Basic Stamps produce outputs at 5v. The ARM processor produces high outputs at 3.3v If I go ahead and do what you suggested, will I have to bump up the UART transmit pin on the ARM from 3.3v to 5v in order to "speak" to the Position Controller?

    Thanks!
    Trish roll.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "It's not procrastination, it's a tactical delay." ~Worf
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-08-13 19:13
    Trish,

    Typically 3.3V logic is compatible with the inputs of TTL/CMOS equipment because 3.3V is still above the minimum voltage for a high condition.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • TrishTrish Posts: 10
    edited 2008-08-13 20:03
    Thanks Chris! I'll give it a shot today.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "It's not procrastination, it's a tactical delay." ~Worf
  • TrishTrish Posts: 10
    edited 2009-04-14 22:49
    Hi Kevin and/or Chris,

    Sorry for the extremely late response but I've just now finally got a chance to work on the Position Controller part of my project. I am having trouble, still, communicating from my ARM processor to the single-wired UART on the Position Controller. I am not getting a response from the Position Controller. I followed the setup that Kevin posted earlier on this thread in July. My transmit and receive pins from the ARM are tied together and that is tired to the Data line of the Position Controller. The way my C code is written on the ARM as:

    1. Set up transmit and receive pins
    2. Send out hex 12 (LSB) to query speed on ID 2 (and I made sure that my AB jumpers were set up right on the Position Controller)
    3. Change the transmit pin to an input pin
    4. Should receive response by Position Controller

    I have actually seem the transmission pin send out the hex 12 using a USBEE RS232 Logic Analyzer. So see the ARM sending the query, but I see nothing being returned from the Position Controller.

    Is there something else I'm missing? Do I need to use pull up resistors on the ARM pins?

    Any help would be grateful. This is last piece of my puzzle and this year long project could be done very soon.

    Thanks!
    Trish

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "It's not procrastination, it's a tactical delay." ~Worf
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-04-15 22:00
    Trish,

    You cannot tie your RX/TX pins together. What will happen is that when the controller is trying to send a response back it will be fighting against your TX pin which is already asserting the line. And your RX pin will only see what the TX pin does. We have some circuits that combine 2 signal lines into a single bi-directional line. For an example please see the following link. Take care.

    http://forums.parallax.com/showthread.php?p=640507

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • TrishTrish Posts: 10
    edited 2009-04-15 22:11
    Oh man, that presents a problem. My circuit designs and fabrication were done a little over a year ago based on Kevin's schematics. So even if I switch my transmit pin to an input pin (to create a high impedance on the pin) immediately after the query, this isn't enough to make sure that the Position Controller's response will be received by my receive pin? That's a bummer.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "It's not procrastination, it's a tactical delay." ~Worf
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-04-15 22:17
    You may be able to switch the pin to an input...I am not sure what the response time is nor the speed your MCU handles this...but you could see on a scope what is happening. You should see a difference from what you got before.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • TrishTrish Posts: 10
    edited 2009-04-16 04:45
    My processor runs at 60 Mhz. I have tried this method, as stated by Kevin, and I saw no response back from the Position Controller on a scope. Do you think my processor is too fast? Not fast enough?

    Trish

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "It's not procrastination, it's a tactical delay." ~Worf
Sign In or Register to comment.