Shop OBEX P1 Docs P2 Docs Learn Events
need help with cog running right — Parallax Forums

need help with cog running right

I have attached a copy of my code and was wondering if anyone could find an issue with it. What I am experiencing is that it works perfect with the usb attached to the computer but when I unplug it, it does not run right. It pulses if this makes any since and does not run right. Hopefully someone can help !!! Thanks. I am using the propeller starter kit.

Andy

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-09-08 22:56
    This may be a known problem where your program keeps the transmit line turned on even though there's no PC attached.· The idle state of the transmit line is high (3.3V) and this feeds back through the USB to serial interface and causes periodic resets.· One answer is to leave the board connected to USB.· Another is to change your program so it doesn't use the USB port.· You can also test the USB port first to see if there's a PC attached (by doing an INA on the receive side and checking to see if it's high or low.· A high indicates that there's a PC connected).
  • edited 2009-09-09 00:44
    How do I take this dependency of the usb out?
  • Mike GreenMike Green Posts: 23,101
    edited 2009-09-09 01:11
    Like I said, you can make sure the two I/O pins (30,31) are not used in your program. By default they'll be inputs which won't affect the USB interface. The other choice that I mentioned requires that you test whether the receive pin is high or low. If high, the USB connection is present and you can initialize the transmit pin as an output (normally done by your serial I/O driver). If low, don't initialize the serial I/O routines.
  • RaymanRayman Posts: 14,849
    edited 2009-09-09 01:24
    Seems a lot of people are using "fullduplexserial" or something similar on pins 30&31 to do debugging... This is what causes the problem with no USB connected...

    Easiest solution is not to "start" that object so that it won't put power on the transmit pin...

    Other solution, like Mike said, is to test pin 30 (I think it's 30) for a logic one (meaning the USB cable is connected) and only enable the serial debugging interface if it is...

    Another solution is to put a pull-up or down on pin 31... But, I think that'd be hard on the board you have...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm
Sign In or Register to comment.