SOLVED: Print to Console Example for Troubleshooting?

Hi All!

I’ve got my IDE all set up and haven’t had any issues with the example programs. I’ve started working on some of my own projects using the DaisySP classes - namely a 6 knob modulated delay.

I’ve had a little trouble implementing the modulation oscillator and I should be able to troubleshoot myself, but I need to see what the float values of some of my variables are while the program is running.

Is there an example program that shows how to print to the console while a program is running? I have tried running this example:

Which appears to use sprintf - but I don’t get any tick counts in my console while it’s running. I should note at this point that I am working on a Windows 10 machine and I’m generally using powershell to make and upload my compiled programs.

I’ve previously worked with Bela and in order to get console output from Bela it did require using SSH to log into the debian environment. I’m not sure if there is a similar process required for STM based systems?

Any hints for printing variable values to the console on windows would be a big help!

Thanks,
-Kyle

1 Like

I can’t give you exact instructions, but at least I’ll point out where your expectations are wrong.

Your experience with Bela would be quite different compared to working with bare MCU. On Bela you were printing to OS shell and just needed to access its output with SSH.

What you may want instead is a hardware debugger that would let you access MCU and see variable state, trace your program execution step by step in IDE, even see hardware registers state. There’s been some discussion about this in another thread

The example you’ve mentioned shows how to setup Daisy as an USB CDC device. This allows you to communicate with it like you would do with something like USB modem. So it won’t magically print to your system shell, but you will get device that outputs data if you use the right driver. This is similar approach to what Arduino uses. I have no idea how it’s done on Windows, but you also may also try to use Bela as USB host if all else fails. It’ a Linux machine after all, usually CDC device would be visible as something like “/dev/ttyACM0”, but you may have to add custom UDEV rules for that to happen automatically.

You may also research “ARM semihosting” - that would allow you to make system calls from host OS on MCU. I’m not sure how usable is windows for this.

I would use a terminal emulator software, [putty]
(https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html) or the Arduino “Serial Monitor” in the “tools” menu.

the USB CDC software example you link to should send on the virtual usb tty 115200,8,n,1

Set Putty to “serial” and the COM port that windows10 assigns to the daisy usb CDC connectio, speed 115200. Click “Open” to open the terminal window, and you should be able to see the output.


(I can’t try the example myself - don’t own a Daisy yet.)

1 Like

Thanks, Jens! You’re exactly right. This worked perfectly. I used the device manager to find the correct COM port (in my case COM3) and then used Putty as you described - just setting the buad speed and changing the COM1 to COM3.

The example works exactly as expected and displays “Tick: ##” once a second.
I should easily be able to adapt this in my program to read variable values.

Thanks again!!
-Kyle