Shop OBEX P1 Docs P2 Docs Learn Events
Serial communication (Full Duplex Serial) no longer works from my Mac ??????? — Parallax Forums

Serial communication (Full Duplex Serial) no longer works from my Mac ???????

tj4sheetj4shee Posts: 25
edited 2015-01-14 10:56 in Propeller 1
I am guessing/hoping that this is something ridiculously simple that I am missing... but.....

I can load code onto my development board..... and I know it is working by using leds as status.....

but serial (aka Full Duplex Serial) communication refuses to work.... either in SimpleIDE or PropellerIDE....

If I use the print function in C.... not via serial comm.... it actually prints to the terminal window..... but serial comm won't......

So I thought maybe I messed up ports 30 & 31 on the chip.... so I tried another board..... same thing....


So frustrated..... I have reinstalled Mac VCP drivers.... done a SMC reset on the Mac.... nothing changes....


TJ

Comments

  • tj4sheetj4shee Posts: 25
    edited 2015-01-13 14:46
    Some more info..... a simple example that I just tried on 2 different dev boards...

    In SimpleIDE..... the following works.....
    #include "simpletools.h"                      // Include simple tools
    #include "fdserial.h"
    
    
    int main()                                    // Main function
    {
       print("Hello\n");
       //fdserial *term;
       //term = fdserial_open(31, 30, 0, 115200);
       //fdserial_txChar(term, "H");
       //fdserial_close(term);
       
       while(1)
       {
     
       }  
    }
    }
    

    but this does not..... in fact, this won't even print the Hello....
    #include "simpletools.h"                      // Include simple tools
    #include "fdserial.h"
    
    int main()                                    // Main function
    {
       print("Hello\n");
       fdserial *term;
       term = fdserial_open(31, 30, 0, 115200);
       fdserial_txChar(term, "H");
       fdserial_close(term);
       
       while(1)
       {
     
       }  
    }
    
  • David BetzDavid Betz Posts: 14,516
    edited 2015-01-13 15:26
    tj4shee wrote: »
    Some more info..... a simple example that I just tried on 2 different dev boards...

    In SimpleIDE..... the following works.....
    #include "simpletools.h"                      // Include simple tools
    #include "fdserial.h"
    
    
    int main()                                    // Main function
    {
       print("Hello\n");
       //fdserial *term;
       //term = fdserial_open(31, 30, 0, 115200);
       //fdserial_txChar(term, "H");
       //fdserial_close(term);
       
       while(1)
       {
     
       }  
    }
    }
    

    but this does not..... in fact, this won't even print the Hello....
    #include "simpletools.h"                      // Include simple tools
    #include "fdserial.h"
    
    int main()                                    // Main function
    {
       print("Hello\n");
       fdserial *term;
       term = fdserial_open(31, 30, 0, 115200);
       fdserial_txChar(term, "H");
       fdserial_close(term);
       
       while(1)
       {
     
       }  
    }
    
    Try commenting out the line that prints "Hello" in the second example. I think you're starting a serial drive in COG 0 as well as in whatever COG fdserial_open launches. You really only want one COG to be writing to a serial port at a time.
  • ValeTValeT Posts: 308
    edited 2015-01-13 16:04
    Also, you might want to try to reinstall SimpleIDE. That is always what I try first :D

    Have you tried the exact same conditions ( program and hardware ) on another mac? Does that work?
  • tj4sheetj4shee Posts: 25
    edited 2015-01-13 16:15
    I did.... still the same result.... I took a quick video of the problem in action...

    http://youtu.be/SQhkdx0z7E4

    I
    though the same thing... maybe 2 cogs ... or maybe the "print" was doing half-duplex.... but nope

    TJ
  • tj4sheetj4shee Posts: 25
    edited 2015-01-13 16:16
    I have not tried a second mac yet... will do that later this evening....
  • ValeTValeT Posts: 308
    edited 2015-01-13 17:01
    One quick thing.....If you are going to open a fdserial connection to the computer via the usb cable on pins 30 & 31, you must first close the simple term communication by adding the following in your code:
    simpleterm_close();
    

    At least, I think that is it :D ......Something like that should work. You need to place this after your print statement but before the rest of the code.
  • tj4sheetj4shee Posts: 25
    edited 2015-01-13 17:23
    ValeT wrote: »
    One quick thing.....If you are going to open a fdserial connection to the computer via the usb cable on pins 30 & 31, you must first close the simple term communication by adding the following in your code:
    simpleterm_close();
    

    At least, I think that is it :D ......Something like that should work. You need to place this after your print statement but before the rest of the code.

    Good thought... but didn't change the outcome.... even if I don't use simple term... i.e. taking the print() statement out... fdserial still will not work.
  • ValeTValeT Posts: 308
    edited 2015-01-13 17:28
    huh......well, maybe the testing on another mac will tell us more.
  • tj4sheetj4shee Posts: 25
    edited 2015-01-13 21:26
    Well, I found an old USB<-->FTDI UART I used on a Coridium back a while... and decided to use it to put the fdserial on different pins... and low and behold it worked.... the "print" statement would go to the terminal hooked up to pins 30/31.... and fdserial would goto the terminal hooked up to pins 0/1 (my extra ftdi)..... and all works now.....

    so... I put fdserial back to using pins 30/31.... (using no simple_term) and it now works there too......

    So I don't know what was wrong.... with the day I had, it very well could be user error... or just a combination of other things I was running on my Mac during the work day (pesky job).... it would be hard to blame it on the propeller dev boards.... unless they got a case of gremlins....

    Thanks everyone for the attempted help and ideas.... I am going to mark this as solved.... with no apparent knowledge of how.

    TJ
  • ValeTValeT Posts: 308
    edited 2015-01-14 03:32
    Awesome!

    Glad it was a simple fix to solve the problem!
  • Dave HeinDave Hein Posts: 6,347
    edited 2015-01-14 05:47
    I'm can't tell if you were printing to the IDE terminal window in some of your tests, but it takes a fraction of a second for this to start up. If you do a print at the beginning of your program it may not show up on the IDE terminal. You can add a waitcnt at the beginning of your program to give enough time for the terminal window to be ready.
  • ElectrodudeElectrodude Posts: 1,658
    edited 2015-01-14 10:56
    simpleterm_set is a function you probably want to know about. It tells print and friends that it's supposed to use the fdserial you just created instead of the normal in-cog UART.

    Untested example:
    #include "simpletools.h"                      // Include simple tools
    #include "fdserial.h"
    
    int main()                                    // Main function
    {
       fdserial *term;
       term = fdserial_open(31, 30, 0, 115200);   // launch an fdserial in a new cog
    
       //simpleterm_close();                      // I'm pretty sure simpleterm_set calls this for you
       simpleterm_set(term);                      // set the fdserial to be the default terminal
    
       print("Hello World!");                     // your fdserial replaces the old term,
                                                  //  so print now works through the fdserial
       
       while(1)
       {
     
       }  
    
       fdserial_close(term);
    }
    
Sign In or Register to comment.