Shop OBEX P1 Docs P2 Docs Learn Events
using cogs for S2 — Parallax Forums

using cogs for S2

jphilljphill Posts: 4
edited 2013-06-13 22:19 in Robotics
I'm learning to program the S2 and have run into a problem when I attempt to use multiple cogs. It will seem to execute the program correctly for a short time (maybe a few seconds maybe a fraction of a second). Then it will go crazy. Random wheel movements, random lights, the Parallax Serial Tool shows random digits.

I tried to follow the steps in this tutorial, but I think it is less useful because it is not written for the scribbler.

http://gadgetgangster.com/tutorials/326

Does anyone have code they've written for the Scribbler that uses multiple cogs. I'd like to try to see if it is something wrong with my machine.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2013-06-13 17:43
    It's not an issue of using cogs with the Scribbler 2, it's an issue of how you're using them. The symptoms you're describing sound like a stack overflow or one cog's code accessing an array out of bounds so it's writing over data or code elsewhere in memory, not a hardware problem. Post your code as an attachment to a reply.
  • jphilljphill Posts: 4
    edited 2013-06-13 22:19
    Thank you for writing back. I increased the stack space to 50 longs and the problem went away. I did wonder where that stack space comes from. Is there an easy way to guess how much I will need for a given piece of code? How much can I distribute to different cogs before I run out of memory?
Sign In or Register to comment.