Shop OBEX P1 Docs P2 Docs Learn Events
Bs2 and elm327 — Parallax Forums

Bs2 and elm327

clambclamb Posts: 7
edited 2011-03-26 20:28 in BASIC Stamp
I am trying to get my basic stamp to talk with an elm 327 chip. I can't even get the L.E.Ds on the Elm 327 to light up to at least show that they both have some form of communication. I have double checked my wiring and at this point I'm pretty confident It's ok. Has anyone attempted and been successful at this by any chance? Thank you.

Comments

  • clambclamb Posts: 7
    edited 2011-03-25 21:24
    I should add that my Bs2 is hooked up to my computer via a serial to usb cable
  • Mike GreenMike Green Posts: 23,101
    edited 2011-03-25 21:28
    How about describing how you have things connected. There's no fundamental reason why you can't get the two to talk to each other, but there's a lot to connect on the ELM327, therefore a lot to get wrong.

    Keep in mind that the ELM327 communicates at either 9600 Baud or 38400 Baud. None of the Stamps can handle 38400 Baud and 9600 Baud is dicey with the slower Stamps like the BS2. It can work, but you have to be very careful about how you write your SERIN statements.
  • FranklinFranklin Posts: 4,747
    edited 2011-03-25 21:31
    You know, it really helps if you post links to the items you are discussing, show us how you have things connected and attach your code so we don't just have to guess at things.

    Your turn.
  • clambclamb Posts: 7
    edited 2011-03-25 22:40
    I could take a picture of my physical circuit but to make things easier I will refer you to page 67 on this link: http://www.elmelectronics.com/DSheets/ELM327DS.pdf

    The only difference is that: my pin 1 on basic stamp is going to pin 18 on the elm. Pin 2 on my stamp is going to pin 16 on elm. Here is my code:

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    elm_busy PIN 2
    speed_array VAR Byte(10)
    DO WHILE elm_busy = 1'wait until elm is not busy
    LOOP
    SEROUT 1,240,["atz"]'reset command. leds on elm should light up
    END

    @mike: If pin 6 on the elm is set high, the default is 38.4k but you can set it to whatever value you like. if pin 6 is low then it can't be changed from 9.6k (pages 3 &56)

    Thank you.
  • clambclamb Posts: 7
    edited 2011-03-25 23:21
    I forgot to mention the last difernce b/w my circuit and the link i posted above: pins 9 & 10 on mine are not connected to anything but i don't think this should affect my operation.
  • Mike GMike G Posts: 2,702
    edited 2011-03-26 06:04
    A 4.0Mhz crystal should be connected between pins 9 and 10. I did not see an internal oscillator. You might want to take a closer look at the datasheet and your connections.
  • clambclamb Posts: 7
    edited 2011-03-26 15:17
    Mike,

    I knew there was supposed to be a 4mhz oscillator the but didn't think omitting that will affect things. I will oreder one and see if that solves the problem. In the mean time is there any chance you (or anyone) could shed some light on what this oscillator contributes to the circuit and why not having it in there would make the elm communicating with the bs2 impossible? Thank you
  • Mike GMike G Posts: 2,702
    edited 2011-03-26 16:36
    @clamb, an oscillator allows a uController to execute timed tasks like sending and receiving asynchronous serial data.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-03-26 19:27
    clamb posted, "I knew there was supposed to be a 4mhz oscillator the
    but didn't think omitting that will affect things."

    Rather?

    Without the xtal, the device has no timebase.
    It works as well as you would without your heart.
  • Mike GreenMike Green Posts: 23,101
    edited 2011-03-26 20:28
    You not only need a 4MHz crystal, you also need two capacitors, one from each side of the crystal to ground. Read the datasheet for their values.

    The datasheet also talks about how to connect unused pins. Don't ignore that. It's there for a reason (mentioned in the datasheet description).
Sign In or Register to comment.