(02-05-2014, 05:19 PM)linus81 Wrote: Hi everyone, I was wondering .... why an terminal emulator for the CDC was not included in the IDE? It would be convenient not to use external emulators. Thanks.
USB CDC provides virtual COM port and any existing terminal emulation program should be able to open the port. So as Pinguino said, there is no need to reinvent the wheel. I use both SCRT and PuTTY on Windows and minicom on Linux.
I believe the Pinguino IDE designer had the idea of including a terminal emulator to be used as a debug port, but not implemented. Following other compiler philosophy, writing to stdout and reading from stdin are expected to be redirected to UART but I don't know if it works for Pinguino. In fact I find it easier in programming to explicitly selecting the in/out device.
Using USB CDC as debug terminal has a few disadvantage. The host PC and the Pinguino need to establish the device configuration before opening the port. The port number will be different for different PCs. Once the connection is broken, you need to close the current connection before opening a new connection. If the previous connection was closed after Pinguino is reset, Pinguino needs to detach and attach CDC or reset again.
These problems will give you at least 2 practical problems.
1) You can't open the port and wait for Pinguino to start, you have to open the port after Pinguino start. If you don't want to miss the initial debug message you may be sending, you need to add a delay or blocking statement in the application. Alternatively, you can write a program to look for the CDC port available and call a terminal emulator upon detection.
2) If you are having problem of Pinguino reset due to whatever problem such as watchdog, the terminal will not work until you close and restart.
Considering the above, using UART as debug port is more appropriate. Just set the terminal emulator ready and start or restart Pinguino any time. If TTL to RS232 signal conversion is an issue, you can search this forum as well as Google to get simple converter using a transistor or FET.
I may sound a little paradoxical, but I find it more convenient not to use Pinguino IDE and built-in debugger even if it is provided in future simply because the editor quality has a long way to catch up with many editors available besides I am more used to call make from command line script.
This gives me more flexible automated compiling, loading and debugging cycle. In my script, the attached cdcterm.exe (remove .txt from the name) is called after the mphidflash.exe successfully uploading the hex file. It will search for the vendor id and product id to look for Pinguino CDC to be available. Once it is detected, it execute PuTTY.
With about 2 seconds delay in Pinguino startup (setup()) allows to capture every CDC output.