Shop OBEX P1 Docs P2 Docs Learn Events
Getting Debug to work? — Parallax Forums

Getting Debug to work?

Kirk FraserKirk Fraser Posts: 364
edited 2011-06-15 13:08 in Propeller 1
The Prop and memory chip work, now it's my software. I've put together routines from the obex BS2 attempting to minimize the code needed for RCTime and PWM for testing to make certain they work for me. First I need to get DEBUG to work with the serial screen so I can interact and see what's needed. I've loaded the program into EEPROM but nothing happens even when I enable the serial terminal in advance, it only says waiting for busy port for a few seconds then quits doing anything. In my understanding it should put up the pin request message right away. Am I not doing something to start the initial code? Thanks.

Comments

  • Dave HeinDave Hein Posts: 6,347
    edited 2011-06-14 16:03
    I think you have the Rx and Tx pins swapped in the call to Debug.start. It should be Debug.start(31, 30,, 0, 115200).

    EDIT: You also need to define _clkfreq and _clkmode. It's nomally defined for 80 MHz as follows:
    CON
      _clkmode = xtal1+pll16x
      _clkfreq = 80_000_000
    

    The actual mode and frequency may be different depending on your hardware.

    And you should put a waitcnt(clkfreq*3+cnt) before your first print to give you enough time to enable the Prop terminal.
  • Kirk FraserKirk Fraser Posts: 364
    edited 2011-06-14 16:39
    Thanks, that makes it go. Now I get gibberish displayed instead of the string. I know it's the string that's going because I changed the words and the gibberish changed.

    Is there a good example with all the debug details? Thanks. I'll eventually want to report numbers as well as text like on the BS2 debug.

    Ediit: It works with your edit! Thank you!
  • StefanL38StefanL38 Posts: 2,292
    edited 2011-06-14 21:37
    I would'nt define clkfreq directly
    I always use
    chrystalfrequency and pllfactor
    CON
            _clkmode        = xtal1 + pll16x
            _xinfreq        = 5_000_000
    

    If you receive "gibber" what type of propellerboard are you using?
    sending serial data is sensitive about exact timing
    you must have a chrystal and the constant _xinfreq must match the chrystals frequency

    some boards have a 8MHz or 10MHz chrystal. So please post the kind of board and - if you know - the chrystalfrequency.

    then setup the right value in the constant-section for _xinfreq
    best regards

    Stefan
  • Kirk FraserKirk Fraser Posts: 364
    edited 2011-06-15 00:17
    Stefan, It's already working correctly, thanks. Sorry for confusion because after my gibberish complaint Dave responded by editing his post instead of posting again and I did likewise.

    The board is a "3M Solderless Breadboard" and the circuit is as described on page 27 of "Propeller Education Kit Labs: Fundamentals." The crystal I use is the special 6.25 MHz unit available from Parallax to enable 100 MHz operation which is considered a safe maximum.
  • Dave HeinDave Hein Posts: 6,347
    edited 2011-06-15 13:08
    The Spin tool allows for defining either _clkfreq or _xinfreq, and it computes the other one. And, of course clkfreq and _clkfreq are two different things. _clkfreq is a constant defined at compile time, and clkfreq is the value determined at runtime. _clkfreq and clkfreq have the same value when the program starts up, but clkfreq can change if the program changes the clock mode.

    clkfreq is stored at location zero, and can also be accessed as long[0]. It generates the same bytecodes either way.
Sign In or Register to comment.