Shop OBEX P1 Docs P2 Docs Learn Events
RF Modems with BS2p — Parallax Forums

RF Modems with BS2p

bdrew7bdrew7 Posts: 38
edited 2009-07-28 15:04 in BASIC Stamp
I am attempting to communicate with a BS2p24 on a Basic Stamp Super Carrier Board with two Digi International 9xTend 900 mHz modems. The modems have data in and data out. There are no control pins available on the modems.

How should I handle the ATN pin on the BS2p?

Is it possible to insert the rf modems in the serial port lines to communicate and download programs from the Stamp editor?

Thanks.
Bernard

Post Edited (bdrew7) : 7/24/2009 12:18:24 PM GMT

Comments

  • xanatosxanatos Posts: 1,120
    edited 2009-07-24 02:22
    Hi,

    1:· You'll get a better response if you put a subject line on your post (edit).

    2:· It depends on your application, but if you are using the Digi product to communicate between two BS2's of any flavor, you can use the SERIN and SEROUT commands, with one i/o pin each (not the SIN, SOUT and ATN pins) connected to the Data In and Data Outs.· Unless you are trying to program the BS2's via RF...???

    I use the Digi XBee PRO XSC's a lot now (just ordered another 5 of 'em).· I'm using them with BS2sx's quite well... not sure how much difference there is in comm requirements between your units and the XSC.· I hope this may prove helpful, let me know if I can add more.

    Best,

    Dave






    Post Edited (xanatos) : 7/24/2009 2:28:19 AM GMT
  • bdrew7bdrew7 Posts: 38
    edited 2009-07-24 12:24
    Thanks Dave. I initially posted this from my iPhone, and I could not see how to edit the subject field after I prematurely submitted the post! (Big fingers!!)

    Yes, I need to be able to program and monitor the BS2p program flow via rf. Hopefully this is not wishful thinking.

    The system is in an autonomous boat that can be quite a distance out on the water during the testing phase. Take a look at http://springboatauv.blogspot.com

    I will investigate the XBee Pro and see how that is done.

    Again thanks for your help.
    Bernard
  • xanatosxanatos Posts: 1,120
    edited 2009-07-24 13:05
    Hi Bernard,

    If you will need to actually program the BS2 (as opposed to just issuing commands which the BS2 will respond to) then you'll need to use the SIN, SOUT and ATN pins as you suspect. I'm curious though as to why you would need to actually change the programming in the chip during the units deployment? I use the BS2SX a lot and can issue commands that will allow me to direct the system to run programs in different slots (it can hold 8 different programs and switch between them with shared variables).

    MAybe if I understood a little bit more about what you are actually wanting to do programattically I could give you more helpful info.

    If you weren't needing to change the program code resident in the BS2, the XBee PRO XSC is simplicity itself for communications. The XSC is limited to 9600 baud, but for most applications this is more than sufficient. The only thing you need to provide is a small voltage divider on the BS2 SEROUT pin (the XBee RX pin) to convert the levels from the 5V BS2 to the 3.3V XBee (I use a 1.5k and 3.3k). The only other connections *required* on the XBee are +3V3 and ground. There are two other connections you may wish to make - LEDs to show transmit, receive, etc., but if you are making an autonomous vehicle, the LEDs might be unnecessary and not using them can save battery life.

    Sounds like a fun project!

    Dave
  • bdrew7bdrew7 Posts: 38
    edited 2009-07-24 13:41
    The programming via rf is desireable due to the control system being in a sealed, water tight·tube.· I do have an IP-67 certified·serial connector on the tube that I can use, but having a computer near the water is not desirable. (I dropped my iPhone in the water as an expensive lesson!!)· I guess the only solution is a regular serial cable connection.

    Also, the rf link would allow me to download new coordinates or commands to retrieve the boat without an accompaning chase boat, if a failure of some sort is encounterd during testing.

    BS2p slots are used for the program.· I divided the different tasks between slots, such as navigation, motor control, initialization and debug message generation.· Common memory and the uFPU coprocessor handle passing variable values between slots.

    Thanks.
    Bernard
  • bdrew7bdrew7 Posts: 38
    edited 2009-07-24 13:59
    I found a post on the Basic Stamp Forum·by TomH on 10/30/2007 titled "BS2 Through Radio Link" that states the timing on the ATN rules out the rf modem solution.

    Bernard
  • Mike GreenMike Green Posts: 23,101
    edited 2009-07-24 14:25
    You cannot use the Stamp Editor and the normal programming serial link for programming via a wireless link. As you've found, the timing won't work. There are other, more complex, ways to do it.

    One solution, which has been used commercially in a now discontinued product, is to use a communications processor with enough of its own memory to hold a complete program. There's a utility program on the PC that transfers the program (which has been saved from the Stamp Editor as a file) using some kind of error-correcting packetized protocol like Kermit to the communications processor's memory using a program in that. Once the entire program is transferred, the communications processor programs the Stamp just like it was a PC. The protocol is publicly documented.

    Another solution again involves saving the program to a file on the PC and having a communications program on the PC that transfers the program packet by packet over the RF link. In this case, there's a program running on the Stamp itself that receives each packet (using scratchpad RAM as the buffer), decodes the packet, and writes the packet's contents to one of the other "slots" of EEPROM (other than slot zero where this program is kept). Once the entire program is downloaded, the download program can do a RUN statement and transfer control to the downloaded slot.

    A third solution would be to just transfer the new coordinates or commands via the RF link. You'd never change the program itself via the RF link.
  • bdrew7bdrew7 Posts: 38
    edited 2009-07-24 14:44
    Thanks for the possible solutions. I would be happy just to download coordinates and commands, without changing the fundamental program. Is this possible through the serial port with the ATN pin? If so, how do I handle the ATN?
  • Mike GreenMike Green Posts: 23,101
    edited 2009-07-24 15:04
    Disconnect ATN when you're using the DEBUG/programming port for data. ATN is used to reset the Stamp which you only want to do when programming.

    ATN is connected to the DTR RS232 signal and you can make up a serial cable with this not connected.
  • bdrew7bdrew7 Posts: 38
    edited 2009-07-24 17:16
    One last question. Can I change the DEBUG commands to SEROUT (and SERIN) with proper formatting for this port and essentially monitor the messages that I had been printing using the DEBUG command?

    Thanks for the help.
    Bernard
  • Mike GreenMike Green Posts: 23,101
    edited 2009-07-24 17:49
    Yes. "Pin" #16 in a SEROUT or SERIN statement uses the programming port just like DEBUG or DEBUGIN. Remember that the format of the statements is a little different.
  • sylvie369sylvie369 Posts: 1,622
    edited 2009-07-24 20:49
    You may find this helpful:

    http://selmaware.com/appbee/AppBee_Doc.PDF

    I did, when I started using XBees.
  • bdrew7bdrew7 Posts: 38
    edited 2009-07-28 15:04
    That application note is a great help!!

    Thanks.
    Bernard
Sign In or Register to comment.