Using Petal.Seed.Printline on Petal

I’m trying to print some values for debug. Just calling petal.seed.Startlog(true); seems to crash the seed. Startlog(false) doesn’t crash but then calling Printline does nothing as far as I can tell. Has anyone used Printline successfully on Petal?

This is how I use it on the Seed:

Also see this issue:

Thanks Staffan, I’m probably closer but it’s still not working. I installed PuTTY and discovered that seed is on COM6, configured COM6 and PuTTY to the same settings, but still no output from PrintLine.

I think I need to see an example on a Petal. There may be some critical sequence I haven’t discovered.

petal.Init();

petal.seed.StartLog(false);

petal.StartAdc();
petal.StartAudio(AudioCallback);

// this does nothing
petal.seed.PrintLine("asdf");
1 Like

Try to put a delay of 500ms after the startLog()-call as it says in the github issue:

System::Delay(500);

Stepping through in the debugger I’m giving it a lot longer than that. But I added the delay and no joy.

Sorry, but then I am out of options. Like you said, it would be nice to get some feedback from a person who owns a Petal (which I do not).

Just curious. If you uncomment these line:

petal.StartAdc();
petal.StartAudio(AudioCallback);

does it work? (And of course remove any other stuff related to the Adc’s in the main loop().)

Thanks for trying Staffan, but still nothing.

petal.Init();
petal.seed.StartLog(false);
System::Delay(500);

// this does nothing
petal.seed.PrintLine("asdf");

Damn! :slight_smile:

The only thing that looks a bit strange to me (but that could be just my lack of proper C++ knowledge) is how you write petal.seed.*, ie what does that “seed.” do? Do you have to do it like that on the petal?

This is basically how I write in my program (for the Seed):

using namespace daisy;
using namespace daisysp;
DaisySeed hardware;

In main():

hardware.StartLog(false);
hardware.PrintLine(“debug test”);
System::Delay(100);
hardware.StartAudio(AudioCallback);

You’re creating an instance of the DaisySeed class called hardware. The Petal class has an instance of DaisySeed called “seed”. So with petal you don’t want to create another instance of DaisySeed, just use the one inside the petal object.

So I created an instance of DaisySeed and ran this code:

seed.Init();
seed.StartLog(false);
System::Delay(500);
seed.PrintLine("asdf");
System::Delay(500);

exit(0);

Still no output so I suspect this is a USB or comm port config issue and not code related. Not sure how to debug this but I’ll try a different virtual comm port tool, though what I’m using, PuTTY seems pretty straight forward.

I get the same results with RealTerm.

When using stlink I moved the usb cable from the seed to the stlink board. I don’t need a usb cable on both do I?

Have you tried with just an usb cable, no ST LINK? I’ve only used usb.

Sorry i couldn’t be of more help…

1 Like

Wow! That was a great insight. I removed the stlink and hooked up without it and now the com port logging works. So maybe the com port that I see through the stlink is not the same one as the seed logger?
From stlink I get COM6 and from seed I get COM5. Maybe if I connect both usb cables I can debug and log. (More usb cables arriving tomorrow.) But for now at least I can print values to the screen.

Many thanks Staffan!

1 Like

Great!:+1::slightly_smiling_face: This info and your struggle will surely be of use to others.