Question: strange/crashy behavior on SAMD chip (Adafruit Feather M0) Hi all - I've been

Question: strange/crashy behavior on SAMD chip (Adafruit Feather M0)

Hi all - I’ve been wrestling with an issue for a few weeks, and I’m curious if anyone else has suggestions/has seen something similar. I have a project that runs fine on a Feather 32u4 (AVR) but when I run it on a M0 (an SAMD chip like the Zero) it runs for a while but eventually crashes.

The particular area of problem seems to be around palettes - in particular, I have a set of gradient palettes that I am switching between periodically (created with DEFINE_GRADIENT_PALETTE, using the cool paletteknife code). It flies along switching happily for a while - and then finally crashes on some random palette change.

I should note - I had an even weirder palette-related bug previously, where the M0 would just lock up instantly on load. It turned out that RENAMING the variables for a couple of the palettes (just two, and always those two) fixed the problem. Which…well, I still haven’t been able to even theorize intelligently around what was happening there. Presumably something memory related, but unclear to me why it runs fine for hours on the AVR chip but only lasts 2-3 mins on the SAMD (admittedly, I do not have deep understanding of the architectural differences).

Anyone seeing similar behaviors with a SAMD device, and/or have any suggestions? (Mostly want to use it as my program has slammed into the ceiling in terms of program size for the 32u4 feather - hoping to avoid ripping stuff out.)

Thanks, and thanks for the awesome library.

A bit more info after more tweaking/debugging - it appears to be related to particular gradients. I can alternate/rotate between a few “good” gradients for at least quite some time, but as soon as I add a “bad” gradient to the mix it crashes. A “good” gradient is:
DEFINE_GRADIENT_PALETTE( pinky ) {
0, 227,101, 3,
117, 194, 18, 19,
255, 92, 8,192};

A “bad” one is:
DEFINE_GRADIENT_PALETTE( ryg_gp ) {
0, 255, 0, 0,
127, 255,255, 0,
255, 0,255, 0};

I think I’ve noticed a similar issue/crash with Mark’s ColorWavesWithPalettes sketch on a nrf51/rfduino/simblee, but was never able to pin it down. I ended up using only a handful of palettes that seemed to work consistently. I’ll try to revisit the issue soon.

Thanks for letting me know - good to know I’m not totally crazy (at least in this case :slight_smile: ). If I figure out any more details I will post back.

FYI for those following this issue, I think I have a piece of code that replicates it, but ran out of time before my “deadline” (read: event in the desert in Nevada) so haven’t had a chance to clean it up, test it thoroughly, and submit it yet. Will try to do so this week.

If anyone else wants to try it, I’m pretty sure this code will crash consistently on a SAMD chip (at least on a Feather M0) - would be curious if others see same.