Shop OBEX P1 Docs P2 Docs Learn Events
Wireless Programming of BS2 — Parallax Forums

Wireless Programming of BS2

aerodudeaerodude Posts: 22
edited 2007-11-12 16:25 in BASIC Stamp
Hi All,

My goal is to program a BS2 wirelessly. One option is to use toothpick. I have a wireless modem which i used to connect sensor with serial output to a laptop in a WiFi network. In that I created a virtual COM port on the laptop to read the data from this sensor.

Now, i wanted to program a BS2 and created a COM Port # 11, and when i run a code in the PBASIC terminal, i could only see COM ports 1 & 5. How do I choose 11? I tried ' {$PORT COM11} as well but no use. What should be the properties of the COM port to talk to BS2? Where am I going wrong here?

Thanks in advance.

satish

Comments

  • FranklinFranklin Posts: 4,747
    edited 2007-11-10 00:16
    Due to the tight timing required to program the BasicStamps you will have difficulty programming anyway other than a direct link. You might consider downloading the program to the remote location and then programming the chip with a direct connection there.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2007-11-10 01:35
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-11-10 17:00
    If you wanted to build your own wireless programmer I don't think it would be too difficult. You could use another BS2 as the remote programming device that would first receive a tokenized version of the new program via RF and store it on a Parallax datalogger, after receiving the whole of the program it would then write the contents of the datalogger to the master Stamp. I guess there are one or two ways to get a tokenized version of your program, what I have done in the past is to read the contents of the EEPROM into a CSV file on the PC and then transmit it down a serial line. I havn't tried this with RF though.

    Another option using the same setup would be to keep several variations of your program on a thumbdrive and just send a signal indicating which version you wanted to run.

    This following link has bunches of great information on using one Stamp to program another······· http://www.emesys.com/BS2clone.htm

    Jeff T.
  • aerodudeaerodude Posts: 22
    edited 2007-11-10 17:07
    Dear Stephen,

    Can you elaborate more on the "tight timing required to program" BS2? Also what do you mean by downloading the program to the remote location?


    Dear Steve,

    Yeah there is definitely stache and that was my initial thought too...
    but now my goal is to do that wirelessly in a network so I am trying with WiFi modems.

    satish
  • Mike GreenMike Green Posts: 23,101
    edited 2007-11-10 17:39
    Both the Stamp and the Stamp Editor have timeouts on responses from each other and the amount of time involved is small. The Stamp Editor also expects the transmitted data to be echoed back from the Stamp and will check that it's the same as what was sent. Most wireless links are half duplex. They send only one way at a time and, if they supply a full duplex link, it's done by buffering a little so that it looks like it's full duplex even though the actual link is only half duplex. Since wireless links are not reliable (due to noise, etc.), some kind of error correction is often added and this is done on small blocks of characters, again adding to delays, particularly if an error occurs and the data has to be retransmitted. It's these buffering and error detection/correction delays that prevent remote programming because they're longer than what the Stamp and Stamp Editor expect.

    One way around this is to have something like a Stache at the remote location and a special downloading program at the PC. The Stamp Editor can save a binary file of the compiled bytecodes and another program can use a more timing tolerant protocol (like Kermit or XModem) to download the file to the Stack-like device which will store a copy, then transfer it to the Stamp automatically.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2007-11-10 18:35
    There is the requirement for the tx line from the "PC" into the Stamp to be in a BREAK state when the Stamp comes out of reset, and it has to stay in that state for 50 or more milliseconds thereafter. That is what puts the Stamp into programming mode. After that the timing on the Stamp side is not critical. It has to receive the bytes in the correct order, but there are no further timeouts on the Stamp side. The timeouts you see when using the STAMPW IDE are due to the IDE giving up on receiving an echo. So if you are designing a remote programming system, the trickiest part will be to generate the reset/BREAK sequence to put the Stamp in programming mode and then a substitute for the IDE that will deliver the bytes with more tolerance in the handshake timing, or even do it open loop and then do a verification CRC or something like that when finished.

    It is relatively easy to hack remote programming with a BS2p series Stamp. A program running in one slot can be made to receive a plain text file that it can WRITE into another slot, verify, and RUN. It just needs an entry condition for download routine.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • aerodudeaerodude Posts: 22
    edited 2007-11-11 00:35
    Thank you all for the input. I kind of went through the user guide for Stamper suggested by Peter. There two modems are needed one to connect it to PC and the other one with BS2. Since it works, my idea should work I guess.

    Correct me if I am wrong...but my understanding is I create a virtual COM port on the laptop, the PBASIC will see that COM port and when I run a program, the tokenized data will be sent to that COM port. But there the COM port is virtually connected to the IP address of the wireless modem I have and the BS2 is connected to the serial port of the modem and it is configured to 9600 baud, 8N1.
    With that my problem now is how to make the PBASIC see the COM11 I created?


    Mike, the WiFi modem I am using has 256 Kbytes SRAM, 512 Kbytes flash and supports a data rate up to 921,600 bps and I think it is a full duplex link (IEEE 802.11 b/g). So I don't think it causes much delay in transmission.

    Allen, u said about the requirement from the PC side of the Tx line and I believe the virtual COM port actually takes care of it by mimicking the status of all the pins(I guess). But I have to definitely look into your suggestion.


    (My interest in using WiFi modems is that a Laptop without any external devices/cables connected (unlike stamper) can program the BS2 and offers advantages in terms of network security by authentication, encryption)


    Satish
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-11-12 16:07
    There is one other timeout to consider if going wireless…During programming if the BASIC Stamp does not receive program data for 2.3 seconds or more it will reset. This could happen if the RF system was busy handling errors/retransmission of corrupted data.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • Bill ChennaultBill Chennault Posts: 1,198
    edited 2007-11-12 16:25
    All--

    What we need is a wireless Ethernet module with at least one com port. I have the WIRED version of exactly what is needed and it has three, 8-bit ports. I have searched high and low without success to find a wireless version of it. I have even talked to the manufacturer and they said a wireless version of their product was a good idea and they had thought about it and were continuing to think about it as a future product.

    In the meantime, I have decided to mount my wireless tablet-PC on Ugly Betty, my skid-steer. Then, I will simply RDP into it and crank up the Stamp IDE. Does anyone see a disadvantage in this approach other than the fact that I will be adding weight to my machine? Of course, having a tablet-PC on board will also allow me to do some other VERY interesting things quite easily.

    --Bill

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You are what you write.
Sign In or Register to comment.