Shop OBEX P1 Docs P2 Docs Learn Events
Mysterious incorrect values returned from HUB RAM — Parallax Forums

Mysterious incorrect values returned from HUB RAM

kevin@cachia.comkevin@cachia.com Posts: 23
edited 2011-02-23 15:10 in Propeller 1
I'm working on an interactive LED Array cube and wrapping up most of the code and having great success with PropBasic. Figured out most of my issues, but I'm puzzled on one.

I thought I would post it up for just some general feedback on any ideas one other things to try, from you guys. I'm going to read through the rather large animation code part in case I missed something, but just want to see if anyone had some suggestions meanwhile.

Here's what I'm stumped on:
I have several COGs that are working great passing data through the HUB/RAM to and from sensors, etc. But for one value I pass from the main COG to a second COG I call the animation cog. The value is a select number of which animation it plays on the LEDs. However, occasionally I get a completely random "corrupt" data in it's COG and of course the COG doesn't know what to do with it since it's outside the range of value I'm expecting so my LEDs all turn off since it can't decide what animation to display.

If I do serout reads on the main cog which is the only cog that every writes to the hub for that value it never fails, only when the read occurs in the animation cog. 99% of the time it's fine. It should be between 1-8, but i will get 192, 83, 553, etc. if i use a Word or Long in the hub. If I switch to a Byte then I will get 0 on occasion. It appears to be random and not consistent.

If I make a 2nd set of variables and pass the same value through them and I serout them both in my animation COG, the one that is being used will still get the error, but it's reference variable is fine.
I've also tried changing my COG assignments around thinking maybe the COG is defective but it's still happening. I can fix it with some validation code, but it shouldn't be occurring and I just like a challenge and learning.

It almost seems like another address is getting shifted over to far and some bits spill into the memory location so I get a larger number.

Thanks,

-Kevin

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2011-02-18 15:24
    This doesn't give us much to go on. We would need to see some code in order to help you. Titles can be edited in the top post in advanced mode.

    ... but sounds suspiciously like memory corruption. What size are your stacks?
  • kevin@cachia.comkevin@cachia.com Posts: 23
    edited 2011-02-20 16:35
    I realized including code would help. I just thought maybe someone had some standard things to check. I'll try and post the section of code that is causing the problem, and remove the unrelated tasks to simplify it. I don't there are stacks in PropBasic it's handled behind the scene by the compiler. I am using the LMM on the task that seems to have the issue. I'll try and get something attached to this in the next day since I have some free time.

    Thanks for responding.
    -Kevin
  • MagIO2MagIO2 Posts: 2,243
    edited 2011-02-21 11:21
    Don't simplify! Often the simplyfied code is not the problem. If your project is to big, then ZIP it and attach the zipped file.
  • kevin@cachia.comkevin@cachia.com Posts: 23
    edited 2011-02-23 15:10
    Thanks for your responses guys. I actually found what I thought was an unrelated issue in the way I was understanding and assuming the Random function behaved. I had wondered why I was getting what also seemed to be intermittent speed delays. When I fixed that code the random memory values seem to have mostly gone away. I'm going to remove a couple lines I had added in, and see if it's still working correctly now. All my animations are much faster and more consistent and my soft button I have was also behaving mysteriously, it's working perfectly now also.

    I figured it was something I was doing being a noob, but couldn't put my figure on it. I'll post a link to a video when it's done.

    Thanks everyone especially Bean for helping me understand his awesome PropBasic. ;)

    -Kevin
Sign In or Register to comment.