Shop OBEX P1 Docs P2 Docs Learn Events
PropBOE LMM and CMM modes — Parallax Forums

PropBOE LMM and CMM modes

RsadeikaRsadeika Posts: 3,837
edited 2012-12-20 09:48 in Propeller 1
I am having a weird problem with my PropBOE when running the program below in CMM mode. I have the R1 LED wired to P7, when I run the code in LMM, it flashes as expected. When I run the program in CMM, the LED turns on and stays on, it does not flash. I ran the code below on my QuickStart, and it worked as expected in both LMM and CMM modes. When I run some code without the threaded cogstart, in CMM, the code works as expected. I also wired an LED on the breadboard, and the same thing occurs, works as expected in LMM mode, and does not work as expected in CMM mode.

I am at a loss on this one, it looks like a software problem, but how would that be occurring? I did not see anything that was weird looking on the board, so I make an assumption that it is not a hardware problem. Anybody experience something like that with their PropBOE? Still scratching head ...

Ray
/**
 * @file RBot1.c
 * This is the main RBot1 program start point.
 *
 * 
 *
 */

#include <propeller.h>
#include <stdio.h>


void do_job1(void *arg)
{

    while(1)
    {
        high(7);
        sleep(1);
        low(7);
        sleep(1);
    }
}



int high(int WCpin)
{
    unsigned int bits = 1 << WCpin;
    DIRA |= bits;
    OUTA |= bits;
    return 0;
}

int low(int WCpin)
{
    unsigned int mask = 1 << WCpin;
    DIRA |= mask;
    OUTA &= ~mask;
    return 0;
}


/**
 * Main program function.
 */
int main(void)
{
/*    high(7);
    sleep(2);
    low(7); */

    int stacksize = sizeof(_thread_state_t)+sizeof(int)*3;
    int *stack = (int*) malloc(stacksize);
    int cog;
    cog = cogstart(do_job1, NULL, stack, stacksize); 

                   
    waitcnt(CLKFREQ + CNT);
    printf("Start of program\n");
    
    while(1)
    {
        sleep(1); 
    }
    return 0;
}
«1

Comments

  • jazzedjazzed Posts: 11,803
    edited 2012-12-16 09:34
    Hi Ray.

    I can't reproduce the problem here using P20 on the quickstart. There have been some updates to propeller-gcc, but I don't think anything has been done that will change the results of this program. I'm going to build a new propeller-gcc package and post it just in case. It will take a few hours to build the Windows version. Will post an update when it's ready.

    --Steve
  • RsadeikaRsadeika Posts: 3,837
    edited 2012-12-16 10:07
    jazzed,
    The problem is not with the QuickStart board, it is with the PropBOE board, in CMM mode. That particular program snippet works with all my other boards, when run in CMM mode, it just does not run with the PropBOE board in CMM.

    Ray
  • jazzedjazzed Posts: 11,803
    edited 2012-12-16 11:54
    The code you posted works fine on my PropBOE too with LMM or CMM.

    Propeller-GCC v0_3_5 for Windows is being uploaded if you want to try that - it is the most recent propeller-gcc version 0-3-5 which has all official features. The package should replace the C:\propgcc directory. Don't overwrite your old directory. Rename it if you like.
  • RsadeikaRsadeika Posts: 3,837
    edited 2012-12-16 12:23
    If the code works with your PropBOE, in CMM mode, then I guess I have a problem with my PropBOE board. Anybody have any suggestions as to what might cause this, hardware or software ideas? I bought this board at Micro Center, and it has been more than thirty days. I can just see myself trying to explain to somebody that I consider the board bad because everything else works except when I try run a C threaded cognew in CMM mode, although it does work in LMM mode.

    I am running 0-8-5 on my Windows 8 Pro computer, I can not imagine that the OS would have an effect on something like this. I have to try to figure this out somehow, a $130 is a $130.

    Ray
  • jazzedjazzed Posts: 11,803
    edited 2012-12-16 12:39
    Please try the latest compiler which is not included in SimpleIDE 0-8-5.
    https://code.google.com/p/propgcc/downloads/detail?name=propellergcc_v0_3_5-i686-windows.zip
  • RsadeikaRsadeika Posts: 3,837
    edited 2012-12-16 13:33
    Well, I just downloaded and copied your new propgcc items to my system, and no luck, did not fix the problem. Maybe I have to go back to Spin programming, that way I can still use my PropBOE board for something, since Spin does not use CMM mode. I am not sure I want to layout another $130 just so I can use CMM mode.

    Maybe I will have to revisit using my C3 board for the boebot project, the only thing I will have to do is somehow glue the XBee module in a convenient place, boy, this project is really going in a weird direction.

    Ray
  • jazzedjazzed Posts: 11,803
    edited 2012-12-16 13:45
    Now that you are running the latest propeller-gcc, we have eliminated that as a variable.
    Can you post your .side file for CMM and LMM modes? You are still running the same C file as posted?
  • RsadeikaRsadeika Posts: 3,837
    edited 2012-12-16 14:04
    Problem solved.

    Thanks

    Ray
  • jazzedjazzed Posts: 11,803
    edited 2012-12-16 14:29
    Rsadeika wrote: »
    Attached is the .side that I have been using, I hope that you see something that I may have overlooked.

    That is using LMM mode. You simply change to CMM, reload, and the LED doesn't blink?
    Have you by chance tried replacing all occurences of sleep(1) with waitcnt(CLKFREQ+CNT) ?

    Does your propboe have anything attached to it other than mounting screws for the BOT and the LED?

    I wish I could reproduce this, but I can't. How did you install the updated compiler?
  • RsadeikaRsadeika Posts: 3,837
    edited 2012-12-16 15:06
    That is using LMM mode. You simply change to CMM, reload, and the LED doesn't blink?
    That is interesting, I just did a copy of the folder, when I put it in the zip, and it was set to CMM mode. In fact I just started up SimpleIDE and the setting is in CMM mode, so I am not sure what is going on. But I do know that if I set it to LMM its works as expected.

    At first I had a uSD card inserted, the XBee module inserted, but I pulled it all out, and the problem was still showing up. Since I do not have my boebot yet, I do not have anything bolted to the PropBOE board. It is starting to look like the RemoteBot project will be done in Spin. I think trying to use the C3 for that would not work out the way I want it to.

    Ray
  • jazzedjazzed Posts: 11,803
    edited 2012-12-16 15:31
    Rsadeika wrote: »
    That is interesting, I just did a copy of the folder, when I put it in the zip, and it was set to CMM mode.

    Perhaps you changed mode without compiling or saving the project.

    Ok, well this is disturbing. Maybe we can get Parallax to send you a known good exchange board so we can get the one you have for analysis. Would you be willing to swap boards?

    Thanks,
    --Steve
  • Ken GraceyKen Gracey Posts: 7,392
    edited 2012-12-16 15:51
    Rsadeika wrote: »
    I bought this board at Micro Center, and it has been more than thirty days. I can just see myself trying to explain to somebody that I consider the board bad because everything else works except when I try run a C threaded cognew in CMM mode, although it does work in LMM mode.
    Ray

    Ray - lifetime warranty! Drop me your address and I'll get you a replacement in time for Christmas. We can ship the replacement board tomorrow and you can keep your current PropBOE until the replacement arrives, too. My e-mail address is below. \\

    For kicks, be sure to test it with a bit of Spin code just be sure you've got the I/O pin problem.
  • RsadeikaRsadeika Posts: 3,837
    edited 2012-12-16 16:33
    OK Ken I just sent you an email with my address.

    Now, for testing it with some Spin code, I am not sure how to approach that, in order to determine the problem with CMM mode. I also had a chance to see if I could get the XBee module to work with the threaded cognew function, I could get it to work in LMM mode, but it would not work in CMM mode. I think I might have to try to get the uSD to work, just to see if that is a problem.


    Ray
  • jazzedjazzed Posts: 11,803
    edited 2012-12-16 17:40
    Thanks Ken.

    It is beyond me why the latest (or any) propeller-gcc CMM supported version would fail only on Ray's PropBOE with CMM but work on Ray's Quickstart. There must be some factor, but it is illusive so far. Reproducing problems can be difficult - all we can do is make sure the failing board has minimum changes before it gets shipped back. I wonder if it's some on board marginal power issue or other problem.

    Ray, once you get the new board post your results here with nothing connected but the LED. I think we need to get the old board for analysis in any case.
  • Dave HeinDave Hein Posts: 6,347
    edited 2012-12-16 20:02
    Ray, usually strange results like yours are caused by an uninitialized variable or a stack overflow. I've never used cogstart, so I don't know if you have it set up correctly. Do you have a reference for the code you used as the basis for your program?
  • RsadeikaRsadeika Posts: 3,837
    edited 2012-12-17 01:37
    Do you have a reference for the code you used as the basis for your program?
    Yes, a few months ago, when I started to look in into pthreads, I used an example that was offered in the jazzed toggle series. I started a thread, with that topic in mind, and from the responses to the thread, I came up with the basic code sample, and it worked consistently, until now. I think that thread had disappeared with start of the BETA forum.

    Ray
  • RsadeikaRsadeika Posts: 3,837
    edited 2012-12-17 04:12
    I am not sure what to make of this new problem. I decided to test the uSD, and I used the latest filetest.c program. I put in three different cards, and none of them were being read, but they worked on the C3, so I am thinking that I have a bad uSD reader on my board. As a last resort I decided to go to the learn.parallax site and downloaded the uSD Spin program that they have there. Loaded up the program and the uSD reader works when using Spin, it did the 01 SD Card Test.spin with no problems. So, do I really have a bad board or is there the spotty propgcc issues that are popping up now and then. I wish their was a way to check CMM using Spin, then I guess we would know for sure where the problem might be. I am only aware of filetest.c as the only program that is available for testing the uSD, is there another program available?

    Ray
  • Dave HeinDave Hein Posts: 6,347
    edited 2012-12-17 06:26
    Ray, can you try running the attached filetest.binary program on your Prop BOE? I built it on my PC using SimpleIDE in the CMM mode, and then made the binary using propeller-load from the command line. I'm curious whether this works OK for you. If so, there may be something wrong with your CMM library files.
  • jazzedjazzed Posts: 11,803
    edited 2012-12-17 08:48
  • RsadeikaRsadeika Posts: 3,837
    edited 2012-12-17 08:50
    I just ran the test using SimpleIDE.

    Ray

    Compiled 0 Lines of Code in 0 Seconds

    propeller-load.exe -Dreset=dtr -p COM5 -r D:/Programming/SimpleIDE_0_8_5/Test/filetest.binary
    Propeller Version 1 on COM5
    Loading D:/Programming/SimpleIDE_0_8_5/Test/filetest.binary to hub memory

    29848 bytes sent

    Verifying RAM ...
    Checksum Error!

    error: load failed
  • jazzedjazzed Posts: 11,803
    edited 2012-12-17 09:03
    Rsadeika wrote: »
    I just ran the test using SimpleIDE.

    Can you try loading it with Propeller-Tool ?
  • Dave HeinDave Hein Posts: 6,347
    edited 2012-12-17 09:12
    Yes, try loading it with the Prop Tool. I don't think you can load it from SimpleIDE. You could also load it from the command line using propeller-load, but the Prop Tool would be easier to use. It loads OK on my C3 board. Of course it can't access the SD card on the C3 since I built it for the Prop BOE, and I don't have a BOE to test it on.
  • Dave HeinDave Hein Posts: 6,347
    edited 2012-12-17 09:26
    Maybe you need to make the stack slightly bigger. If I compare the generated assembly from RBot1.c and blinker.c, I see an extra stack write in RBot1. This is because the code in RBot1 is not a leaf function, and it calls other functions. Try making the stack bigger.
  • jazzedjazzed Posts: 11,803
    edited 2012-12-17 09:46
    Dave Hein wrote: »
    Maybe you need to make the stack slightly bigger. If I compare the generated assembly from RBot1.c and blinker.c, I see an extra stack write in RBot1. This is because the code in RBot1 is not a leaf function, and it calls other functions. Try making the stack bigger.

    That is an interesting observation. I'm not entirely convinced, but its worth a try.
    The program fails for me on either LMM or CMM mode reducing the allocated stack size by 1.

    Add 5 (or more) -vs- 3 ints. I.E.
    int stacksize = sizeof(_thread_state_t)+sizeof(int)*5;
  • RsadeikaRsadeika Posts: 3,837
    edited 2012-12-17 10:36
    I got it to run with the Prop tool, I get a '>' , but when I do an ls, it just locks up. I used the verified uSD card, so I know there is no problem with that. I just double checked the uSD card with the 02 SD Card Test.spin, and the uSD card is OK.

    Ray
  • jazzedjazzed Posts: 11,803
    edited 2012-12-17 10:56
    Dave's binary works for me. I had to make sure the SD card was installed before loading the program.
  • mindrobotsmindrobots Posts: 6,506
    edited 2012-12-17 11:04
    I just ran Ray's initially listed program on my PropBOE - P7 -> R1 LED compiled in LMM and CMM with SimpleIDE 0.8.5 (installed on 10/24 on my Win7 32bit laptop).
    It ran fine both ways as LMM and CMM.

    As I read the problem description, I keep going back and forth between hardware and software.

    I'll try Dave's program on my PropBOE as soon as I find one of those pesky little microSD cards on my desk.
  • Dave HeinDave Hein Posts: 6,347
    edited 2012-12-17 11:14
    Ray, it sounds like you may have a hardware problem on your BOE.
  • RsadeikaRsadeika Posts: 3,837
    edited 2012-12-17 11:16
    jazzed, is the SimpleIDE zip package that is available now, up to date. I think I am going to uninstall SimpleIDE, and then do a fresh install, I want to try to eliminate Windows 8 Pro as being the culprit. Now, before I do that, anybody have anything that I should try with the current installation?

    Ray
  • jazzedjazzed Posts: 11,803
    edited 2012-12-17 11:37
    Ray, the current version is up to date enough except that it does not have the most recent compiler.

    I forgot that you are running Windows 8 - I wonder if Windows 8 is monitoring power usage too tightly. Could you use a power brick on the PropBOE in addition to the USB? The hypothesis is that just USB power may be a problem, and we need to try and eliminate that possibility.
Sign In or Register to comment.