Shop Learn
HELP - Serial LED control PASM — Parallax Forums

HELP - Serial LED control PASM

I wrote a simple program in PASM for my project board and it's not working. It is intended to take input from the serial terminal and turn on and off LEDs on my circuit board. When I enter commands on the terminal (set to 9600 baud) neither the 'TX' or 'RX' LEDS on the project board light up showing the traffic.

Also, I'm very confused by the /RTS and /CTS pins on the Project Board. I've previously used P1 chips with the prop plug and never used them. I looked on the 32810-Propeller-Project-Board-USB-Guide-v3.1.pdf and it only makes a brief description, no application information provided anywhere in any other documentation.

Comments

  • Duane DegnDuane Degn Posts: 10,498
    edited 2021-11-18 18:15
    PUB public_method_name
    coginit (0,@INIT,0)
    

    I think your initial coginit call tries to start the PASM code in the cog which is already being used by the Spin interpreter.

    I'd suggest either using cogstart or use a different cog number with coginit.

  • Thanks Duane,
    I use that command successfully in other code. It's not that.

  • iseriesiseries Posts: 1,025

    Hold on here, back in the day this was my go to board until I moved on.

    The LED's are driven by the FTDI chip and not the RX/TX lines that you are using. So no these do not light up using the RX/TX connections on the QuickStart Header.

    The RX/TX pins are however connected to the FTDI chip and so data going through there does reach the QuickStart Header.

    I would not use those pins for your example and instead pick some other pins like P0/P1. The default baud for FTDI is 115200.

    Mike

  • Thanks Mike,

    I am using the FTDI chip for serial (from PC) and my comment about the LEDS not flashing is when I'm sending characters from the Parallax Serial Terminal.

    I will try using the 115200 baud, will adjust my timing lengths to fit.

  • @Master_Yoda said:
    Thanks Duane,
    I use that command successfully in other code. It's not that.

    Thanks. I learned something new.

    Here's some text from page 76 of the Propeller Manual which helped me understand why you were correct.

    a cog can use COGINIT to stop and restart
    itself to run, perhaps, completely different code.

  • Tried running at 115200 baud as recommended by Mike. No luck...

  • Duane,

    Glad I could help. I don't use SPIN, therefor I consider it a waste to leave the interpreter running in cog 0.

  • iseriesiseries Posts: 1,025

    Ok, Let's try something simple first.

    So you have the unit plugged into the pc and you load your program with terminal and then nothing.

    Here is a simple C program that takes in a character and echo's it back to you, double character appear in terminal.

    /**
    * @brief Simple serial test program
    * loop serial data back to terminal
    */
    
    #include "simpletools.h" 
    #include "propeller.h"
    
    int i;
    
    int main()
    {
    
      while (1)
      {
        i = getChar();
        putChar(i);
      }    
    }
    

    Mike

  • Mike,

    Pretty much. I'm currently building an 8-LED debug display to see where this program hangs. Good idea with the C echo program, I'll try it as a sanity test. However, I'm trying to avoid high-level languages. Otherwise, I'd just go for an Arduino. Being able to 100% program in PASM and write self-modifying code and do stuff like LMM is what drew me to the P1.

  • Thanks folks. I found a solution. I'm running full FullDuplexSerial in another cog. The other cog will run my code in PASM and interface with it.

Sign In or Register to comment.