Shop OBEX P1 Docs P2 Docs Learn Events
Propeller1 connection to PC via USB — Parallax Forums

Propeller1 connection to PC via USB

Hi,
I would like to connect the P8X32A to PC for main control via USB. I think I need USB to serial conversion IC like the FT232. I have no SW practice how set up the HW and build up the communication. I have found some sample program in the internet but not fully cover my needs. Can any body give me advice or share me this kind of program?
Best Regards
Spiller

Comments

  • yetiyeti Posts: 818
    edited 2019-08-29 08:47
    Propeller-Demo-Board-Schematic-RevG_0.pdf shows a Propeller to FT232 connection, p1load, PropLoader and several other loaders do exist to send your code to the Propeller and play terminal afterwards.
  • HI Yeti,
    Thx the info. After my understanding if I use one of these loaders I can communicate (send/receive data) to the propeller in USB connection from a PC?
    Regards
    Spiller
  • kwinnkwinn Posts: 8,697
    Spiller wrote: »
    HI Yeti,
    Thx the info. After my understanding if I use one of these loaders I can communicate (send/receive data) to the propeller in USB connection from a PC?
    Regards
    Spiller

    As long as the software you download to the Prop includes a serial comms object that is set up to communicate on pins 30/31 the PC and Prop can communicate.
  • Hi,

    So I can use the same propeller ports for USB communication as for programming the propeller? Can I modify this serial comms object to use other ports?
    Regards
    Spiller
  • yetiyeti Posts: 818
    edited 2019-08-29 13:52
    The Propeller contains a serial loader in its ROM. After loading your program, this loader gets completely out of the way. Your program needs to manage the communication with the PC. There are plenty of examples for this. A very simple "Hello, World!" in Spin could look like this:
    con
      _clkmode = xtal1+pll16x
      _clkfreq = 80_000_000
    
    obj
      ser : "FullDuplexSerial"
    
    pub main
      ser.start(31, 30, 0, 115200)
      ser.str(string("Hello, OpenSpin!",13,10))
      waitcnt(_clkfreq + cnt)
      ser.stop
    

    Changing the arguments in "ser.start", you can change the pins and the speed.
  • kwinnkwinn Posts: 8,697
    edited 2019-08-29 18:14
    Spiller wrote: »
    Hi,

    So I can use the same propeller ports for USB communication as for programming the propeller? Can I modify this serial comms object to use other ports?
    Regards
    Spiller

    Short answer is yes. The line of code "ser.start(31, 30, 0, 115200)" in yeti's post above sets the serial object code to use pins 31 and 30. Any other two pins could be used for communicating with the outside world, but only 31 and 30 can be used for booting the Propeller via serial download.

    There is also a 4 port object that can be used to enable four serial ports, each of which can run at different speeds and pins. I have used that object to build 8 and 12 port serial concentrators for laboratory and automation equipment.
  • Hi All,
    I more than satisfied with these answers. I will try these codes. Thanks for both of you! Spiller
Sign In or Register to comment.