Mysterious incorrect values returned from HUB RAM
kevin@cachia.com
Posts: 23
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
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
... but sounds suspiciously like memory corruption. What size are your stacks?
Thanks for responding.
-Kevin
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