Shop OBEX P1 Docs P2 Docs Learn Events
BS1USB serial control over its USB with terminal — Parallax Forums

BS1USB serial control over its USB with terminal

spamerspamer Posts: 2
edited 2011-09-28 18:29 in BASIC Stamp
Hello,

I like to control BS1USB using USB serial port. I found, that there is no connection from USB serial to software using SERIN.
So I connected the USB serial output to P3 with 10K resistor. See attachement. Warning - changing the board voids warranty.
It receives the data, but after about 1 second of data been received the CPU restarts itself.

Is there some solution how to control software with USB serial terminal?

Juraj
858 x 319 - 67K

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-02-18 15:18
    Using a 10K resistor between the USB serial output and an I/O pin is a valid way of doing this. There's nothing in what you've done that would cause a reset, so it must either be a bug in your Stamp program or your PC program that's causing the reset.
  • spamerspamer Posts: 2
    edited 2010-02-18 16:08
    I have two modules with same "reset" behavior (V1.4).

    Simple program:
    Main:
    LOW 4 ' connected led between VDD and P4 light on
    GOTO Main

    When send e.g. "00" to terminal on 1200, then led gets dark for about 1 second and then get light back. BS1USB is probably restarted.
    Terminal reads every char sent - received data "5B 5B 5B 5B 5B 5B 5B 5B 5B 5B 5B 5B 5B 5B 5B 5B F9". Probably some debug mode is activated.
    I think, that CPU is still is debug mode, that expects only new firmware on the serial line. When incorrect char comes ("0"), then it is automatically reset, what is not really expected. There should be added some magic sequence to activate CPU reset, not just single char "0".
  • avicenneavicenne Posts: 2
    edited 2011-09-26 12:00
    Hi

    I used the same transformation of spamer aading the resitor 10K , serin works fine but serout send full of control caracters to the computer !
    do you have idea what's wrong?
  • Mike GreenMike Green Posts: 23,101
    edited 2011-09-26 12:19
    spamer,
    You're probably forcing the Stamp to reset by short-circuiting the power supply. If you connect an ordinary LED between an I/O pin and, say, Vdd, the LED will short circuit between the I/O pin and Vdd. The Stamp's I/O pin (if it doesn't burn out) will supply at most 20-30mA to the LED. That still may be enough to cause a drop in Vdd to below the point where the Stamp will automatically reset (about 4.2V). Solution: Use a 470 to 1K resistor in series with the LED to limit the current to something reasonable.

    avicenne,
    You really have to supply a copy of your program and a diagram (schematic) of your circuit. Otherwise, we're really just guessing what's wrong. See below:

    attachment.php?attachmentid=78421&d=1297987572
  • avicenneavicenne Posts: 2
    edited 2011-09-28 17:25
    Hi Mike

    Thanks for your quick reply

    the program i use for test is just the template on parallax CD
    ' SEROUT.BS1
    ' This program transmits the string "ABCD" followed by a number and a
    ' carriage-return at 2400 baud, inverted, N81 format.
    
    ' {$STAMP BS1}
    ' {$PBASIC 1.0}
    
    SYMBOL  SOut            = 1
    SYMBOL  Baud            = N2400
    
    SYMBOL  value           = W1
    
    
    Setup:
      value = 1
    
    Main:
      SEROUT SOut, Baud, ("ABCD", #value)
      value = value + 1
      PAUSE 250
      GOTO Main
      END
    
    
    When i connect the BS1 thrue PIN1 to serial cable and then to the computer evrything works fine
    Computer receive the data correctlly
    But when i do the transformation of spamer With the resistance 10K the data pass by FTDI chip on USBBS1 , then by a USB cable is connected to the computer.In this case the data received by the computer is wrong full of 8c and 9c are received by the computer.
    In my opinion the solution is on the FTDI chip . am i wrong?
    the other solution is DEBUG Viewer but it replace serout not serin.
    I am going to try to find a solution for this communication .
    Otherwise i think We must completly migrate to the BS2.
    If you have idea about this communication it will be appreciate
    With my thanks from France
  • Mike GreenMike Green Posts: 23,101
    edited 2011-09-28 18:29
    spamer is trying to send data from the PC to the BS1USB. The BS1USB I/O pin is an input and it won't affect the output data from the FTDI chip. You are trying to go the opposite way and that won't work. The connection to the PC via the FTDI chip is for programming the BS1. This programming is bidirectional. There's a signal from the BS1's PIC microcontroller to the FTDI chip to the PC. If you connect a BS1 I/O pin to the FTDI chip, it's competing with the signal from the PIC programming pin.

    You can use the DEBUG statement to send data via the programming connection to the PC. The Nuts and Volts Column #20 describes the format of the data packet that is sent to the PC.
Sign In or Register to comment.