Can't use neotrellis with daisy seed

Hey everyone. I have created a simple sketch to light up an LED on my neotrellis 4x4 board. Here is the snippet:


#include "daisy_seed.h"
#include "dev/neotrellis.h"



using namespace daisy;



DaisySeed hardware;


auto main() -> int
{
    // Required hw initialization
    hardware.Init();
    // ---------- INITIALIZE NEOPIXELS ----------------------
    NeoTrellisI2C neotrellis;
    NeoTrellisI2C::Config neotrellis_config;
    neotrellis.Init(neotrellis_config);
    
    neotrellis.pixels.SetPixelColor(0, 255, 0, 0);
    neotrellis.pixels.SetBrightness(255);
    neotrellis.pixels.Show();
    
    // main loop
    while(true)
    {
   
    }

    return 0;
}

However, when I run it nothing happens. Moreover, when I try to debug calls to SetPixelColor, SetBrightness or Show I can’t, seems like they get optimized away by the compiler for some reason.
Can you please tell me what is wrong with this code?

Bonus question: whenever I launched the debugger before, I would always land on the first function call hardware.init() because there is a flag in the debug task "runToEntryPoint", however, now, without me changing anything (at least conciously) every time I start debugging it jumps to a seemingly random place which is startup_stm32h750xx.c line 1544 do you have any idea what might be the cause of that?

Thanks!

Is this a snippet, or is it a complete program which can be built and run?
With rare exception, it’s best to post a complete example which demonstrates the problem you’re having.

This is a complete program. It is supposed to light up first pixel of a neo trellis board red.

About the optimizing away part of my question, I actually figured it out. It is due to the fact that all those functions are inline. So, changing the optimization flag to -O0 helped with that. However, I still don’t understand why is there no output from the board.

I connected it to the arduino uno and ran a simple example from the adafruit library and everything worked there, and by looking at the code there I see the same functions being called, so not really sure what is the problem.

Interesting - I’ve been meaning to pick up some neotrellis…

Hmmm, what about the I2C? on the correct pins? pullups? which Daisy - Seed?

Hey, it’s working. Turns out I managed to damage the board somehow between unplugging it from Arduino and plugging it to Daisy :frowning: idk how that happenned, but I wasn’t able to get the example from arduino running on it again either. I have a spare one and when I plugged it in it worked right away. Just to be clear, here’s a kinda “hello world” project for neotrellis. It sets the first pixel on the board to red

#include "daisy_seed.h"
#include "dev/neotrellis.h"

using namespace daisy;

DaisySeed hardware;


auto main() -> int
{
    // Required hw initialization
    hardware.Init();
    // ---------- INITIALIZE NEOPIXELS ----------------------
    NeoTrellisI2C neotrellis;
    NeoTrellisI2C::Config neotrellis_config;
    neotrellis.Init(neotrellis_config);

    neotrellis.pixels.SetBrightness(255);
    neotrellis.pixels.SetPixelColor(0, 0, 0, 0);
    neotrellis.pixels.Show();

    while(true)
    {
   
    }

    return 0;
}

1 Like

Excellent! It’s always good to have spares for verification.