Shop OBEX P1 Docs P2 Docs Learn Events
I don't even know... — Parallax Forums

I don't even know...

DavidZemonDavidZemon Posts: 2,973
edited 2013-10-05 14:29 in Propeller 1
I'm trying to breathe here... but I'm at wits end. Here's my story:
  1. Sit down in the morning, plug the Propeller (Quickstart board) into my computer (Ubuntu 12.04) and test some code that I just finished writing yesterday. Code compiles fine and programs to the board - result in the serial terminal looks similar to when the baud rate is incorrect.
  2. I assume something is wrong with the new code, so I write a quick "Hello world" program. Same result.
  3. I add a blinking LED pattern (rotating the blinking LED down the line once per second) to the "Hello world" program, and the LED blinks perfectly. This makes me think that something is wrong with the UART to USB chip on the dev board, so I call Parallax to request an RMA. Chris encourages me to do some more software debugging, which I do.
  4. I pull out my personal laptop (running Ubuntu 13.04 and the version of GCC packaged with SimpleIDE 0.8.5), retype the simple "Hello world" program, and try again. This time, propeller-load fails at the verification stage.
  5. Assuming I was right in the first place and that it's a hardware problem, I pull out my own Quickstart board from home and re-run the tests. Same exact problem in both cases. I am now assuming there is no hardware problem and something WHACK has happened to both of my computers.
  6. I pull up a co-worker's Windows 7 computer sitting next to me with SimpleIDE 0.9.43 on it and run a test directly from SimpleIDE (no custom make file this time)... it works flawlessly. I cuss, I ponder, I cuss some more, I try to breathe, and finally I wipe my spare partition on my personal laptop and install a fresh version of Ubuntu on it (13.10).
  7. Not wanting to test any new weird versions of propgcc, I download the binary package for progcc 0.3.4 and move the files to /opt/parallax. Again, recompile and re-run the above mentioned program (with the blinking LEDs) and I get the same weird output
david@balrogJr-Saucy:$ make -f ../Makefile run
/opt/parallax/bin/propeller-load -bQUICKSTART HelloWorld.elf -r -t -e
Propeller Version 1 on /dev/ttyUSB0
Loading HelloWorld.elf to EEPROM via hub memory
4640 bytes sent                  
Verifying RAM ... OK
Programming EEPROM ... OK
Verifying EEPROM ... OK
[ Entering terminal mode. Type ESC or Control-C to exit. ]
�
  ��
     ����P �
                 ��
                    ����P �
                                ��
                                   ����Pmake: *** [run] Interrupt


$

Any help would be greatly appreciated. When I left work yesterday at 5pm, the board was working great, being programmed from my work computer running Ubuntu 12.04 (and propgcc installed from source... last updated about a week ago).

Comments

  • DavidZemonDavidZemon Posts: 2,973
    edited 2013-09-18 19:16
    Just noticed that SimpleIDE 0.9.40 has been released for Linux - downloaded that and have the same problem. Still messed up characters combined with the correct LED pattern.
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2013-09-18 19:25
    Can you post the actual code that you are running? It sounds like the Oscillator isn't being defined correctly. That would make the BAUD all out of sorts, but the LED sequence would be intact.
  • jazzedjazzed Posts: 11,803
    edited 2013-09-18 19:30
    I'm trying to breathe here... but I'm at wits end. Here's my story:
    1. Sit down in the morning, plug the Propeller (Quickstart board) into my computer (Ubuntu 12.04) and test some code that I just finished writing yesterday. Code compiles fine and programs to the board - result in the serial terminal looks similar to when the baud rate is incorrect.

    This is a Quickstart issue.

    Parallax chose to leave P30 floating so people could reuse it for other purposes (not how I would have done it).

    One solution to this is to set bit 30 on at the beginning of the program. I.E. DIRA |= (1 << 30)

    The other solution is to add a 10K or 100K pull-up on the P30 pin.
  • DavidZemonDavidZemon Posts: 2,973
    edited 2013-09-18 19:31
    #include <propeller.h>#include <gpio.h>
    
    
    void main (void) {
        uint32_t led;
        uint8_t i = 0;
    
    	// Added these two lines as per jazzed suggestion
    	GPIODirModeSet(BIT_30, GPIO_DIR_OUT);
    	GPIOPinWrite(BIT_30, BIT_30);
    
        GPIODirModeSet(BYTE_2, GPIO_DIR_OUT);
        
        while (1) {
            __simple_printf("Hello world! %u\n", i);
    
    
            led = ((uint32_t) 1) << 16;
            led <<= i%8;
            GPIOPinWrite(BYTE_2, led);
            waitcnt(CLKFREQ + CNT);
            i++;
        }
    }
    

    gpio.h contains a lengthier version of the following:
    #define GPIO_DIR_IN            0#define GPIO_DIR_OUT        -1
    
    
    /* @Brief: Set selected pins as either input or output
     *
     * @param    pins        bit mask to control which pins are set as input or output
     * @param    dir            I/O direction to set selected pins; must be one of
     *                         GPIO_DIR_IN or GPIO_DIR_OUT
     */
    #define GPIODirModeSet(pins,dir)        DIRA = (DIRA & (~(pins))) | ((pins) & dir)
    
    
    /* @Brief: Allow easy write to a port w/o destroying data elsewhere in the port
     *
     * @param    pins        bit mask to control which pins will be written to
     * @param    value        value to be bit-masked and then written to the port
     */
    #define GPIOPinWrite(pins,value)        OUTA = (OUTA & (~(pins))) | ((value) & (pins))
    

    The make file specifies the QUICKSTART board, which contains:
    # quickstart.cfg    clkfreq: 80000000
        clkmode: XTAL1+PLL16X
        baudrate: 115200
        rxpin: 31
        txpin: 30
        tvpin: 12   # only used if TV_DEBUG is defined
        cache-driver: eeprom_cache.dat
        cache-size: 8K
        cache-param1: 0
        cache-param2: 0
        eeprom-first: TRUE
    

    --Edit--
    I added the snippet of code as per jazzed's suggestion and it didn't have any effect.
  • DavidZemonDavidZemon Posts: 2,973
    edited 2013-09-19 08:06
    The problem was a missing #include <stdio.h>. I don't know how it was working before and I don't know why it wasn't throwing a compiler warning/error.... but it's working now.
  • jazzedjazzed Posts: 11,803
    edited 2013-09-19 09:40
    -Wall

    You can also set the Warn All checkbox in the SimpleIDE Project Manager -> Compiler Tab.

    I don't really see how the missing #include "stdio.h" affects this, but that's ok.

    It's a bit odd to call __simple_printf() directly.
  • DavidZemonDavidZemon Posts: 2,973
    edited 2013-09-19 10:32
    I turned -Wall flag off because I do a lot of
    if (err = DoCoolFunction()) {LogErrorCode(err);}
    

    I wish there was some way to request all warnings *except* assignment within if-statement.

    I don't understand how missing the include affected it either... but it DEFINITELY did. I added the line, it works. I removed the line, it broke again. :(
  • David BetzDavid Betz Posts: 14,516
    edited 2013-09-19 10:46
    jazzed wrote: »
    -Wall

    You can also set the Warn All checkbox in the SimpleIDE Project Manager -> Compiler Tab.

    I don't really see how the missing #include "stdio.h" affects this, but that's ok.

    It's a bit odd to call __simple_printf() directly.
    Is there a reason that you include system headers like stdio.h using the double quote syntax rather than the standard angle bracket syntax?
  • jazzedjazzed Posts: 11,803
    edited 2013-09-19 11:05
    David Betz wrote: »
    Is there a reason that you include system headers like stdio.h using the double quote syntax rather than the standard angle bracket syntax?

    I don't.
  • jazzedjazzed Posts: 11,803
    edited 2013-09-19 11:06
    I turned -Wall flag off because I do a lot of
    if (err = DoCoolFunction()) {LogErrorCode(err);}
    

    if ((err = DoCoolFunction())) {LogErrorCode(err);}
  • David BetzDavid Betz Posts: 14,516
    edited 2013-09-19 13:36
    jazzed wrote: »
    I don't.
    Sorry, your reply to an earlier message said:
    I don't really see how the missing #include "stdio.h" affects this, but that's ok.
    So I assumed that was your practice. I guess that was just a typo.
  • jazzedjazzed Posts: 11,803
    edited 2013-09-19 14:05
    David Betz wrote: »
    Sorry, your reply to an earlier message said:

    So I assumed that was your practice. I guess that was just a typo.
    I was referring to the previous poster's statement.
  • jazzedjazzed Posts: 11,803
    edited 2013-09-19 15:30
    jazzed wrote: »
    I was referring to the previous poster's statement.

    Hmm, I guess it was a typo. That's probably the first thing I did this morning. Sorry for the confusion.
  • David BetzDavid Betz Posts: 14,516
    edited 2013-09-19 18:40
    jazzed wrote: »
    Hmm, I guess it was a typo. That's probably the first thing I did this morning. Sorry for the confusion.
    No problem. I asked because I thought there might be something about SimpleIDE that required the quotes instead of the angle brackets. I'm glad to hear that there isn't! :-)
  • Dave HeinDave Hein Posts: 6,347
    edited 2013-09-19 18:54
    jazzed wrote: »
    if ((err = DoCoolFunction())) {LogErrorCode(err);}
    SwimDude, try Jazzed's suggestion of using the double parens when doing an assignment with the if statement. This will eliminate the warning and allow you to use -Wall. I'm just restating it here in case you missed it in his earlier post.
  • DavidZemonDavidZemon Posts: 2,973
    edited 2013-10-05 14:29
    I missed that suggestion completely! Thanks for bringing it up again - I've implemented that throughout all of PropWare now and re-enabled -Wall in common.mk
Sign In or Register to comment.